Click here to Skip to main content
15,946,320 members
Home / Discussions / iOS
   

iOS

 
PinnedPLEASE READ: How to get an answer to your question Pin
Chris Maunder13-Jan-15 15:36
cofounderChris Maunder13-Jan-15 15:36 
QuestionIOS app for Arduino IoT Pin
noram wireless1-Sep-23 4:19
noram wireless1-Sep-23 4:19 
AnswerRe: IOS app for Arduino IoT Pin
Richard MacCutchan1-Sep-23 4:56
mveRichard MacCutchan1-Sep-23 4:56 
AnswerRe: IOS app for Arduino IoT Pin
Andre Oosthuizen2-Sep-23 23:42
mveAndre Oosthuizen2-Sep-23 23:42 
QuestionImmediate help for presentation writing Pin
siyavash440ر 1110-Sep-22 9:33
siyavash440ر 1110-Sep-22 9:33 
AnswerRe: Immediate help for presentation writing Pin
Richard MacCutchan10-Sep-22 21:20
mveRichard MacCutchan10-Sep-22 21:20 
QuestionNot Enough Storage,这堆英文是什么鬼? Pin
xnny24-Jul-22 18:36
xnny24-Jul-22 18:36 
AnswerRe: Not Enough Storage,这堆英文是什么鬼? Pin
OriginalGriff24-Jul-22 18:41
mveOriginalGriff24-Jul-22 18:41 
AnswerRe: Not Enough Storage,这堆英文是什么鬼? Pin
Birla Ojasvi5-Mar-24 22:59
professionalBirla Ojasvi5-Mar-24 22:59 
QuestionHowto: Exchange data from network to mobile app Pin
David_DK9-Jan-22 21:17
David_DK9-Jan-22 21:17 
AnswerRe: Howto: Exchange data from network to mobile app Pin
Richard Deeming9-Jan-22 21:37
mveRichard Deeming9-Jan-22 21:37 
AnswerRe: Howto: Exchange data from network to mobile app Pin
Member 155103607-Feb-22 1:54
Member 155103607-Feb-22 1:54 
AnswerRe: Howto: Exchange data from network to mobile app Pin
Member 1551036027-Apr-22 3:30
Member 1551036027-Apr-22 3:30 
AnswerRe: Howto: Exchange data from network to mobile app Pin
rareprob solutions4-Oct-22 3:06
rareprob solutions4-Oct-22 3:06 
QuestionAES-GCM 256 Encrypt & Decrypt in iOS Swift Sync with .Net output Pin
Bb M3-Jul-21 12:18
Bb M3-Jul-21 12:18 
I want to use AES-GCM encryption of a plaintext with 'key' only. The 'key' will be received from backend (.net), in webservice response. The same key will be used later in backend as well to decrypt the encrypted value.

I have used extension as follwoing

To generate string to Symetric key

extension SymmetricKey {
init(string keyString: String, size: SymmetricKeySize = .bits256) throws {
guard var keyData = keyString.data(using: .utf8) else {
  print("Could not create base64 encoded Data from String.")
  throw CryptoKitError.incorrectParameterSize
}

let keySizeBytes = size.bitCount / 8
keyData = keyData.subdata(in: 0..<keySizeBytes)

guard keyData.count >= keySizeBytes else { throw CryptoKitError.incorrectKeySize }
self.init(data: keyData)
} }

Encryption & Decryption code snipet:

func aesgcmEncryptDecrypt() {
        let str : String = "FwhXRYJ$xLf?^Kh6_&YfTJ%RuG+EqcTY"    
        var key : SymmetricKey = SymmetricKey(size: .bits256)
        do{
            key = try SymmetricKey(string: str)
        }catch{        
        }
        let plain = "HOW ARE YOU?"
        let nonce = try! AES.GCM.Nonce(data: Data(base64Encoded: "fv1nixTVoYpSvpdA")!)
        let tag = Data(base64Encoded: "e1eIgoB4+lA/j3KDHhY4BQ==")!
        // Encrypt
        let sealedBox = try! AES.GCM.seal(plain.data(using: .utf8)!, using: key, 
        nonce: nonce, authenticating: tag)
        // Decrypt
        let sealedBoxRestored = try! AES.GCM.SealedBox(combined: sealedBox.combined!)
        let decrypted = try! AES.GCM.open(sealedBoxRestored, using: key, 
        authenticating: tag)
        Swift.print("Combined:\n\(sealedBox.combined!.base64EncodedString())\n")
        Swift.print("Cipher:\n\(sealedBox.ciphertext.base64EncodedString())\n")
        Swift.print("Nonce:\n\(nonce.withUnsafeBytes { 
            Data(Array($0)).base64EncodedString() })\n")
        Swift.print("Tag:\n\(tag.base64EncodedString())\n")
        Swift.print("Decrypted:\n\(String(data: decrypted, encoding: .utf8)!)\n")
    }
Our(generated from this code & .Net code) encrypted text is not matching. Anyone can help me, what I am doing wrong, detailing will be more helpful. Basically I was looking for saloution in Objective-C but I did not get any supported library for Objective-C.

QuestionGetComputerObjectNameW Win32 equivalent iOS API Pin
rajneshmalik25-Mar-21 22:34
rajneshmalik25-Mar-21 22:34 
Questionmacos offset value Pin
dsec1225-Feb-21 18:58
dsec1225-Feb-21 18:58 
AnswerRe: macos offset value Pin
Richard MacCutchan25-Feb-21 23:18
mveRichard MacCutchan25-Feb-21 23:18 
GeneralRe: macos offset value Pin
dsec1225-Feb-21 23:24
dsec1225-Feb-21 23:24 
Jokejoke Pin
Member 149089966-Aug-20 23:55
Member 149089966-Aug-20 23:55 
QuestionIOS Pin
Member 149089967-Aug-20 0:16
Member 149089967-Aug-20 0:16 
AnswerRe: IOS Pin
Richard MacCutchan7-Aug-20 2:42
mveRichard MacCutchan7-Aug-20 2:42 
AnswerRe: IOS Pin
zoyafatima8-Oct-21 4:20
professionalzoyafatima8-Oct-21 4:20 
AnswerRe: IOS Pin
novelsmith13-Oct-21 7:22
professionalnovelsmith13-Oct-21 7:22 
QuestionWebview or Native App for electronic signature form Pin
jlmto15-Jan-20 20:40
jlmto15-Jan-20 20:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.