Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 763 Bytes

list-gpg-keys.md

File metadata and controls

28 lines (20 loc) · 763 Bytes

List GPG Keys

Category: Security

The steps outlined here are for macOS. Listing keys on Linux should work in a similar manner.

List the long form of the GPG keys for which you have both a public and private key for using the following command:

gpg --list-secret-keys --keyid-format=long

Sample output:

gpg --list-secret-keys --keyid-format=long
/Users/hubot/.gnupg/secring.gpg
------------------------------------
sec   4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10]
uid                          Hubot 
ssb   4096R/42B317FD4BA89E7A 2016-03-10

Print the public key using the GPG key ID you want to use. From the above output, the GPG key ID is 3AA5C34371567BD2:

gpg --armor --export 3AA5C34371567BD2