Skip to content

Commit 2df605e

Browse files
committed
Document Signature Subpacket classes
1 parent 303d59f commit 2df605e

25 files changed

+216
-21
lines changed

pg/src/main/java/org/bouncycastle/bcpg/attr/ImageAttribute.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
import org.bouncycastle.bcpg.UserAttributeSubpacketTags;
88

99
/**
10-
* Basic type for a image attribute packet.
10+
* User-Attribute Subpacket used to encode an image, e.g. the user's avatar.
11+
*
12+
* @see <a href="https://datatracker.ietf.org/doc/html/rfc4880#section-5.12.1">
13+
* RFC4880 - Image Attribute Subpacket</a>
14+
* @see <a href="https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-13.html#name-the-image-attribute-subpack">
15+
* C-R - Image Attribute Subpacket</a>
1116
*/
1217
public class ImageAttribute
1318
extends UserAttributeSubpacket

pg/src/main/java/org/bouncycastle/bcpg/sig/EmbeddedSignature.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
import org.bouncycastle.bcpg.SignatureSubpacketTags;
55

66
/**
7-
* Packet embedded signature
7+
* Signature Subpacket for embedding one Signature into another.
8+
* This packet is used e.g. for embedding a primary-key binding signature
9+
* ({@link org.bouncycastle.openpgp.PGPSignature#PRIMARYKEY_BINDING}) into a subkey-binding signature
10+
* ({@link org.bouncycastle.openpgp.PGPSignature#SUBKEY_BINDING}) for a signing-capable subkey.
11+
*
12+
* @see <a href="https://datatracker.ietf.org/doc/html/rfc4880#section-5.2.3.26">
13+
* RFC4880 - Embedded Signature</a>
14+
* @see <a href="https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-13.html#name-embedded-signature">
15+
* C-R: Embedded Signature</a>
816
*/
917
public class EmbeddedSignature
1018
extends SignatureSubpacket

pg/src/main/java/org/bouncycastle/bcpg/sig/Exportable.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
import org.bouncycastle.bcpg.SignatureSubpacketTags;
55

66
/**
7-
* packet giving signature creation time.
7+
* Signature Subpacket for marking a signature as exportable or non-exportable.
8+
* Non-exportable signatures are not intended to be published.
9+
*
10+
* @see <a href="https://datatracker.ietf.org/doc/html/rfc4880#section-5.2.3.11">
11+
* Exportable Certification</a>
12+
* @see <a href="https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-13.html#name-exportable-certification">
13+
* C-R - Exportable Certification</a>
814
*/
915
public class Exportable
1016
extends SignatureSubpacket

pg/src/main/java/org/bouncycastle/bcpg/sig/Features.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
import org.bouncycastle.bcpg.SignatureSubpacket;
44
import org.bouncycastle.bcpg.SignatureSubpacketTags;
55

