CryptoKit does not support RSA, because its focus is on algorithms that are efficient and secure by default, and RSA fits neither of those categories. If you insist on using RSA, you’ll have to use Security framework, and specifically:
-
SecKeyCreateRandomKey
to generate a private key.
-
SecKeyCopyPublicKey
to get the public key from that.
-
SecKeyCreateEncryptedData
to encrypt with the public key.
-
SecKeyCreateDecryptedData
to decrypt with the private key.
On the AES front, it depends on mode you’re looking for:
The CryptoCompatibility sample code shows many of these APIs in action.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Because the other AES modes are not secure by default.