0

我在尝试加密我的密码时出错。我找不到为什么encryption(iv = "")在 swift 3 中运行良好但现在iv = ""在 swift 5 中无法运行的原因。我该如何解决这个问题?

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: ""))

我很困惑,因为在 swift 5 iv 中 16byte 可用,但在 swift 3 iv = "" 运行良好之前。

4

0 回答 0