skavinvarnan / Cross-Platform-AES

Simple cross-platform encryption and decryption using AES
MIT License
142 stars 69 forks source link

Xcode 8.3.2 Swift 3.x, unexpectedly found nil while unwrapping an Optional value #2

Closed mrimadali closed 6 years ago

mrimadali commented 7 years ago

Hi I tried your code in Xcode 8.3.2 Swift 3.x, It crashes in the line print decryptedString. Please help.

screen shot 2017-05-23 at 9 37 47 am
 let plainText = "this is my plain text"
        let key = "simplekey"
        let iv = "1234123412341234"

        let cryptoLib = CryptLib();

        let encryptedString = cryptoLib.encryptPlainText(with: plainText, key: key, iv: iv)
        print("encryptedString \(encryptedString! as String)")

        let decryptedString = cryptoLib.decryptCipherText(with: encryptedString, key: key, iv: iv)
        print("decryptedString \(decryptedString! as String)")
skavinvarnan commented 7 years ago

@mrimadali Your encrypted seems to be wrong. It should actually be rKzNsa7Qzk9TExJ6aHg49tGDiritTUJ08RMPm48S0o4=

Double check if the imports are right

mrimadali commented 7 years ago

@skavinvarnan All my imports are correct. In the bridging header, I'm importing the Library .h file. Do I need to do anything else? Thanks for your help

skavinvarnan commented 6 years ago

Could you try the new release

skavinvarnan commented 6 years ago

Closing due to inactivity