This article discusses the methods of creating and using PGP keys and the GPG application for the encryption, decryption and signing of data. It is not intended to be a complete in-depth reference just a technical overview or quick reference to PGP/GPG. Most of the keystrokes that a user needs to enter have been highlighted in red. If you need an in depth reference please see the GNU Privacy Guard (GPG) Handbook.
Introduction
Index
OpenPGP Overview
Encryption / Decryption
Digital Signatures
Encrypting, Signing, Sending and Decrypting Data
Using a Public Key to Encrypt Data
Using a Private Key to Sign Data
Using a Public Key to Verify a Signature
Using a Private Key to Decrypt Data
Creating, Exporting and Importing a Public/Private Key Pair
Creating a Key Pair
Exporting a Public Key
Importing a Public Key
Signing a Public Key
Backing Up Keys to a File
Exporting a Private Key
Importing a Private Key
Key Deletion and Revocation
Generating a Revocation Certificate
Importing a Revocation Certificate
Deleting a Key from the Keyring
Acronym Definitions
Links
OpenPGP is the standard of secure data exchange defined in the IETF RFC 4880. Essentially the standard calls for the generation of a pair of keys: one private the other public.
Data can be encrypted under either the public or the private key and then decrypted under the private key. The idea is then that if you wish people to be able to securely transfer data to you then you need to provide them with your public key to encrypt under and when you receive the encrypted data you can decrypt it using your private key. Note that data that has been encrypted under the public key can only be decrypted under the private key.
Message integrity, in other words detection of message alteration, is implicit in the encryption/decryption process. However PGP can also be used to confirm plain text message integrity to a high level too. The sender generates a signature using the RSA or DSA algorithms and the sender’s private key. Then the receiver then uses the sender’s public key to verify the signature against the received document. This goes some way towards verifying the sender too – dependent on the sender not sharing their private key.
Transmitting data securely is a multiple step process, some of which are optional. A complete scenario follows, the signature steps are optional and the transmission of data may be either pick-up or drop-off by either party as per their security and procedure policies. Naturally the key exchange component only needs to happen once or as dictated by your security policy or if a key compromise is detected.
The key exchange:
- The receiver: generates a private / public key pair in their PGP tool.
- The receiver: exports the public key from the receiver’s key store to text.
- The receiver: sends the public key to the sender.
- The sender: signs the receiver’s public key and imports it into the sender’s key store.
- The sender: generates a private / public key pair in their PGP tool.
- The sender: exports the public key from the sender’s key store to text.
- The sender: sends the public key to the receiver.
- The receiver: signs the sender’s public key and imports it into the receiver’s key store.
The data exchange:
- The sender: encrypts the data to be sent with the receiver’s public key.
- The sender: generates a signature against the encrypted data using the sender’s private key.
- The sender: sends both the signature and the encrypted data to the receiver.
- The receiver: verifies the received signature against the received encrypted data using the sender’s public key.
- The receiver: decrypts the received encrypted data using the receiver’s private key.
To use a public key to encrypt data you must first install the key into the tool. Graphical tools such as GPG4Win use a GUI to do this. On Redhat you can do this using the gpg command line tool. It is recommended that when you import the public key that you sign it to say that you have authenticated its integrity. To encrypt a data file using a particular private key you use the following command ‘gpg –out encrypted_secrets –encrypt unencrypted_file‘. Naturally this is a manual process, if you want to include it in an automated script you can use the command like this ‘gpg -e -o $file.pgp -r $gpg_recipient $file‘ obviously from a bash script.
[userx@blackbox ~]$ gpg –out encrypted_secrets –encrypt unencrypted_file
You did not specify a user ID. (you may use “-r”)
Current recipients:
Enter the user ID. End with an empty line: userx@companyx.co.nz
Current recipients:
2048g/5BD870E6 2008-01-09 “userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>”
Enter the user ID. End with an empty line:
[userx@blackbox ~]$ ls
Desktop encrypted_secrets rhn_updates unencrypted_file
[userx@blackbox ~]$
When a sender needs to send encrypted data the sender has the option of signing the encrypted data. Signing the data allows the receiver to confirm that the message was sent by the sender as long as the sender is the only one who has access to the sender’s private key. This is an optional step and may be applied to the raw data before the encryption step or more likely to the encrypted data so that the receiver can verify the integrity of the transmitted data before decrypting it.
[userx@blackbox ~]$ gpg –sign encrypted_secrets
You need a passphrase to unlock the secret key for
user: “Frederick Jones (local key for signing imported keys with among other things) <frederick.jones@acustomer.co.nz>”
1024-bit DSA key, ID C77D9B6F, created 2008-01-08
Enter passphrase: Enter your pass phrase here.
[userx@blackbox ~]$ ls
Desktop encrypted_secrets encrypted_secrets.gpg rhn_updates unencrypted_file
[userx@blackbox ~]$
Once the file has been signed the generated gpg file contains both the file contents and the signature, so you only need to send the gpg file to the recipient. There are many variations on this, for example the signature could be contained in a seperate file, the signature could be in plain text, there are switches to assist you in including this process in scripts, etc. However this is the simplest and most practical way of signing a binary file for transport.
When a receiver receives a signature along with encrypted data the receiver has the option of verifying the signature provided using the sender’s public key. Verification must be against the data that was signed, either the encrypted or the unencrypted data, sometimes for the pedantic, both. But the order must be arranged and shared prior to attempting verification.
[userx@blackbox ~]$ gpg –output secrets –decrypt encrypted_secrets.gpg
gpg: Signature made Sat 10 May 2008 03:47:16 PM NZST using DSA key ID C77D9B6F
gpg: Good signature from “Frederick Jones (local key for signing imported keys with among other things) <frederick.jones@acustomer.co.nz>”
[userx@blackbox ~]$ ls
Desktop encrypted_secrets.gpg rhn_updates secrets tmp
[userx@blackbox ~]$
Decrypting a file is almost as straight forward as encrypting one. You just need the additional passphrase value that was used during the creating of the private key. Naturally the command for decrypting files can also be used in a batch file; an example of which is ‘gpg –batch –no-tty –passphrase-fd 0 -o “$file.txt” -d $file‘. The following illustrates the manual decryption of a file.
[userx@blackbox ~]$ gpg –output secrets –decrypt encrypted_secrets
You need a passphrase to unlock the secret key for
user: “userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>”
2048-bit ELG-E key, ID 5BD870E6, created 2008-01-09 (main key ID F16BE872)
Enter passphrase: Enter your pass phrase here.
gpg: encrypted with 2048-bit ELG-E key, ID 5BD870E6, created 2008-01-09
“userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>”
[userx@blackbox ~]$
Creating a public/private key pair can be achieved using a number of tools. The keys can then be exported, imported and used in different applications as required by you security policy and process. In this section we will use GnuPG on Redhat Linux to create a key pair. You can do all of the following using an unprivileged user account.
To create a private key you need to run ‘gpg –gen-key‘. If the gpg utility has not been used before on the account it may simply create the environment that it needs to run and exit. If so just issue the same command again to start generating the key. The following is a transcript of the process with the user’s keystrokes in red where they show up on the console.
Note that during this run the entropy on the system was not significant so the process halted at one point waiting for the system to get busy again so that it could generate more random data. The best way to do generate entropy is to simply open another session on the system and do something like browse man pages or use the network for something. Basically the random number generation part of the process relies on the random interactions of the system to generate a good standard of random data and make the generated key harder to attack.
Following generation of a new key you should always back it up, generate a revocation certificate and store them according to your security policy.
[userx@blackbox ~]$ gpg –gen-key
gpg (GnuPG) 1.4.5; Copyright (C) 2006 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.
Please select what kind of key you want:
(1) DSA and Elgamal (default)
(2) DSA (sign only)
(5) RSA (sign only)
Your selection? 1
DSA keypair will have 1024 bits.
ELG-E keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 2048
Requested keysize is 2048 bits
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0) 0
Key does not expire at all
Is this correct? (y/N) y
You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
“Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>”
Real name: userx
Email address: userx@companyx.co.nz
Comment: Practice key for testing with, not to be used in production.
You selected this USER-ID:
“userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>”
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.
Enter passphrase: You will not see this pass phrase appear in the console.
Repeat passphrase: You will not see it here either, this is the same phrase as on the last line.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
.++++++++++++++++++++.+++++.++++++++++.+++++..+++++.+++++.+++++++++++++++++++++++++.
+++++++++++++++++++++++++.+++++.++++++++++..+++++.++++++++++.+++++.+++++
Not enough random bytes available. Please do some other work to give
the OS a chance to collect more entropy! (Need 284 more bytes)
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
++++++++++++++++++++.++++++++++..+++++.+++++..+++++..+++++..+++++++++++++++++++++++++++++++++++
..+++++.++++++++++…….++++++++++.+++++++++++++++..+++++.+++++.++++++++++>++++++++++>+++++…
…………………….>+++++…<.+++++……………………………………+++++^^^
gpg: /home/userx/.gnupg/trustdb.gpg: trustdb created
gpg: key F16BE872 marked as ultimately trusted
public and secret key created and signed.
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
pub 1024D/F16BE872 2008-01-09
Key fingerprint = 990C 1FF2 07B9 223D 0B09 60C3 0427 9D7F F16B E872
uid userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
sub 2048g/5BD870E6 2008-01-09
[userx@blackbox ~]$
That’s all that needs to happen to create the private key. It will be stored on the local key ring so if you need to move it to another machine you will need to export the key on this one and import it on the other. A listing of the keys on the key ring can be generated by using the command ‘gpg –list-keys’.
[userx@blackbox ~]$ gpg –list-keys
/home/userx/.gnupg/pubring.gpg
———————————
pub 1024D/F16BE872 2008-01-09
uid userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
sub 2048g/5BD870E6 2008-01-09
[userx@blackbox ~]$
Next we need to generate the public key that you can distribute to the senders to encrypt data with. To create a public key simply use the command ‘gpg –armor –export userx@companyx.co.nz > mc.pk’ to generate a file with the text version of the public key in it. If you don’t redirect the output to a file it will end up on the console and you can cut and paste it from there.
[userx@blackbox ~]$ gpg –armor –export userx@companyx.co.nz
—–BEGIN PGP PUBLIC KEY BLOCK—–
Version: GnuPG v1.4.5 (GNU/Linux)
mQGiBEgjxzsRBADnsVogDhA+9yp67iPpFPO8BBn23UHzqohDuu1JbQipuALydsBf
JfRbwtCiXkQTENjYMUZigLFAt7NvvgSZL/HddQ/4f2uIoBMu5i/gai4PIslQMXTC
z5nKadB/cKemJSmk5Mkz8r28YbWbaqlWAWpWcz74NkvU1jbcdTyPMWSf4wCg59vl
…
Radv1oNxFvxls4vExF0hvNXl5KjM8Cknc/WhQDnDg1i9UX5okd00qPvbyoQpulCL
AZs/NalFv4hJBBgRAgAJBQJII8dCAhsMAAoJEAQnnX/xa+hy2M4An09qaadS2lPI
DYKXIH4yoCiMXiJcAJ9F1ssEm/hb+rE970NljxIkxQQtHQ==
=WJYH
—–END PGP PUBLIC KEY BLOCK—–
[userx@blackbox ~]$
You can import any old public key into your keystore for use. Normally the public key is a simple block of text, as seen above. For this example we have copied the text into a file named ‘mcdc1.pk‘. To import the public key the command is ‘gpg –import-key filename‘. The following shows: a list of the keys in the store before import, the import command, and a listing of the keys in the store following the import command.
[userx@blackbox ~]$ gpg –list-keys
/home/userx/.gnupg/pubring.gpg
———————————
pub 1024D/C77D9B6F 2008-01-08
uid Frederick Jones (local key for signing imported keys with among other things) <frederick.jones@acustomer.co.nz>
sub 2048g/514D3AE9 2008-01-08
[userx@blackbox ~]$ gpg –import mcdc1.pk
gpg: key F16BE872: public key “userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>” imported
gpg: Total number processed: 1
gpg: imported: 1
[userx@blackbox ~]$ gpg –list-keys
/home/userx/.gnupg/pubring.gpg
———————————
pub 1024D/C77D9B6F 2008-01-08
uid Frederick Jones (local key for signing imported keys with among other things) <frederick.jones@acustomer.co.nz>
sub 2048g/514D3AE9 2008-01-08
pub 1024D/F16BE872 2008-01-09
uid userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
sub 2048g/5BD870E6 2008-01-09
[userx@blackbox ~]$
Before using a public key it is advisable to sign it with your own private key. Signing a key adds it to your trusted keys keystore. Essentially it says that the key is to be trusted because you have verified its integrity and authenticity. Then the key can often be used by applications without them having to prompt for confirmation of its authenticity. Signing a key is a little more involved than importing it, but it is still a very straight foward process. Notice that in this example the first attempt at remembering the passphrase failed but the next attempt passed. Also note that there was already a private key against which to sign the public key. The last part is just a key listing for completeness sake.
[userx@blackbox ~]$ gpg –edit-key userx@companyx.co.nz
gpg (GnuPG) 1.4.5; Copyright (C) 2006 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.
pub 1024D/F16BE872 created: 2008-01-09 expires: never usage: SC
trust: unknown validity: unknown
sub 2048g/5BD870E6 created: 2008-01-09 expires: never usage: E
[ unknown] (1). userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
Command> fpr
pub 1024D/F16BE872 2008-01-09 userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
Primary key fingerprint: 990C 1FF2 07B9 223D 0B09 60C3 0427 9D7F F16B E872
Command> sign
pub 1024D/F16BE872 created: 2008-01-09 expires: never usage: SC
trust: unknown validity: unknown
Primary key fingerprint: 990C 1FF2 07B9 223D 0B09 60C3 0427 9D7F F16B E872
userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
Are you sure that you want to sign this key with your
key “Frederick Jones (local key for signing imported keys with among other things) <frederick.jones@acustomer.co.nz>” (C77D9B6F)
Really sign? (y/N) y
You need a passphrase to unlock the secret key for
user: “Frederick Jones (local key for signing imported keys with among other things) <frederick.jones@acustomer.co.nz>”
1024-bit DSA key, ID C77D9B6F, created 2008-01-08
gpg: Invalid passphrase; please try again …
You need a passphrase to unlock the secret key for
user: “Frederick Jones (local key for signing imported keys with among other things) <frederick.jones@acustomer.co.nz>”
1024-bit DSA key, ID C77D9B6F, created 2008-01-08
Command> quit
Save changes? (y/N) y
[userx@blackbox ~]$ gpg –list-keys
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 1 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1 valid: 1 signed: 0 trust: 1-, 0q, 0n, 0m, 0f, 0u
/home/userx/.gnupg/pubring.gpg
———————————
pub 1024D/C77D9B6F 2008-01-08
uid Frederick Jones (local key for signing imported keys with among other things) <frederick.jones@acustomer.co.nz>
sub 2048g/514D3AE9 2008-01-08
pub 1024D/F16BE872 2008-01-09
uid userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
sub 2048g/5BD870E6 2008-01-09
[userx@blackbox ~]$
Backing up keys is a simple export to file process. It then needs to be securely stored somewhere. When it needs to be restored its a simple import operation to get it back in to the keyring. Needless to say the security of the private keys is of utmost importance to preseve the integrity of the cryptographic processes; in other words, store them securely and don’t loose them. Backup and restore of public keys have already been covered in a previous section so they are not covered here.
Exporting a private key to a file is a one line event and results in a UTF-8 text file that should be stored securely then the text file deleted securely from the machine that generated it. The command is ‘gpg –armor –output filename.key –export-secret-keys keyid‘, to get the keyid you can use the command ‘gpg –list-secret-keys‘.
You can additionally encrypt the generated file using a command like
‘gpg –amor –export-secret-keys keyid | gpg –amor –symmetric
–output filename.key‘ and use a passphrase to protect the key. Naturally you will need to supply and keep a secure passphrase for archival purposes. This should all be determined in your security policy. It is possible to additionally sign this file too, but you may end up in a catch-22 loop if you aren’t careful with your trust hierarchy.
[userx@blackbox ~]$ gpg –list-secret-keys
/home/userx/.gnupg/secring.gpg
———————————
sec 1024D/F16BE872 2008-01-09
uid userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
ssb 2048g/5BD870E6 2008-01-09
[userx@blackbox ~]$ gpg –armor –export-secret-keys F16BE872 | gpg –armor –symmetric –output userx-secret.key
Enter passphrase: Put your pass phrase here, don’t forget it!
Repeat passphrase: Repeat your pass phrase here, store it securely for when you want to restore the key!
[userx@blackbox ~]$ ls
Desktop encrypted_secrets.gpg userx-secret.key rhn_updates secrets tmp
[userx@blackbox ~]$ cat userx-secret.key
—–BEGIN PGP MESSAGE—–
Version: GnuPG v1.4.5 (GNU/Linux)
jA0EAwMCDMzqGkiI4nVgyer8LfE22zw9q7hRnR7xNB/RDEUyDtkjChCv3KYEmn/q
6BZuoGSDQA9nC+zaCaJnhbKc8ACsPKg5ymMR3mGOBp1x4N4rbIQsy9iGK6tnw9B6
TnYWCaf2ltrMMCbB9pwnvQdRiFqb7rX/ojppeCuG9/ZjwGXfYesyBIqhZjTrQ+BD
…
BmI+pEF9btI/pP+kDCHt0L0oS25Ph6rltCQuEXKWOPtWtC2Ph2OS/PgUAvZ0IJu6
/UsgUX10vIWJ8GZUerdEJRqO8NKG1DRtzUXV0ibK0lJlpY+begTJllWNfS0zOOWh
hLMlskxgvh47nrI6RenCed3tEynPDS5HkAf0LoiIRP/dWQnhjMg=
=UcOA
—–END PGP MESSAGE—–
[userx@blackbox ~]$
Restoring a key from backup is very straight forward. In this case we will just look at restoring an encrypted key, so you need the backed up file and pass phrase. To restore the key you can use the following command, supplying the pass phrase when asked, ‘gpg –decrypt filename.gpg | gpg –import‘.
[userx@blackbox ~]$ gpg –list-secret-keys
/home/userx/.gnupg/secring.gpg
———————————
sec 1024D/C77D9B6F 2008-01-08
uid Frederick Jones (local key for signing imported keys with among other things) <frederick.jones@acustomer.co.nz>
ssb 2048g/514D3AE9 2008-01-08
[userx@blackbox ~]$ man gpg
[userx@blackbox ~]$ gpg –list-secret-keys
/home/userx/.gnupg/secring.gpg
———————————
sec 1024D/C77D9B6F 2008-01-08
uid Frederick Jones (local key for signing imported keys with among other things) <frederick.jones@acustomer.co.nz>
ssb 2048g/514D3AE9 2008-01-08
[userx@blackbox ~]$ gpg –decrypt userx-private.gpg | gpg –import
gpg: CAST5 encrypted data
Enter passphrase: Enter your passphrase here.
gpg: CAST5 encrypted data
gpg: encrypted with 1 passphrase
gpg: WARNING: message was not integrity protected
gpg: key F16BE872: secret key imported
gpg: key F16BE872: “userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>” not changed
gpg: Total number processed: 1
gpg: unchanged: 1
gpg: secret keys read: 1
gpg: secret keys imported: 1
[userx@blackbox ~]$ gpg –list-secret-keys
/home/userx/.gnupg/secring.gpg
———————————
sec 1024D/C77D9B6F 2008-01-08
uid Frederick Jones (local key for signing imported keys with among other things) <frederick.jones@acustomer.co.nz>
ssb 2048g/514D3AE9 2008-01-08
sec 1024D/F16BE872 2008-01-09
uid userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
ssb 2048g/5BD870E6 2008-01-09
[userx@blackbox ~]$
When your keys become compromised or simply need to be retired or removed there are two options: deletion, and revocation. The difference is that deletion means you can no longer use that certificate on the machine that the key has been removed from, whereas revocation means that the key can still be used for verifying and decrypting previously created artifacts. What is used is determined by your security policy.
Under normal circumstances you should generate a revokation certificate for each new key as you generate the key. As with most other generation operations this is quite simple. To generate a revokation certificate simply use the following command. Note that the generated certificate should be secured in the same way that your private keys are. Note that this example dumps the cert to screen, you need to capture it to file to be useful.
[userx@blackbox ~]$ gpg –list-secret-keys
/home/userx/.gnupg/secring.gpg
———————————
sec 1024D/F16BE872 2008-01-09
uid userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
ssb 2048g/5BD870E6 2008-01-09
[userx@blackbox ~]$ gpg –armor –gen-revoke F16BE872
sec 1024D/F16BE872 2008-01-09 userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
Create a revocation certificate for this key? (y/N) y
Please select the reason for the revocation:
0 = No reason specified
1 = Key has been compromised
2 = Key is superseded
3 = Key is no longer used
Q = Cancel
(Probably you want to select 1 here)
Your decision? 0
Enter an optional description; end it with an empty line:
> Default revoke generated with keys.
>
Reason for revocation: No reason specified
Default revoke generated with keys.
Is this okay? (y/N) y
You need a passphrase to unlock the secret key for
user: “userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>”
1024-bit DSA key, ID F16BE872, created 2008-01-09
Enter passphrase: Enter your pass phrase here.
Revocation certificate created.
Please move it to a medium which you can hide away; if Mallory gets
access to this certificate he can use it to make your key unusable.
It is smart to print this certificate and store it away, just in case
your media become unreadable. But have some caution: The print system of
your machine might store the data and make it available to others!
—–BEGIN PGP PUBLIC KEY BLOCK—–
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: A revocation certificate should follow
iGwEIBECACwFAkgnrnclHQBEZWZhdWx0IHJldm9rZSBnZW5lcmF0ZWQgd2l0aCBr
ZXlzLgAKCRAEJ51/8WvockshAJ9ewkZfGPwGVP5Omf8bzMARxe6DBwCbBAi5ZAsL
9wb0CxITviZbCwJo2TQ=
=QddC
—–END PGP PUBLIC KEY BLOCK—–
[userx@blackbox ~]$
Using a revokation certificate is as simple as importing it into the keyring. Use the following command ‘gpg –import filename‘.
[userx@blackbox ~]$ gpg –list-secret-keys
/home/userx/.gnupg/secring.gpg
———————————
sec 1024D/F16BE872 2008-01-09
uid userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
ssb 2048g/5BD870E6 2008-01-09
[userx@blackbox ~]$ gpg –import revoke.crt
gpg: key F16BE872: “userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>” revocation certificate imported
gpg: Total number processed: 1
gpg: new key revocations: 1
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 1 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1 valid: 1 signed: 0 trust: 1-, 0q, 0n, 0m, 0f, 0u
[userx@blackbox ~]$ gpg –list-secret-keys
/home/userx/.gnupg/secring.gpg
———————————
sec 1024D/F16BE872 2008-01-09
uid userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
ssb 2048g/5BD870E6 2008-01-09
[userx@blackbox ~]$ gpg –edit-key F16BE872
gpg (GnuPG) 1.4.5; Copyright (C) 2006 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.
Secret key is available.
This key was revoked on 2008-01-12 by DSA key F16BE872 userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
pub 1024D/F16BE872 created: 2008-01-09 revoked: 2008-01-12 usage: SC
trust: unknown validity: revoked
This key was revoked on 2008-01-12 by DSA key F16BE872 userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
sub 2048g/5BD870E6 created: 2008-01-09 revoked: 2008-01-12 usage: E
[ revoked] (1). userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
Command> quit
[userx@blackbox ~]$
Some times you need to delete a key. This is very simple, just use the command ‘gpg –delete-secret-key keyid‘ or alternatively ‘gpg –delete-key keyid‘.
[userx@blackbox ~]$ gpg –list-secret-keys
/home/userx/.gnupg/secring.gpg
———————————
sec 1024D/C77D9B6F 2008-01-08
uid Frederick Jones (local key for signing imported keys with among other things) <frederick.jones@acustomer.co.nz>
ssb 2048g/514D3AE9 2008-01-08
sec 1024D/F16BE872 2008-01-09
uid userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
ssb 2048g/5BD870E6 2008-01-09
[userx@blackbox ~]$ gpg –delete-secret-key F16BE872
gpg (GnuPG) 1.4.5; Copyright (C) 2006 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.
sec 1024D/F16BE872 2008-01-09 userx (Practice key for testing with, not to be used in production.) <userx@companyx.co.nz>
Delete this key from the keyring? (y/N) y
This is a secret key! – really delete? (y/N) y
[userx@blackbox ~]$ gpg –list-secret-keys
/home/userx/.gnupg/secring.gpg
———————————
sec 1024D/C77D9B6F 2008-01-08
uid Frederick Jones (local key for signing imported keys with among other things) <frederick.jones@acustomer.co.nz>
ssb 2048g/514D3AE9 2008-01-08
[userx@blackbox ~]$
PGP - Pretty Good Privacy: an application for the encryption and decryption of data.
RSA - Rivest Shamir Adleman algorithm: the first algorithm known to be suitable for signing as well as encryption.
FIPS - Federal Information Processing Standard: publicly announced standards developed by the United States Federal Government.
DSA - Digital Signature Algorithm: a United States Federal Government standard or FIPS for digital signatures.
IETF - Internet Engineering Task Force: open standards organisation working with W3C and ISO/IEC for Internet standards.
OpenPGP aka RFC 4880 - IETF OpenPGP Message Format: latest revision of the PGP standard.
GPG aka GnuPG - GNU Privacy Guard: an RFC 4880 compliant encryption and decryption application that replaces PGP.
GnuPG: Home Page
(http://gnupg.org/)
GPG4Win
(http://www.gpg4win.org/)
GNU_Privacy_Guard: Wikipedia
(http://en.wikipedia.org/wiki/GNU_Privacy_Guard)
GNU Privacy Guard Handbook
(http://www.gnupg.org/gph/en/manual.html)
Pretty Good Privacy: Wikipedia
(http://en.wikipedia.org/wiki/Pretty_Good_Privacy)
GPG/PGP Basics
(http://aplawrence.com/Basics/gpg.html)
Creating and Managing Keys: WLUG
(http://www.wlug.org.nz/GPG/PGPNotes)
Open Skills OpenPGP Tutorial
(http://wiki.openskills.org/OpenSkills/OpenPGP)
Ubuntu GnuPrivacyGuardHowTo
(https://help.ubuntu.com/community/GnuPrivacyGuardHowto)
Email with Mutt and GPG
(http://codesorcery.net/old/mutt/mutt-gnupg-howto)