From the course: iOS Development: Security
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Creating the private key - iOS Tutorial
From the course: iOS Development: Security
Creating the private key
- [Instructor] Now let's see how asymmetric cryptography works in iOS. I am going to create a new project using the Single View App template. Let's call it AsymmetricCryptoDemo. We're going to implement the class that exposes cryptography-related features. First, I create a new file called KeychainFacade. So let's add a new file, Swift file, and it's called KeychainFacade. We'll rely on the security framework, so let's import it. Next, I declare the KeychainFacade class. First, we'll generate the private key. I'll use the keychain to store the generated key securely. We start the key creation by defining a unique tag of type data, so I create a private static constant, let's call it tagData equals. We'll create a string constant and convert it to data. It should be unique, so let's call it com.asymmetricCryptoDemo.keys.mykey. And I convert it to data using the Strings data method, using a UTF-8 encoding, next, I define the dictionary with the attributes of the key. The keys should be…
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
-
-
-
-
-
-
-
-
(Locked)
Asymmetric cryptography overview1m 25s
-
(Locked)
Creating the private key5m 49s
-
(Locked)
Retrieving the private key from the Keychain4m 32s
-
(Locked)
Defining the asymmetric key accessors2m 9s
-
(Locked)
Performing asymmetric encryption4m 10s
-
(Locked)
Performing asymmetric encryption continued2m 26s
-
(Locked)
Performing asymmetric decryption3m 41s
-
(Locked)
Asymmetric encryption and decryption demo3m 9s
-
(Locked)
-