Click here to Skip to main content
15,562,163 members
Home / Discussions / iOS
   

iOS

 
PinnedPLEASE READ: How to get an answer to your question Pin
Chris Maunder13-Jan-15 16:36
cofounderChris Maunder13-Jan-15 16:36 
QuestionImmediate help for presentation writing Pin
siyavash440ر 1110-Sep-22 10:33
siyavash440ر 1110-Sep-22 10:33 
AnswerRe: Immediate help for presentation writing Pin
Richard MacCutchan10-Sep-22 22:20
mveRichard MacCutchan10-Sep-22 22:20 
QuestionNot Enough Storage,这堆英文是什么鬼? Pin
xnny24-Jul-22 19:36
xnny24-Jul-22 19:36 
AnswerRe: Not Enough Storage,这堆英文是什么鬼? Pin
OriginalGriff24-Jul-22 19:41
mvaOriginalGriff24-Jul-22 19:41 
QuestionHowto: Exchange data from network to mobile app Pin
David_DK9-Jan-22 22:17
David_DK9-Jan-22 22:17 
AnswerRe: Howto: Exchange data from network to mobile app Pin
Richard Deeming9-Jan-22 22:37
mveRichard Deeming9-Jan-22 22:37 
AnswerRe: Howto: Exchange data from network to mobile app Pin
Member 155103607-Feb-22 2:54
Member 155103607-Feb-22 2:54 
AnswerRe: Howto: Exchange data from network to mobile app Pin
Member 1551036027-Apr-22 4:30
Member 1551036027-Apr-22 4:30 
AnswerRe: Howto: Exchange data from network to mobile app Pin
rareprob solutions4-Oct-22 4:06
rareprob solutions4-Oct-22 4:06 
QuestionAES-GCM 256 Encrypt & Decrypt in iOS Swift Sync with .Net output Pin
Bb M3-Jul-21 13:18
Bb M3-Jul-21 13: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 23:34
rajneshmalik25-Mar-21 23:34 
Questionmacos offset value Pin
dsec1225-Feb-21 19:58
dsec1225-Feb-21 19:58 
AnswerRe: macos offset value Pin
Richard MacCutchan26-Feb-21 0:18
mveRichard MacCutchan26-Feb-21 0:18 
GeneralRe: macos offset value Pin
dsec1226-Feb-21 0:24
dsec1226-Feb-21 0:24 
Jokejoke Pin
Member 149089967-Aug-20 0:55
Member 149089967-Aug-20 0:55 
QuestionIOS Pin
Member 149089967-Aug-20 1:16
Member 149089967-Aug-20 1:16 
AnswerRe: IOS Pin
Richard MacCutchan7-Aug-20 3:42
mveRichard MacCutchan7-Aug-20 3:42 
AnswerRe: IOS Pin
zoyafatima8-Oct-21 5:20
professionalzoyafatima8-Oct-21 5:20 
AnswerRe: IOS Pin
novelsmith13-Oct-21 8:22
professionalnovelsmith13-Oct-21 8:22 
QuestionWebview or Native App for electronic signature form Pin
jlmto15-Jan-20 21:40
jlmto15-Jan-20 21:40 
AnswerMessage Closed Pin
22-Aug-20 19:07
Member 1492059722-Aug-20 19:07 
AnswerRe: Webview or Native App for electronic signature form Pin
Member 155103604-May-22 3:07
Member 155103604-May-22 3:07 
QuestionWhat is free solution to intergrate Digital Signature to App Pin
Member 1471406212-Jan-20 7:29
Member 1471406212-Jan-20 7:29 
QuestionRe: What is free solution to intergrate Digital Signature to App Pin
David Crow12-Jan-20 14:36
David Crow12-Jan-20 14:36 

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.