CryptoSwift: unresolved identifier 'GCM'

479 Views Asked by At

xcode version: 9.3.1 (9E145)

Swift version: 4.1

I have just downloaded the latest master copy and installed CryptoSwift using CocoaPods. Using the example given on the 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
}

I get the error of "Use of unresolved identifier 'GCM'". I have tried other functions like aes.encrypt and aes.decrypt and they all work fine

1

There are 1 best solutions below

0
On

GCM is a part of Crypto Swift so you should import Crypto swift that's what is missing i think so import it first in your controller

import CryptoSwift