【问题标题】:CryptoSwift: unresolved identifier 'GCM'CryptoSwift:未解析的标识符“GCM”
【发布时间】:2018-05-24 06:01:42
【问题描述】:

xcode 版本:9.3.1 (9E145)

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

【问题讨论】:

  • GCM 从 v0.10.0 开始可用。是你安装的那个版本吗?

标签: swift4.1 cryptoswift


【解决方案1】:

GCM 是 Crypto Swift 的一部分,因此您应该导入 Crypto swift,我认为这是缺少的,所以首先将其导入您的控制器中

导入 CryptoSwift

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多