xcode版本: 9.3.1 (9E145)
Swift版本: 4.1
我刚刚下载了最新的主副本,并使用CocoaPods安装了CryptoSwift。使用自述文件中给出的示例:
do {
// In combined mode, the authentication tag is directly appended to the encrypted message. This is usually what you want.
let gcm = GCM(iv: iv, mode: .combined)
let aes = try AES(key: key, blockMode: gcm, padding: .noPadding)
let encrypted = try aes.encrypt(plaintext)
let tag = gcm.authenticationTag
catch {
// failed
}我得到的错误是“使用未解析的标识符'GCM'”。我尝试过其他函数,如aes.encrypt和aes.decrypt,它们都工作得很好
发布于 2018-11-30 16:09:19
GCM是Crypto Swift的一部分,所以你应该导入Crypto swift,这就是我所缺少的,所以首先在你的控制器中导入它
导入CryptoSwift
https://stackoverflow.com/questions/50502005
复制相似问题