1

xcode 版本:9.3.1 (9E145)

斯威夫特版本:4.1

我刚刚下载了最新的主副本并使用 CocoaPods 安装了 CryptoSwift。使用 README 中给出的示例:

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,它们都可以正常工作

4

1 回答 1

0

GCM 是 Crypto Swift 的一部分,所以你应该导入 Crypto swift,这是我认为缺少的,所以首先在你的控制器中导入它

导入 CryptoSwift

于 2018-11-30T08:09:19.373 回答