Cryptography with OpenPGP - Apache Infrastructure Website
Cryptography with OpenPGP
Contents
Introduction
Gnu Privacy Guard
How to generate a strong key
Private keyring management
How to...
find a key ID
back up keys
export a key
transfer a secret key
transition from an old to a new key
use revocation certificates
use symmetric encryption
update Apache documents with details of a new key
use the Web of Trust
Introduction
OpenPGP
is encryption software. The program provides cryptographic privacy and authentication for data communication, covering signing, encrypting, and decrypting texts, e-mails, files, directories, and whole disk partitions and increasing the security of e-mail communications.
Reliable cryptography applications follow OpenPGP, an open standard of Pretty Good Privacy (PGP) encryption software, standard (RFC 4880), for encrypting and decrypting data.
Gnu Privacy Guard (GPG)
The Apaches Software Foundation recommends using
Gnu Privacy Guard (GPG)
, a well-known open source cryptography tool with OpenPGP support. Always use the latest version.
GnuPG has a good set of
documentation
. This guide covers only some important points.
GnuPG Home
GnuPG stores important files, including keyrings and configuration files, in a home directory. You can specify your project's home directory in an environmental variable or on the command line. This allows different configurations and keys to be used.
For example:
$ gpg --homedir /home/alice/keys --list-keys
Projects generally rely on the default. For
\*nux
(linux, BSD, MacOSX, Solaris, AIX) this is:
$HOME/.gnupg
How to switch Home
You can set Home using an environmental variable. This lets you select a specific configuration and keyring for the duration of a
command line session. This is useful when
practicing
and when using multiple keyrings.
For example, to set home directory to
alice
when using Linux:
$ export GNUPGHOME=alice
When switching key rings, check that the required keyring has been selected by examining the secret keys. For example:
$ gpg --list-secret-keys
alice/secring.gpg
-----------------
sec 4096R/E2B054B8 2009-08-20
uid Alice Example (EXAMPLE NEW KEY)
ssb 4096R/4A6D5217 2009-08-20
Configuration
GnuPG supports a wide range of configuration options. You can specify them on the command line, but it is usually more convenient to set them in the
gpg.conf
file. By default, this is located in the
GnuPG Home
directory.
Avoid SHA-1
Avoid
using
SHA-1
. Use
SHA512
or
SHA256
instead.
SHA512
is stronger than
SHA256
. Though some old
clients lack
SHA512
support, we recommend switching to
SHA512
if possible.
Setting defaults
To configure
gpg
to avoid SHA-1, edit the options in
gpg.conf
. Options need to be added or given the correct values for:
cert-digest-algo
- the certificate digest used when linking into the
web of trust
personal-digest-preferences
- the digest used for
signing messages
default-preference-list
- the default algorithm preferences for
new keys
(this does not affect existing keys: see next paragraph)
To use
SHA512
(recommended):
personal-digest-preferences SHA512
cert-digest-algo SHA512
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
To use SHA256:
personal-digest-preferences SHA256
cert-digest-algo SHA256
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
Setting preferences for keys
The digest preferences for each key (from the
configuration defaults
) are set when the key is generated. Once the
configuration has been updated to avoid SHA-1, all new keys generated will use these defaults, but keys generated before the configuration won't be affected.
All existing private keys in the ring need to be updated to indicate that stronger hashes are preferred. For each public-private key pair (generated with the previous defaults):
$ gpg --edit-key F8B7B4FD
gpg (GnuPG) 1.4.9; Copyright (C) 2008 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.
pub 1024D/F8B7B4FD created: 2009-08-12 expires: 2009-09-11 usage: SC
trust: ultimate validity: ultimate
sub 1024g/D55BD150 created: 2009-08-12 expires: 2009-09-11 usage: E
[ultimate] (1). Example Key (NOT FOR DISTRIBUTION)
Command> showpref
[ultimate] (1). Example Key (NOT FOR DISTRIBUTION)
Cipher: AES256, AES192, AES, CAST5, 3DES
Digest: SHA1, SHA256, RIPEMD160
Compression: ZLIB, BZIP2, ZIP, Uncompressed
Features: MDC, Keyserver no-modify
Command> setpref SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
Set preference list to:
Cipher: AES256, AES192, AES, CAST5, 3DES
Digest: SHA512, SHA384, SHA256, SHA224, SHA1
Compression: ZLIB, BZIP2, ZIP, Uncompressed
Features: MDC, Keyserver no-modify
Really update the preferences? (y/N) y
You need a passphrase to unlock the secret key for
user: "Example Key (NOT FOR DISTRIBUTION)
1024-bit DSA key, ID F8B7B4FD, created 2009-08-12
pub 1024D/F8B7B4FD created: 2009-08-12 expires: 2009-09-11 usage: SC
trust: ultimate validity: ultimate
sub 1024g/D55BD150 created: 2009-08-12 expires: 2009-09-11 usage: E
[ultimate] (1). Example Key (NOT FOR DISTRIBUTION)
Command> save
Then upload the modified public key to a public keyserver. For example:
$ gpg --send-keys F8B7B4FD
How to generate a strong key
The weaknesses found in
SHA-1
threaten all DSA keys and those RSA keys with length less than 2048 bits. Though no realistic attack against those keys have been made public and these keys continue to be useful (and do not need to be revoked), Projects should not generate new keys that are exposed to this weakness.
The next generation of
OpenPGP
will use
SHA-3
. For now, the 2048 bit RSA keys with SHA256 hash should be strong enough. For those with 2048 bit RSA keys, the best advice is to
switch
to SHA256 or SHA512 as soon as possible. All new keys generated should be RSA with at least 4096 bits.
Though 8192 bit keys are stronger, they are slower and may be incompatible with some older clients. For the present, 4096 bit RSA should be strong enough for code signing at Apache. To generate RSA keys with length more
than 4096 bits,
changes are needed
. Then you can follow the procedure for 4096 bits.
Install and configure GnuPG
GnuPG
comes in two flavors. To easily generate a 4096 bit RSA signing and encryption key pair with strong digests, use either GnuPG version:
2.0.12
or higher (well-known, portable version)
1.4.10
or higher (version with advanced features)
Once you generate the key, you can use it with the widely available
1.4.9
and
2.x
releases.
If the right version of GnuPG is not currently distributed for your platform, you need to
install it
. You only need this version to generate keys, so you do not need to replace the version distributed with your platform. You can install the new version into a working directory.
Checking that the installation has worked and that the version is correct, using either
$ gpg --version
gpg (GnuPG) 1.4.10
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA
Cipher: 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128,
CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
or
$ gpg2 --version
gpg (GnuPG) 2.0.12
libgcrypt 1.4.4
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA
Cipher: 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128,
CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
Now confirm that the configuration file is
set up to avoid SHA-1
Generate a new key
Versions
2.0.12
and
1.4.10
introduced a new default key generation option -
RSA and RSA
RSA
keys are used for both encryption and signing. Longer key lengths are available. Select or accept this option when generating new keys.
Follow the recommendations about
user ID
and
comment
. Use a strong
passphrase
Follow either
$ gpg --gen-key
gpg (GnuPG) 1.4.10; Copyright (C) 2008 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 4096
Requested keysize is 4096 bits
Please specify how long the key should be valid.
0 = key does not expire
Key is valid for? (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)
Real name: Robert Burrell Donkin
Email address: rdonkin@apache.org
Comment: CODE SIGNING KEY
You selected this USER-ID:
"Robert Burrell Donkin (CODE SIGNING KEY)
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.
or
$ gpg2 --full-gen-key
gpg (GnuPG) 2.0.12; Copyright (C) 2009 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 4096
Requested keysize is 4096 bits
Please specify how long the key should be valid.
0 = key does not expire
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y
GnuPG needs to construct a user ID to identify your key.
Real name: Robert Burrell Donkin
Email address: rdonkin@apache.org
Comment: CODE SIGNING KEY
You selected this USER-ID:
"Robert Burrell Donkin (CODE SIGNING KEY)
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.
Check that the key avoids using SHA-1
Check that the configuration has correctly set the key preferences to avoid SHA-1, using either:
$ gpg --edit-key 773447FD
gpg (GnuPG) 1.4.10; Copyright (C) 2008 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Secret key is available.
pub 4096R/773447FD created: 2010-02-16 expires: never usage: SC
trust: ultimate validity: ultimate
sub 4096R/436E0F7C created: 2010-02-16 expires: never usage: E
[ultimate] (1). Robert Burrell Donkin (CODE SIGNING KEY)
Command> showpref
[ultimate] (1). Robert Burrell Donkin (CODE SIGNING KEY)
Cipher: AES256, AES192, AES, CAST5, 3DES
Digest: SHA512, SHA384, SHA256, SHA224, SHA1
Compression: ZLIB, BZIP2, ZIP, Uncompressed
Features: MDC, Keyserver no-modify
or
$ gpg2 --edit-key A6EE6908
gpg (GnuPG) 2.0.12; Copyright (C) 2009 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Secret key is available.
pub 8192R/A6EE6908 created: 2009-08-07 expires: never usage: SC
trust: ultimate validity: ultimate
sub 8192R/B800EFC1 created: 2009-08-07 expires: never usage: E
[ultimate] (1). Robert Burrell Donkin (CODE SIGNING KEY)
Command> showpref
[ultimate] (1). Robert Burrell Donkin (CODE SIGNING KEY)
Cipher: AES256, AES192, AES, CAST5, 3DES
Digest: SHA512, SHA384, SHA256, SHA224, SHA1
Compression: ZLIB, BZIP2, ZIP, Uncompressed
Features: MDC, Keyserver no-modify
The
Digest
line should list SHA-512 first and SHA-1 last. Instructions for altering the preferences of a key are
here
Final steps
When you generate a new code signing key, you need to update a number of Apache documents and perform some other tasks.
Final transition steps
If you are generating a key for use in a
transition
, there is more you should do before updating these documents, so
go to the transition instructions now
New key final steps
Final steps for a new key
If this is a new code signing key not involved with a transition:
Upload
the new
public key
to a public
keyserver
Create backups by following these
instructions
Follow these
instructions
to create and securely store generic
revocation
certificates
for the new key
Follow these
instructions
(ignoring the transition option) to create or update Apache documents
Read this
guide
to the Apache use of the
web of trust
and make arrangements for your
new key to be included at the earliest opportunity.
Private keyring management
Never transmit your private keyring over the internet!
Store your keys on unshared local disk storage. If your employer only provides networked storage, ask for permission to use a USB fob (or CD) to store your .gnupg directory.
Destroy your retired disks appropriately using a disk wiping utility or similar tools to ensure your keyring is no longer available
on those disks once you are through with them. Failing that, drill through the disk platters so they are physically unusable.
Finding a key ID
There are a number of ways to identify a key. Only one is unique: the
key fingerprint
Attackers can easily create new keys similar to yours with identical user IDs and comments. Such a public key may be introduced to your keyring when you download keys from a
public keyserver
or as part of an import. If this information is used to identify public keys then you may be misled into believing that another public key is yours. A cunning attacker may even introduce a matching secret key that lets you sign with that key.
Creating a different key with a matching identity is considered
infeasible
. For all operations where
precise identity matters and that identity is specified on the command line, you should use the key ID to identify the key. Avoid using
user ID or other information.
Find a key ID from a trusted source
The best way to find a key ID is to obtain it directly from a trusted source, for example, from a business card you obtain personally from the owner of the key.
Find a key ID with its fingerprint
If you have a
fingerprint
, the key ID should be the last 8 digits. For example, the ID of the key with this fingerprint:
FF96 6261 C995 1DDE BF34 5150 D5D2 BDB5 E2B0 54B8
should be:
E2B054B8
You can confirm this using:
$ gpg --list-keys --fingerprint E2B054B8
pub 4096R/E2B054B8 2009-08-20
Key fingerprint = FF96 6261 C995 1DDE BF34 5150 D5D2 BDB5 E2B0 54B8
uid Alice Example (EXAMPLE NEW KEY)
sub 4096R/4A6D5217 2009-08-20
When you have the secret key
When you have the secret key, listing the secret key details allows the key ID to be read from the
sec
lines in the output.
Note
that it is possible for an attacker to introduce a new secret key into your keyring (for example, as part of an import). It is vital that you know how many secret keys each keyring should hold. If any unexpected secret keys are present, this probably indicates an attack.
For example, Alice is
transitioning
and so expects two secret keys in her main keyring. (The case of a single key is similar but less complex.) She lists all secret keys on the keyring:
$ gpg --list-secret-keys
alice/secring.gpg
-----------------
sec 1024D/AD741727 2009-08-20
uid Alice Example (EXAMPLE OF OLD KEY)
ssb 1024g/268883A9 2009-08-20
sec 4096R/E2B054B8 2009-08-20
uid Alice Example (EXAMPLE NEW KEY)
ssb 4096R/4A6D5217 2009-08-20
Alice verifies that details for only two keys are listed and that there are no unexpected additions.
The
sec
lines are:
sec 1024D/AD741727 2009-08-20
and
sec 4096R/E2B054B8 2009-08-20
The key ID forms part of the second column, to the right of the key length. In this case the key IDs are
AD741727
and
E2B054B8
. The
comments
help Alice identify each key.
When you do not have the secret key
Unless you have the
private key
or a
fingerprint
, the only safe way to find the key ID is to ask the owner of the key, using a secure communication channel.
Trusting that an import contains only the owner's public key is
not recommended
. The import may contain additional public keys (intentionally or not). So, when using an import, always verify the key ID of interest from another source.
How to back up keys
Back up public information
The
key ID
is not confidential but without access to this information from a trusted source, substitution attacks are
feasible
(see this
discussion
).
So, for each
key pair
you generate, the
key ID
needs to recorded in a form that makes tampering difficult. Defense in depth is the best strategy. We recommend that you use a range of methods::
Print a hard copy of the key ID and store it securely
Include the key ID on your business cards
ASF Members should include the key ID on their Apache business cards
Include a text document containing the key ID in your
secure, tamperproof private backups
Back up private information
Keep your
private key
both safe and away from attackers. If a private key is destroyed or lost, it must be revoked and should no longer be used. Given the effort that's needed to build a strong
web of trust
, it is important to back up the private key without compromising security.
The best way to back up a private key is to securely archive the entire
GnuPG home
by copying the contents into secure, encrypted storage. We recommended that you version each archived copy and store it permanently.
Full disk encryption is the best storage solution for disks containing the private key. How to encrypt a full disc is platform dependent and is beyond the scope of this guide, but many major platforms now support this.
Choose a strong passphrase. If this is not possible then use strong,
symmetric
encryption to protect a compressed archive.
We recommend a removable medium type with good long term storage characteristics:
A small capacity, high quality USB flash drive
A CDROM
Make and securely store multiple copies.
How to export a key
Exporting public keys is a common operation. It is rarely necessary to export a
private key
and use of that operation should be kept to a minimum (see
below
). So, the unqualified term
exporting a key
almost always means
exporting a public key
GnuPG seeks to limit accidental private key exports by using different operations for each export. Both operations share common options.
Output options
By default, operations print their results to the command line. For example, to export all public keys (with ASCII encoding) to the command line, do:
$ gpg --export --armor
The
--output
option followed by the name of a file creates that file and stores the output in it. To export all public keys (with ASCII encoding) into a newly created file named
export.asc
, use:
$ gpg --export --output export.asc --armor
Though most of the examples in this guide choose to output to a file, command line output is often useful (for example, the output can be piped into a second command) and is equally valid for most operations. The exception is
secret key export
, which should always be to a secure temporary file.
The armor option
The
--armor
option encodes the output using
ASCII characters only
. This permits embedding the output easily in documents and displaying it on the command line.
For example, to export all public keys (to the command line) encoded in ASCII, use:
$ gpg --export --armor
The binary format is shorter but has few other advantages. For all uses at Apache, use ASCII armor.
How to export public keys
The
--export
operation exports public keys.
When you don't specify a key, the system exports all public keys in the keyring. For example, to export all public keys to the
command
line
with
ASCII encoding
$ gpg --export --armor
To export specific keys, add identifiers for these keys to the end of the command. There are a number of ways to identify keys, but only the
key ID
will definitely select a single key. This
guide
discusses how to find the key ID when it is unknown.
For example, to export to the
command line
with
ASCII encoding
the public key with ID
AD741727
, use:
$ gpg --export --armor AD741727
Should I export all or some public keys"
This is often a tricky question. An import should not be trusted for key identification (see
discussion
). So, for an import to be useful, usually the key ID of interest needs to be known.
Keys used at Apache should be available through the global
public keyserver
network. Using this network, given the
key ID
the person who needs it can download the public key.
So an export is really only useful for someone who cannot use the global keyserver network. But in this case, the import really needs to include all the public keys on the ring to maximise the chances of a trusted path being found in the
web of trust
The risk of exporting all keys is that users who don't understand that they should not use an export for key identification may be mislead by the other keys in the export. The risk with exporting just one public key is that users may mistakenly think that imports are trustworthy for key identification.
So neither is a very satisfactory solution. Now that global keyserver network works so well, Apache may move away from the use of exports in the future.
How to export secret keys
This is a risky operation. The most vulnerable part of the system is the
passphrase
that encrypts the private key. If an attacker obtains a copy of the encrypted private key file, an attack on the passphrase is likely to be
feasible
. So it is vital to store the
private key
securely at
all times.
There are very few occasions when this risk is justified. When people talk about exporting keys, this means the export of the
public
key only (unless the secret key is mentioned explicitly). Whenever a private key export is necessary for a task covered in this guide, we describe the process completely in the section. We do not recommend secret key export in other circumstances.
To ensure that you do not accidentally expose private keys, the GnuPG
--export
operation exports only public keys.
Never
export secret keys to the command line. Instead, use a secure temporary file that you can securely delete after use. Here is one way to do this:
How to transfer a secret key
Start by
switching
GnuPG
to the source. To export all secret keys to a temporary file such as
/tmp/new.sec
, do this:
$ gpg --export-secret-keys --armor --output /tmp/new.sec
Import this temporary file into the target keyring. Ensure that GnuPG
is set to the target keyring (by either
switching
the current session or opening a new terminal configured to use the target keyring). Then do this:
$ gpg --import /tmp/new.sec
gpg: key E2B054B8: secret key imported
gpg: key E2B054B8: public key "Alice Example (EXAMPLE NEW KEY)
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
gpg: secret keys read: 1
gpg: secret keys imported: 1
Check for
secret keys imported
in the output. Listing secret keys for the target keyring should now show the existence of the secret key:
$ gpg --list-secret-keys
alice/secring.gpg
-----------------
sec 1024D/AD741727 2009-08-20
uid Alice Example (EXAMPLE OF OLD KEY)
ssb 1024g/268883A9 2009-08-20
sec 4096R/E2B054B8 2009-08-20
uid Alice Example (EXAMPLE NEW KEY)
ssb 4096R/4A6D5217 2009-08-20
Finally make sure that the temporary file you used cannot be read. We recommend secure deletion. If you are working on Linux, for example, you can use the
shred
command:
$ shred /tmp/new.sec
$ rm /tmp/new.sec
Those using encrypted
tmp
should now restart the machine.
How to transition from an old to a new key
If you have a short but uncompromised key and would like to
transition
to a longer one, follow these
instructions
If your key has been compromised, you
must not
transition. Instead,
revoke
the old key and replace it with a new one immediately.
Do not
use a transition period.
How to use revocation certificates
When a private key is lost or compromised, a
revocation certificate
should be
distributed
to
publicly
revoke the key
. In the event of a compromise or loss of the key, it is best to create a new revocation certification including the particulars of the case. Since this may not always be possible, you can
generate
and
securely
store
generic revocation certificates for each new key pair.
Generic revocation certificates
When you create a new
key pair
, also generate and store generic revocation certificates for that key pair. We recommend that you generate a certificate (following the instructions in the next section) for each appropriate
revocation reason type:
No reason specified
Key has been compromised
Key is no longer used
Note that
Key is superseded
is not appropriate for a new key since it is not possible to know which key will replace it.
Store your generic revocation certificates securely until you need to use them. If an attacker obtains a revocation certificate, they will be able to deny your use of the key by publishing it. The private key is not compromised by this act and this limits the harm they can do. However, you will need to generate a new key to replace the one that has been revoked, rebuild the
web of trust
and follow the
Apache revocation process
We recommend that you store these certificates directly onto secure media with good long term stability (for example, an encrypted file
system on a top end USB drive or a CDROM). Print and store hard copies of the certificates yourself, and with trusted third parties.
How to generate a revocation certificate
Revocation certificates include a small amount of additional information"
One of four machine readable reason types:
No reason specified -
a catch-all category
Key has been compromised -
also use this if you believe that the key may have been compromised (for example, when a storage device containing the private key has been lost)
Key is superseded -
the comment should suggest the replacement key
Key is no longer used -
useful when the key has been destroyed and so a generic revocation prepared earlier must be used
The certificate also includes a human-readable
comment
. Explain here the reason why you are revoking the key. This lets those affected by the revocation to formulate an appropriate response.
When a key has been compromised, lost or superseded, when possible generate a new certificate containing a comment explaining the
situation. For example, generate an
ASCII armored
(for
ease of handling) revocation certificate for key
AD741727
like this:
$ gpg --output revoke-AD741727.asc --armor --gen-revoke AD741727
sec 1024D/AD741727 2009-08-20 Alice Example (EXAMPLE OF OLD KEY)
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? 1
Enter an optional description; end it with an empty line:
> THIS IS AN EXAMPLE MESSAGE DESCRIBING THAT THIS KEY WAS COMPROMISED
Reason for revocation: Key has been compromised
THIS IS AN EXAMPLE MESSAGE DESCRIBING THAT THIS KEY WAS COMPROMISED
Is this okay? (y/N) y
You need a passphrase to unlock the secret key for
user: "Alice Example (EXAMPLE OF OLD KEY)
1024-bit DSA key, ID AD741727, created 2009-08-20
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!
When preparing generic certificates (for use if the
private key
is unavailable), the comment
cannot include the specifics and so should indicate this.
The process for generating a generic certificate is identical, but you should add a different comment. For example, generate an
ASCII armored
(for ease of handling) revocation certificate for key
AD741727
like this:
$ gpg --output revoke-AD741727.asc --armor --gen-revoke AD741727
sec 1024D/AD741727 2009-08-20 Alice Example (EXAMPLE OF OLD KEY)
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? 1
Enter an optional description; end it with an empty line:
> This revocation certificate was generate when the key was created.
Reason for revocation: Key has been compromised
This revocation certificate was generate when the key was created.
Is this okay? (y/N) y
You need a passphrase to unlock the secret key for
user: "Alice Example (EXAMPLE OF OLD KEY)
1024-bit DSA key, ID AD741727, created 2009-08-20
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!
How to use symmetric encryption
GnuPG supports symmetric (in addition to public key) cryptography, but the ciphers available sometimes differ. Use
gpg --version
to discover which ciphers are available in the current installation:
$ gpg --version
gpg (GnuPG) 1.4.9
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: alice
Supported algorithms:
Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA
Cipher: 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
In this case, the available ciphers are:
3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH
Note that most of the ciphers early on the list are weak. This is typical. We recommend that you specify a strong cipher on the command
line. For example, to encrypt a document
INPUT_FILENAME
using
AES256
(a strong cipher) and output it to file
ENCRYPTED_FILE
$ gpg --cipher-algo AES256 --output ENCRYPTED_FILE --symmetric INPUT_FILENAME
When prompted for a
passphrase
, choose a strong one.
The file format contains metadata, including the cipher used. So to decrypt
ENCRYPTED_FILE
into
OUTPUT_FILE
use:
$ gpg --output OUTPUT_FILE --decrypt ENCRYPTED_FILE
How to update Apache documents with details of a new key
For the new key, you will need to provide both the
fingerprint
and the
public key
export more than once. We repeat the creation instructions below for each case but you may find it more convenient to create, store then reuse the results.
Publish the new public key
Note
: you must
upload signing keys to a public key server
. You must also add them to your LDAP record using the Apache
self-service app
A reliable, permanent URL for your new public key is useful. Your Apache web space is an ideal location for this. Copy an
ASCII armored
public key
export
(see instructions later, or use documents you created earlier) into the
public_html
subdirectory of your home on
home.apache.org
The suffix
.asc
is conventional for ASCII armored public key exports. So, for example,
A6EE6908.asc
is a reasonable choice for the export of key
A6EE6908
. Record the URL (for example
) for use later in your
FOAF
If your Apache home page contains details of your keys (recommended), update the
fingerprints
and the
ASCII armored
public key
export
. Any browser with a suitable
OpenPGP
plugin (for example,
Firefox
with the
FireGPG plugin
) will let you download the key into the local keyring.
For example,
this home page contains a section with fingerprints and a for exporting them. At the bottom, the export has been inlined so browsers with
OpenPGP
support can import the keys.
To create an
ASCII armored
public key
export
When using a
transition
, follow these
instructions
Otherwise this
discussion
describes how to export public keys.
To find the
fingerprint
for a key:
When using a
transition
, follow these
instructions
Otherwise use
gpg --fingerprint
Ensure that each
pubkeyAddress
points to the new export
uploaded into your Apache home web space
When
transitioning
, include one entry for the old and one for the new key. Yu can use the same URL for both since the target should be the
dual export
you
uploadedearlier
. For example, for keys A6EE6908 (new) and B1313DE2 (old):
Update keys on the next release
Projects maintain
KEYS
files containing the public keys used to sign Apache releases. These documents need not be updated immediately, but you
must
update your project's file with the new key, with an export, before publishing a release using the new key.
To create an
ASCII armored
export
When using a
transition
, follow these
instructions
Otherwise this
discussion
describes how to export public keys
If there is an older export in the
KEYS
file, only remove it if it has not been used to sign a release. It is important
that the KEYS file can also be used to check archived releases.
ASF Members only: update details
ASF Members
should add the new key to their details stored in Subversion.
Update your Apache business card with fingerprints (see
Cards
directory in the members area in Subversion) and place a new order for cards.
How to use the Web of Trust
A link to a new key from a
web of trust
is made when a key that is part of that network signs the new key.
Each link is only one way. By signing a key, you indicate that you have verified the identity of the owner of that key. Links are established in both directions once the owner of that key also signs your key. When the owner has suitable identification, expect the owner to ask you to sign their key in return.
You can use directional links to establish trust in the identity of a key whose owner you haven't met.
How to verify identity
Verifying identities is usually automated, but here is an example to explain the process. If you already understand the process, feel free to
skip forward
Example - the hard way
Take Alice, Bob and Charlie. Alice has verified Bob's identity in person. Bob has verified Charlie's identity in person. But Alice has
never met Charlie. So
Bob's key has been signed by Alice's key
Charlie's key has been signed by Bob's key
Alice has obtained a file (
document
in this example) which Charlie may have created, and a detached signature for that file (
document.asc
in this example). Alice wishes to discover whether Charlie signed this file.
The basic idea is easy. If Alice has verified Bob's identity and trusts Bob to verify the Charlie's identity before signing, then Alice should be able to work out whether Charlie owns the key which was used to sign the file.
Alice starts by verifying the signature:
$ gpg --verify document.asc
gpg: Signature made Wed Sep 9 14:33:12 2009 BST using RSA key ID 8F8A2525
gpg: Can't check signature: public key not found
This indicates that the key used to create this signature is missing from Alice's keyring. This is not unexpected. Alice adds the public key, perhaps by using a public key server or by importing an export, and tries again:
$ gpg --verify document.asc
gpg: Signature made Wed Sep 9 14:33:12 2009 BST using RSA key ID 8F8A2525
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
gpg: Good signature from "Charlie (EXAMPLE ONLY NOT FOR DISTRIBUTION)
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the
owner.
Primary key fingerprint: B7F6 17FA 4DEF E61F 37A4 7463 41F4 40D4 8F8A 2525
This output indicates that this key says that Charlie created it. This is a reasonable start but is easily faked.
Alice examines the signatures on this key:
$ gpg --list-sigs 8F8A2525
pub 2048R/8F8A2525 2009-09-09
uid Charlie (EXAMPLE ONLY NOT FOR DISTRIBUTION)
sig 3 8F8A2525 2009-09-09 Charlie (EXAMPLE ONLY NOT FOR DISTRIBUTION)
This key is signed only by itself. This is not indicative. Unless all keys in the ring have been refreshed, it is possible that a signature has been made but is missing from the ring. Alice refreshes the keys on the ring then verifies once more:
$ gpg --list-sigs 8F8A2525
pub 2048R/8F8A2525 2009-09-09
uid Charlie (EXAMPLE ONLY NOT FOR DISTRIBUTION)
sig 3 8F8A2525 2009-09-09 Charlie (EXAMPLE ONLY NOT FOR DISTRIBUTION)
sig 1B912854 2009-09-09 Bob___ (EXAMPLE ONLY NOT FOR DISTRIBUTION)
The key now has a signature from Bob's key - or so says the key. But Alice has met Bob. So, she lists the signatures for that key that may - or may not - be owned by Bob:
$ gpg --list-sigs 1B912854
pub 2048R/1B912854 2009-09-09
uid Bob___ (EXAMPLE ONLY NOT FOR DISTRIBUTION)
sig 3 1B912854 2009-09-09 Bob___ (EXAMPLE ONLY NOT FOR DISTRIBUTION)
sig 81590910 2009-09-09 Alice (EXAMPLE ONLY NOT FOR DISTRIBUTION)
Alice finds it signed by
81590910
- the master key for this keyring. Alice can therefore trust that Charlie has signed the file provided so long as Alice trusts Bob to verify Charlie's identity.
Automated trust
Most clients allow automation of this process of transitive trust resolution. This is easier and more convenient than by hand but clients differ in the amount of human control they provide. Some clients (including GnuPG) are highly configurable (allowing different trust models to be used) and allow finely grained control over trust placed in each signed key. For more details see
The GNU Privacy HandbookCode signing keys and the Web of Trust
It is vital that Apache code signing keys are linked into a strong
web of trust
. This allows independent verification of the fidelity of Apache releases by anyone strongly linked to this web. In particular, this lets two important groups independently verify releases:
The Apache Infrastructure Team
Downstream packagers
The Apache web of trust is reasonably well connected to the wider-open source web of trust. Though every opportunity should be taken to link into wider networks, the most important action needs to be to plan to exchange signatures with other Apache committers.
How to link into the Apache Web of Trust
The process (explained below) is the same but the people are different: this means arranging to meet in person with Apache committers. For a global distributed organisation like Apache, this is not always easy and usually takes some planning.
Keysigning at ApacheCon
Apache organizes a major
keysigning party
at every
ApacheCon
. This is a great opportunity to collect dozens of signatures.
Keysigning at other Apache events
Other Apache events may also hold keysigning parties (and most will if asked). Typically, these will be smaller and less informal.
Informal Apache meetings
Smaller, informal Apache-sponsored meetings are also an opportunity to swap keys (as well as gossip) with other committers.
Subscribe to the party list (see committer documentation) to find out about informal meetings. When you travel, take advantage of this opportunity to meet up with other Apache committers by posting to the party list. The
Same domain →
Similar titles →