GENERAL: How to Create a GPG KeyWe

Johnson Nguyen
2022-08-31 17:50

1. Run this command gpg –full-generate-key
    The output should be: 
 
User-added image

2. It will prompt what type of key you want. Please choose the key type you desire.

User-added image

3. In addition, it will prompt how many bits you would like the key to be key. 
**NOTE** The screenshot attached is for RSA keys.

User-added image

4. Now, it will prompt you to choose if the keys will expire.

User-added image

5. Lastly, it will prompt you to add your Name which will be the USER-ID: 

User-added image

6. Finally, the GPG is now created. 

User-added image
***NOTE*** INSIDE THE HIGHLIGHTED RED BOX IS THE NEWLY CREATED GPG KEY

7. Run these two commands which will then output the private.key and public.key files into~/private.key AND/OR ~/public.keygpg --output private.key --armor --export-secret-keys <YOUR_GPG_KEY>
gpg --output public.key --armor --export <YOUR_GPG_KEY>
In addition, run this command to add your public.key to the keystore. apt-key add <YOUR_PUBLIC_KEY_NAME.key>The command will give an “OK” output in the CLI if it was added successfully.

8. To view if it was added to the keystore please run the following command: apt-key list
 The following screenshot will be the output of “apt-key list”

User-added image