6+
/**
7+
* Signature Subpacket encoding, which features are supported by the key-holders implementation.
8+
*
9+
* @see <a href="https://datatracker.ietf.org/doc/html/rfc4880#section-5.2.3.24">
10+
* RFC4880 - Features</a>
11+
* @see <a href="https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-13.html#name-features">
12+
* C-R - Features</a>
13+
*/
614
public class Features
715
extends SignatureSubpacket
816
{

pg/src/main/java/org/bouncycastle/bcpg/sig/IntendedRecipientFingerprint.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
import org.bouncycastle.util.Arrays;
66

77
/**
8-
* packet giving the intended recipient fingerprint.
8+
* Signature Subpacket containing the fingerprint of the intended recipients primary key.
9+
* This packet can be used to prevent malicious forwarding/replay attacks.
10+
*
11+
* @see <a href="https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-13.html#name-intended-recipient-fingerpr">
12+
* C-R - Intended Recipient Fingerprint</a>
913
*/
1014
public class IntendedRecipientFingerprint
1115
extends SignatureSubpacket

pg/src/main/java/org/bouncycastle/bcpg/sig/IssuerFingerprint.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
import org.bouncycastle.util.Arrays;
88

99
/**
10-
* packet giving the issuer key fingerprint.
10+
* Signature Subpacket containing the fingerprint of the issuers signing (sub-) key.
11+
* This packet supersedes the {@link IssuerKeyID} subpacket.
12+
*
13+
* @see <a href="https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-13.html#name-issuer-fingerprint">
14+
* C-R - Issuer Fingerprint</a>
1115
*/
1216
public class IssuerFingerprint
1317
extends SignatureSubpacket

pg/src/main/java/org/bouncycastle/bcpg/sig/IssuerKeyID.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
import org.bouncycastle.bcpg.SignatureSubpacketTags;
66

77
/**
8-
* packet giving the issuer key ID.
8+
* Signature Subpacket containing the key-id of the issuers signing (sub-) key.
9+
* If the version of that key is greater than 4, this subpacket MUST NOT be included in the signature.
10+
* For these keys, consider the {@link IssuerFingerprint} subpacket instead.
11+
*
12+
* @see <a href="https://datatracker.ietf.org/doc/html/rfc4880#section-5.2.3.5">
13+
* RFC4880 - Issuer</a>
14+
* @see <a href="https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-13.html#name-issuer-key-id">
15+
* C-R - Issuer Key ID</a>
916
*/
1017
public class IssuerKeyID
1118
extends SignatureSubpacket

pg/src/main/java/org/bouncycastle/bcpg/sig/KeyExpirationTime.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
import org.bouncycastle.bcpg.SignatureSubpacketTags;
55

66
/**
7-
* packet giving time after creation at which the key expires.
7+
* Signature Subpacket containing the number of seconds after the key's creation date, after which the key expires.
8+
* The special value of {@code 0} means that the key never expires.
9+
*
10+
* @see <a href="https://datatracker.ietf.org/doc/html/rfc4880#section-5.2.3.6">
11+
* RFC4880 - Key Expiration Time</a>
12+
* @see <a href="https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-13.html#name-key-expiration-time">
13+
* C-R - Key Expiration Time</a>
814
*/
915
public class KeyExpirationTime
1016
extends SignatureSubpacket

pg/src/main/java/org/bouncycastle/bcpg/sig/KeyFlags.java

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,50 @@
44
import org.bouncycastle.bcpg.SignatureSubpacketTags;
55

66
/**
7-
* Packet holding the key flag values.
7+
* Signature Subpacket encoding the capabilities / intended uses of a key.
8+
*
9+
* @see <a href="https://datatracker.ietf.org/doc/html/rfc4880#section-5.2.3.21">
10+
* RFC4880 - Key Flags</a>
11+
* @see <a href="https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-13.html#name-key-flags">
12+
* C-R - Key Flags</a>
813
*/
914
public class KeyFlags
1015
extends SignatureSubpacket
1116
{
17+
/**
18+
* This key may be used to make User ID certifications (signature type IDs 0x10-0x13)
19+
* or direct key signatures (signature type ID 0x1F) over other peoples keys.
20+
*/
1221
public static final int CERTIFY_OTHER = 0x01;
22+
23+
/**
24+
* This key may be used to sign data.
25+
*/
1326
public static final int SIGN_DATA = 0x02;
27+
28+
/**
29+
* This key may be used to encrypt communications.
30+
*/
1431
public static final int ENCRYPT_COMMS = 0x04;
32+
33+
/**
34+
* This key may be used to encrypt storage.
35+
*/
1536
public static final int ENCRYPT_STORAGE = 0x08;
37+
38+
/**
39+
* The private component of this key may have been split by a secret-sharing mechanism.
40+
*/
1641
public static final int SPLIT = 0x10;
42+
43+
/**
44+
* This key may be used for authentication.
45+
*/
1746
public static final int AUTHENTICATION = 0x20;
47+
48+
/**
49+
* The private component of this key may be in the possession of more than one person.
50+
*/
1851
public static final int SHARED = 0x80;
1952

2053
private static byte[] intToByteArray(

pg/src/main/java/org/bouncycastle/bcpg/sig/NotationData.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77
import org.bouncycastle.util.Strings;
88

99
/**
10-
* Class provided a NotationData object according to
11-
* RFC2440, Chapter 5.2.3.15. Notation Data
10+
* Signature Subpacket encoding custom notations.
11+
* Notations are key-value pairs.
12+
*
13+
* @see <a href="https://datatracker.ietf.org/doc/html/rfc4880#section-5.2.3.16">
14+
* RFC4880 - Notation Data</a>
15+
* @see <a href="https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-13.html#name-notation-data">
16+
* C-R - Notation Data</a>
1217
*/
1318
public class NotationData
1419
extends SignatureSubpacket

0 commit comments

Comments
 (0)