我尝试过的是: (手动输入...请原谅我会很快纠正的错字)
let type = kSecAttrKeyTypeAES
let attributes: [String: Any] = [ kSecAttrKeyType as String: type,
kSecAttrSizeInBits as String: 128 ]
guard let aesKey = SecKeyGenerateSymmetric( attributes as CFDictionary, &error ) else {
throw error!.takeRetainedValue() as Error
}
aesKey的值为nil。没有错误。我也尝试过SecKeyCreateRandomKey,结果相同。
据我所知,这应该给我一个AES密钥。
我在做什么错了?