mirror of
https://codeberg.org/openpgp/notes.git
synced 2025-09-10 11:49:40 +02:00
Start section on subpackets
This commit is contained in:
parent
5f0bb4fc25
commit
4e2fa874c7
1 changed files with 49 additions and 8 deletions
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
# Signatures as "statements"
|
# Signatures as "statements"
|
||||||
|
|
||||||
Signatures make up the magic of OpenPGP. They act as the syntax that allows forming and interpreting complex statements about data and identities. Without signatures there would only be loose keys, impossible to associate with their owner. Signatures are the glue that allows for keys, subkeys and identities to be assembled into hierarchical certificates and for messages to gain authenticity.
|
Signatures make up the magic of OpenPGP.
|
||||||
|
They act as the syntax that allows forming and interpreting complex statements about data and identities.
|
||||||
|
Without signatures there would only be loose keys, impossible to associate with their owner.
|
||||||
|
Signatures are the glue that allows for keys, subkeys and identities to be assembled into hierarchical certificates and for messages to gain authenticity.
|
||||||
|
|
||||||
```
|
```
|
||||||
- Purpose of a signature
|
- Purpose of a signature
|
||||||
|
@ -13,22 +16,60 @@ Signatures make up the magic of OpenPGP. They act as the syntax that allows form
|
||||||
|
|
||||||
## Terminology
|
## Terminology
|
||||||
|
|
||||||
The term *signature* can have multiple meanings in the context of the OpenPGP specification. Cryptographic keys create raw signatures which are byte sequences calculated according to some signature scheme. OpenPGP packs these raw signatures up into OpenPGP signature packets, which carry additional information. For the purpose of this document, the term signature will refer to an OpenPGP signature packet (tag 2).
|
The term *signature* can have multiple meanings in the context of the OpenPGP specification.
|
||||||
|
Cryptographic keys create raw signatures which are byte sequences calculated according to some signature scheme.
|
||||||
|
OpenPGP packs these raw signatures up into OpenPGP signature packets, which carry additional information in the form of signature subpackets.
|
||||||
|
For the purpose of this document, the term signature will refer to an OpenPGP signature packet (tag 2).
|
||||||
|
|
||||||
OpenPGP signatures can be separated into *data signatures* and *certifications*. A data signature serves the purpose to cryptographically guarantee the authenticity (and implicitly also the integrity) of a message, e.g. an email or a file, while a certification is used to attach metadata or subkeys to a certificate. Data signatures are always calculated by keys carrying the **S**igning key flag, while certifications require keys carrying the **C**ertify Others key flag (with the exception of so called Primary Key Binding Signatures). Different types of signatures are distinguished by a signature type code and are calculated in different ways. Signatures can either be distributed standalone as *detached* signatures, or can be inlined with OpenPGP data, such as an OpenPGP message or a key or certificate.
|
OpenPGP signatures can be separated into *data signatures* and *certifications*.
|
||||||
|
A data signature serves the purpose to cryptographically guarantee the authenticity (and implicitly also the integrity) of a message, e.g. an email or a file, while a certification is used to attach metadata or subkeys to a certificate.
|
||||||
|
Data signatures are always calculated by keys carrying the **S**igning key flag, while certifications require keys carrying the **C**ertify Others key flag (with the exception of so called Primary Key Binding Signatures).
|
||||||
|
Different types of signatures are distinguished by a signature type code and are calculated in different ways.
|
||||||
|
Signatures can either be distributed standalone as *detached* signatures, or can be inlined with OpenPGP data, such as an OpenPGP message or a key or certificate.
|
||||||
|
|
||||||
Data signatures (type 0x00 and 0x01) are created by hashing the message content and calculating a cryptographic signature over the hash. The result is packed up into an OpenPGP signature packet, which can either be included in the OpenPGP message (TODO: See section about forming messages, cleartext signature framework), or distributed separately as a so called *detached* signature. Data signatures are always calculated using a **S**igning key.
|
Data signatures (type 0x00 and 0x01) are created by hashing the message content and calculating a cryptographic signature over the hash.
|
||||||
|
The result is packed up into an OpenPGP signature packet, which can either be included in the OpenPGP message (TODO: See section about forming messages, cleartext signature framework), or distributed separately as a so called *detached* signature.
|
||||||
|
Data signatures are always calculated using a **S**igning key.
|
||||||
|
|
||||||
A certification made by a key over components of the same certificate is referred to as a *self-certification*. A typical use-case for a self-certification is to attach a user ID, such as a name and email address to a certificate. This is done by calculating the signature over the user ID and the public primary key. The resulting user ID certification (typically type 0x13, potentially type 0x10-0x12) can then be inserted into the certificate, right after the user ID packet.
|
A certification made by a key over components of the same certificate is referred to as a *self-certification*.
|
||||||
|
A typical use-case for a self-certification is to attach a user ID, such as a name and email address to a certificate.
|
||||||
|
This is done by calculating the signature over the user ID and the public primary key.
|
||||||
|
The resulting user ID certification (typically type 0x13, potentially type 0x10-0x12) can then be inserted into the certificate, right after the user ID packet.
|
||||||
|
|
||||||
Other examples for self-signatures are binding signatures for subkeys. In order to add an OpenPGP subkey to a certificate, a subkey binding signature is calculated over the public primary key, followed by the public subkey. The resulting subkey binding signature (type 0x18) can then be inserted into the certificate right after the subkey. If the subkey itself is intended to be used as a **S**igning key, an extra step is required. To prevent an attacker from being able to "adopt" a victims signing subkey and then being able to claim to be the origin of signatures in fact made by victim, subkey binding signatures for signing subkeys need to include an embedded "back signature" (formally known as primary key binding signature) made by the signing key itself.
|
Other examples for self-signatures are binding signatures for subkeys.
|
||||||
|
In order to add an OpenPGP subkey to a certificate, a subkey binding signature is calculated over the public primary key, followed by the public subkey.
|
||||||
|
The resulting subkey binding signature (type 0x18) can then be inserted into the certificate right after the subkey.
|
||||||
|
If the subkey itself is intended to be used as a **S**igning key, an extra step is required.
|
||||||
|
To prevent an attacker from being able to "adopt" a victims signing subkey and then being able to claim to be the origin of signatures in fact made by victim, subkey binding signatures for signing subkeys need to include an embedded "back signature" (formally known as primary key binding signature) made by the signing key itself.
|
||||||
|
|
||||||
Certifications over user IDs can also be used to certify certificates of third-parties. If Alice is certain that `Bob Baker <bob@example.com>` controls the key 0xB0B, she can create a user ID certification signature for that identity and send it to Bob. Bob can then add this signature to his certificate. TODO: More WoT.
|
Certifications over user IDs can also be used to certify certificates of third-parties.
|
||||||
|
If Alice is certain that `Bob Baker <bob@example.com>` controls the key 0xB0B, she can create a user ID certification signature for that identity and send it to Bob.
|
||||||
|
Bob can then add this signature to his certificate.
|
||||||
|
TODO: More WoT.
|
||||||
|
|
||||||
Another important category of signatures are revocations. A revocation is used to retract the statement formed by a prior signature. A subkey revocation signature revokes a prior subkey binding signature, while a certification revocation revokes a certification signature. Typical use-cases for revocations are marking certificates or individual subkeys as unusable, or marking user IDs as no longer used.
|
Another important category of signatures are revocations.
|
||||||
|
A revocation is used to retract the statement formed by a prior signature.
|
||||||
|
A subkey revocation signature revokes a prior subkey binding signature, while a certification revocation revokes a certification signature.
|
||||||
|
Typical use-cases for revocations are marking certificates or individual subkeys as unusable, or marking user IDs as no longer used.
|
||||||
|
|
||||||
## Signature Subpackets
|
## Signature Subpackets
|
||||||
|
|
||||||
|
A cryptographic signature alone is often not expressive enough to fulfil certain use-cases.
|
||||||
|
For this reason, the OpenPGP protocol introduced signature subpackets with rfc4880.
|
||||||
|
These are well-defined data structures that can be placed as subelements into signature packets, which give additional context and meaning to a signature.
|
||||||
|
Typical examples are the issuer fingerprint subpacket, which contains the fingerprint of the issuer key, or the key flags subpacket which states, what purpose a component key is intended for.
|
||||||
|
|
||||||
|
Signature subpackets can reside in two different areas of a signature packet.
|
||||||
|
Subpackets in the *hashed area* are incorporated in the digest calculation that is done during signature calculation and are therefore covered by the cryptographic signature.
|
||||||
|
Hashed subpackets are *authenticated*.
|
||||||
|
If a subpacket is placed in the *unhashed area* instead, it is not included in the signature calculation procedure.
|
||||||
|
The unhashed area can be used to retroactively add, change or remove subpackets from a signature without invalidating it.
|
||||||
|
|
||||||
|
Due to the fact that the unhashed area doesn't provide any cryptographic guarantees, it is only intended for advisory packets, or packets that self-authenticate (e.g. issuer key ID / issuer fingerprint subpackets, whose "correctness" can be proven by successfully verifying the signature using the referenced issuer key).
|
||||||
|
In most cases, signature subpackets are simply added into the hashed area.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
- Key Flags
|
- Key Flags
|
||||||
- Preferences
|
- Preferences
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue