From the course: iOS Development: Security
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Performing asymmetric encryption continued - iOS Tutorial
From the course: iOS Development: Security
Performing asymmetric encryption continued
- [Instructor] Finally, we can call the sec key create encrypted data function. I use guard and store the return data in the constant called completed text data, guard let encrypted text data equals sec key create encrypted data. Now the first parameter is the public key. The second is the algorithm, and the third is the data to be encrypted, textData, but we have to cast the data to core foundation data. The final parameter is the reference to an error. Though I have to define an optional error variable, of type unmanaged CF error. Var error of type unmanaged CF error. And I pass its address to the function. The function should return data. If the call fails, we throw an error. I check if the error reference contains a valid error. If let encryption error equals error. Otherwise, I should tell the caller that the error is unknown. So, I create two new error cases. Forwarded, which has an associated value of type error, Forwarded, which has an associated value of type error, and…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
Asymmetric cryptography overview1m 25s
-
Creating the private key5m 49s
-
Retrieving the private key from the Keychain4m 32s
-
Defining the asymmetric key accessors2m 9s
-
Performing asymmetric encryption4m 10s
-
Performing asymmetric encryption continued2m 26s
-
Performing asymmetric decryption3m 41s
-
Asymmetric encryption and decryption demo3m 9s
-
-