For the encryption/decryption itself I am using the functions from SecTransform.h — and I am just realizing that they have been deprecated. I wrote my code about 5 years ago. Is CryptoKit the recommended replacement? Then I will try this…
Thanks, Jakob
Post
Replies
Boosts
Views
Activity
Thanks, Quinn, for the enlightenment! Creating these random bytes and storing them as a password in the keychain works fine. But for encryption/decryption I need a SecKey. Now when I try to create a SecKey from my byte array (rawKey of type CFData in the following code snippet, size 256 bits):
let parameters = NSMutableDictionary()
var error: Unmanaged<CFError>?
parameters.setValue(kSecAttrKeyClassSymmetric, forKey: kSecAttrKeyClass as String)
parameters.setValue(kSecAttrKeyTypeAES, forKey: kSecAttrKeyType as String)
key = SecKeyCreateWithData(rawKey, parameters, &error)
, I get the error "Unsupported symmetric key type: 2147483649". And with 192 bits and kSecAttrKeyType3DES in place of kSecAttrKeyTypeAES I get "Unsupported symmetric key type: 17". What symmetric key type is then supported by SecKeyCreateWithData?
Kind regards,
Jakob