Private keys allow you to access and authenticate communication with some app services — such as APNs, DeviceCheck, MusicKit, and WeatherKit.
In this example, we will create a key for an app to allow Sign in with Apple functionality. https://developer.apple.com/help/account/configure-app-capabilities/create-a-sign-in-with-apple-private-key
- 2.Under Key Name, enter a unique name for the key.
- 3.Select the checkbox Sign in with Apple and click Configure next to it. You can use any other service you want to enable. (Sign in with Apple is used just for demo purposes).
- 4.On the next page, choose the app identifier you want to use and press the Save button.
- 5.Click Continue
- 6.Review the key configuration, then click Register.
- 7.Download the key; it’s saved as a text file with a
- 8.Click Done.
The key file can only be downloaded once during the creation process. Once the key has been created, it cannot be downloaded again. It is important to keep the .p8 key file in a secure location, as it is used to verify the authenticity of the Sign in with Apple service and protect user data.
If you lose the .p8 key file or need to download it again, you will need to create a new one.
To extract the public key from the .p8 key file, you will need to use a command line tool called "openssl". This tool is included with most Unix-based operating systems, such as Linux and macOS, and can also be installed on Windows.
To extract the public key from the .p8 key file using openssl, follow these steps:
- 1.Open a terminal window.
- 2.Navigate to the directory where the .p8 key file is located.
- 3.Enter the following command:
openssl ec -in [key file name] -pubout
Replace [key file name] with the name of your .p8 key file. For example:
openssl ec -in mykey.p8 -pubout
- 1.The public key will be printed on the terminal window. You can copy and paste the key into your desired location.
- 2.Select the private key to view details
- 3.The key identifier appears below the key name