GPG keys on Mac OS

GPG keys are used to encrypt information. How to generate them and how to use them on Mac OS.

How keys work

In order to encrypt something, you need to transfer / enter the public key. Later, to decrypt this information, you must enter your private key.

Generating keys

If the keys have never been created before, then we will generate them.

In the terminal, enter the command:

We fill in the Name, Surname, our mail, enter the password (you should remember it, you will need it later, for example, to export keys).

View Keys

Keys will be created in the user’s directory:

You can view your keys like this:

gpg –list-keys
gpg –list-secret-keys
gpg –list-public-keys

Exporting keys

Public key

We look at the list of public keys:

There may be several keys in there. We find the one issued for us.

Next, we need a string of random caps, this is our ID.

We enter these characters into the command below (instead of ID):

gpg –armor –export ID> my-pubkey.asc

We open the created file and see the first line there:

—– BEGIN PGP PUBLIC KEY BLOCK —–

The entire content of the file is the key, including the inscription.

Private key

We do the same for the private key:

gpg –list-secret-keys
gpg –export-secret-keys ID> my-private-key.asc

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *