How To Create A GPG key
In this documentation article we’ll help you to create a new GPG key. BeepBackup uses GPG keys to securely encrypt your backups.
Prerequisites
To follow this tutorial you will need:
- Some basic affinity with the terminal.
- The GPG command line tools installed on your system. Download them at GnuPG if necessary.
Generate the GPG key
- Open a terminal.
- To generate a new key run
gpg --full-generate-key
(see docs). This will prompt you for every available option. - Specify the kind of key you want, or press
Enter
to accept the default. - Specify the key size you want, or press
Enter
to accept the default. - Enter the length of time the key should be valid. Press
Enter
to specify the default selection, indicating that the key doesn’t expire. - Double-check everything you’ve entered is correct.
- Enter your user ID information as prompted by the program.
- Type a secure passphrase. You will need this passphrase when using the key later.
Please note: a secure passphrase is not a substitute for keeping your private key safe! Never share your private key with others. - Use
gpg --list-secret-keys
(see docs) to list the long form of the GPG keys for which you have both a public and private key. - From the list of GPG keys, copy the long form of the GPG key ID you’d like to use. In this example, the GPG key ID is
12345678ABCDEFGH
:$ gpg --list-secret-keys --keyid-format=long /Users/beep/.gnupg/secring.gpg ------------------------------------ sec ed25519/12345678ABCDEFGH 2025-05-24 [expires: 2028-05-23] uid BeepBackup <info@beepbackup.com> ssb ed25519/XXXXXXXXXXXXXXXX 2025-05-24
- Now that you’ve generated the key, and found the key id, you can use it to view your public key. Run
gpg --armor --export 12345678ABCDEFGH
to view the public key. - You now see your public key, starting from
-----BEGIN PGP PUBLIC KEY BLOCK-----
and including-----END PGP PUBLIC KEY BLOCK-----
at the end.
Great! Your new key pair is ready for use.
Next Steps
Now that you’ve generated a keypair that can be used to securely encrypt your backups, let’s head over to How To Import Encryption Keys to import your newly created key in BeepBackup.