I have an error trying to encrypt my password. I can't find a reason why encryption(iv = "")
works well with swift 3 but now is not working with iv = ""
in swift 5. How do I fix this?
userText = userText.replacingOccurrences(of: "\\s+", with: "", options: .regularExpression, range: nil)
let request:NSMutableURLRequest!
let capcha:String! = ""
let encryptedBase64Password = try! passText.encrypt(cipher: AES(key: encrypKeyForLogin, iv: ""))
Fatal error: 'try!' expression unexpectedly raised an error: CryptoSwift.CBC.Error.invalidInitializationVector: file /Users/vietnguyen/Documents/Mac os/Code/Swift5/SlideOutMenu/SlideOutMenu/Login/LoginServer.swift, line 97
2020-09-17 21:48:13.326595+0700 SlideOutMenu[2104:103521] Fatal error: 'try!' expression unexpectedly raised an error: CryptoSwift.CBC.Error.invalidInitializationVector: file /Users/vietnguyen/Documents/Mac os/Code/Swift 5/SlideOutMenu/SlideOutMenu/Login/LoginServer.swift, line 97
Line 97: let encryptedBase64Password = try! passText.encrypt(cipher: AES(key: encrypKeyForLogin, iv: ""))
I'm confused because in swift 5 iv 16byte is available but before swift 3 iv = "" work well.