next up previous contents
Next: Using GPG with Pine Up: I want to use Previous: Setting up GPG for   Contents

Key Management with GPG

You can show your key's fingerprint with this command:
  $ gpg --fingerprint
  /home/username/.gnupg/pubring.gpg
  -------------------------------
  pub  1024D/FFF5BD5A 1999-09-28 John Q. Smith <smith@company.com>
       Key fingerprint = ED64 B2F6 98B4 CF31 9887  6159 22AB E836 FFF5 BD5A
  sub  1024g/939A094A 1999-09-28

The long string of numbers and letters above (starting with ED64 and ending with BD5A) is the key's fingerprint. Of course, yours will be different. Although this looks large and intimidating, this is actually a 160-bit number - much smaller than your public key.

In order to submit your public key to a public key server, you first have to produce an ASCII-armored copy of it. You can do that with this command:

  gpg --export -a >key.asc

If you don't put ">key.asc" at the end of the command, the key will be printed to the screen. Either way is fine, as long as you can see the whole thing. It may be larger than your screen, if you are using a 24-line text console.

The public key looks something like this:

  -----BEGIN PGP PUBLIC KEY BLOCK-----
  Version: GnuPG v1.0.0 (GNU/Linux)
  Comment: For info see http://www.gnupg.org

  mQGiBDfw2AgRBACYSo6UUmaRzg5fXfnk5Fote1BuQdWVybsY1Bka6PkbWFuaFT2u
  WsAAeXUhrJ2vYpRxp6VhQcjgtz1RxCSogh+3+LDKlyedif/8kUhtWonLWQathswK
  hfBCeuzlXQ1s6SeQUq3X6EGhyQUacC/jXk4DFM5mgpLp3hzXWfmlUTbItwCgwTCm
  [...]
  iEYEGBECAAYFAjfw2BMACgkQIqvoNv/1vVoNOgCgsJO6nzh3A1nCJkL0f/ZTl7OG
  YOIAoLqJE20o+D68NPf/CktSsed8lLrf
  =xQH9
  -----END PGP PUBLIC KEY BLOCK-----

We've omitted some lines here, for the sake of brevity. This public key actually does exist, but it's being used only for the purposes of writing this document. We don't want you to send messages encrypted with it, since we'll be deleting it when we're done writing this document.

If you follow the instructions on the public key server web page to submit a public key, eventually you will come to a page with a place where you can paste this public key. (You might not be able to do this in Lynx. If you have trouble with the web interface, you can try an e-mail interface.)

If you want to extract someone's public key from the public key server, just follow the instructions on the web page. You can search for his name, or his e-mail address. Eventually, if he has a publically available public key, you will get to a page that has his public key on it, which will look like the example shown above.

Some people may have public keys, but they may not know about the public key servers. In that case, you might be able to find their public key on their home page, if they have one. Or they might be willing to send you their public key by e-mail.

In any case, all you need to do is get this public key in a file, such as key.asc. Then you can import this new public key into your public keyring, with this command:

  $ gpg --import key.asc
  gpg: key A4FE0633: public key imported
  gpg: Total number processed: 1
  gpg:               imported: 1

After this, the key is part of your public keyring, and you can use it to encrypt messages and verify digital signatures from the person who holds the corresponding secret key. You can see it in your public keyring:

  $ gpg --list-keys
  /home/username/.gnupg/pubring.gpg
  -------------------------------
  pub  1024D/FFF5BD5A 1999-09-28 John Q. Smith <smith@company.com>
  sub  1024g/939A094A 1999-09-28

  pub  1024D/A4FE0633 1999-07-30 Greg Wooledge <wooledge@kellnet.com>
  sub  1536g/97392F60 1999-07-30

next up previous contents
Next: Using GPG with Pine Up: I want to use Previous: Setting up GPG for   Contents
Greg Wooledge 2000-10-11