Next: Advanced certificate verification, Previous: X.509 certificates, Up: Certificate authentication [Contents][Index]
The OpenPGP key authentication relies on a distributed trust model, called the “web of trust”. The “web of trust” uses a decentralized system of trusted introducers, which are the same as a CA. OpenPGP allows anyone to sign anyone else’s public key. When Alice signs Bob’s key, she is introducing Bob’s key to anyone who trusts Alice. If someone trusts Alice to introduce keys, then Alice is a trusted introducer in the mind of that observer. For example in Figure 4.4, David trusts Alice to be an introducer and Alice signed Bob’s key thus Dave trusts Bob’s key to be the real one.
There are some key points that are important in that model. In the example Alice has to sign Bob’s key, only if she is sure that the key belongs to Bob. Otherwise she may also make Dave falsely believe that this is Bob’s key. Dave has also the responsibility to know who to trust. This model is similar to real life relations.
Just see how Charlie behaves in the previous example. Although he has signed Bob’s key - because he knows, somehow, that it belongs to Bob - he does not trust Bob to be an introducer. Charlie decided to trust only Kevin, for some reason. A reason could be that Bob is lazy enough, and signs other people’s keys without being sure that they belong to the actual owner.
Field | Description |
---|---|
version | The field that indicates the version of the OpenPGP structure. |
user ID | An RFC 2822 string that identifies the owner of the key. There may be multiple user identifiers in a key. |
public key | The main public key of the certificate. |
expiration | The expiration time of the main public key. |
public subkey | An additional public key of the certificate. There may be multiple subkeys in a certificate. |
public subkey expiration | The expiration time of the subkey. |
In GnuTLS the OpenPGP certificate structures
[RFC2440] are handled using the gnutls_openpgp_crt_t
type.
A typical certificate contains the user ID, which is an RFC 2822
mail and name address, a public key, possibly a number of additional
public keys (called subkeys), and a number of signatures. The various
fields are shown in Table 4.5.
The additional subkeys may provide key for various different purposes, e.g. one key to encrypt mail, and another to sign a TLS key exchange. Each subkey is identified by a unique key ID. The keys that are to be used in a TLS key exchange that requires signatures are called authentication keys in the OpenPGP jargon. The mapping of TLS key exchange methods to public keys is shown in Table 4.6.
Key exchange | Public key requirements |
---|---|
RSA | An RSA public key that allows encryption. |
DHE_RSA | An RSA public key that is marked for authentication. |
ECDHE_RSA | An RSA public key that is marked for authentication. |
DHE_DSS | A DSA public key that is marked for authentication. |
The corresponding private keys are stored in the
gnutls_openpgp_privkey_t
type. All the prototypes for the key
handling functions can be found in gnutls/openpgp.h.
The verification functions of OpenPGP keys, included in GnuTLS, are simple ones, and do not use the features of the “web of trust”. For that reason, if the verification needs are complex, the assistance of external tools like GnuPG and GPGME9 is recommended.
In GnuTLS there is a verification function for OpenPGP certificates, the gnutls_openpgp_crt_verify_ring. This checks an OpenPGP key against a given set of public keys (keyring) and returns the key status. The key verification status is the same as in X.509 certificates, although the meaning and interpretation are different. For example an OpenPGP key may be valid, if the self signature is ok, even if no signers were found. The meaning of verification status flags is the same as in the X.509 certificates (see Figure 4.3).
key: the structure that holds the key.
keyring: holds the keyring to check against
flags: unused (should be 0)
verify: will hold the certificate verification output.
Verify all signatures in the key, using the given set of keys (keyring).
The key verification output will be put in verify
and will be one
or more of the gnutls_certificate_status_t
enumerated elements
bitwise or’d.
Note that this function does not verify using any "web of trust". You may use GnuPG for that purpose, or any other external PGP application.
Returns: GNUTLS_E_SUCCESS
on success, or an error code.
key: the structure that holds the key.
flags: unused (should be 0)
verify: will hold the key verification output.
Verifies the self signature in the key. The key verification
output will be put in verify
and will be one or more of the
gnutls_certificate_status_t enumerated elements bitwise or’d.
Returns: GNUTLS_E_SUCCESS
on success, or an error code.
Similarly with X.509 certificates, one needs to specify the OpenPGP keyring file in the credentials structure. The certificates in this file will be used by gnutls_certificate_verify_peers3 to verify the signatures in the certificate sent by the peer.
c: A certificate credentials structure
file: filename of the keyring.
format: format of keyring.
The function is used to set keyrings that will be used internally by various OpenPGP functions. For example to find a key when it is needed for an operations. The keyring will also be used at the verification functions.
Returns: On success, GNUTLS_E_SUCCESS
(0) is returned, otherwise a
negative error value.
Next: Advanced certificate verification, Previous: X.509 certificates, Up: Certificate authentication [Contents][Index]