Class TrustAnchorIDs
java.lang.Object
org.bouncycastle.cert.plants.TrustAnchorIDs
Utilities for constructing and parsing the binary trust anchor IDs reserved
by Section 5.1 of draft-ietf-plants-merkle-tree-certs under each CA ID:
{caID 0 N}— issuance logN(Section 5.2){caID 1 N L}— landmarkLof logN(Section 8.2){caID 2 N L}— landmark group containing landmarkLand earlier (Section 8.2.1)
The binary representation is the base-128 OID-component encoding used inside ASN.1 RELATIVE-OID contents (Section 4 of draft-ietf-tls-trust-anchor-ids); it has no ASN.1 tag or length prefix.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intOID component for the landmark-groups arc (Section 8.2.1).static final intOID component for the landmarks arc (per-landmark IDs, Section 8.2).static final intOID component for the logs arc.static final intMaximum length, in bytes, of a trust anchor ID's binary representation. -
Method Summary
Modifier and TypeMethodDescriptionstatic BigIntegercertSerial(long logNumber, long index) Composes the 64-bit certificate serial number per Section 6.2 of draft-ietf-plants-merkle-tree-certs:static BigIntegercertSerial(MTCLog log, long index) Equivalent tocertSerial(long, long)with the log number taken fromlog.getLogNumber().static byte[]encodeComponent(long value) Encodes a non-negative integer as a single OID component using base-128 with continuation bits, as defined for RELATIVE-OID contents in Section 8.20 of X.690.static byte[]fromDottedDecimal(String dotted) Converts a dotted-decimal trust anchor ID (e.g.static org.bouncycastle.asn1.x500.X500NameissuerName(String caTrustAnchorIdDotted) Builds the issuerX500Namefor a Merkle Tree certificate: a single RDN whoseid-rdna-trustAnchorIDattribute carries the CA's trust anchor ID as a RELATIVE-OID (Section 5.1 of draft-ietf-plants-merkle-tree-certs, which takes the construction from Section 4.1 of draft-ietf-tls-trust-anchor-ids).static byte[]landmarkGroupId(byte[] caId, long logNumber, long landmarkNumber) Builds the binary trust anchor ID of a landmark group,{caID landmarkGroups(2) N L}(Section 8.2.1): the group of the CA ID itself, selecting standalone certificates, and the landmarks 0 toLof logN.static byte[]landmarkId(byte[] caId, long logNumber, long landmarkNumber) Builds the binary trust anchor ID of a landmark,{caID landmarks(1) N L}(Sections 5.1 and 8.2).static byte[]logId(byte[] caId, long logNumber) Builds the binary trust anchor ID of an issuance log.static StringtoDottedDecimal(byte[] binaryId) Converts a binary trust anchor ID into the dotted-decimal form used in ASCII representations (e.g.
-
Field Details
-
LOGS_ARC
public static final int LOGS_ARCOID component for the logs arc.- See Also:
-
LANDMARKS_ARC
public static final int LANDMARKS_ARCOID component for the landmarks arc (per-landmark IDs, Section 8.2).- See Also:
-
LANDMARK_GROUPS_ARC
public static final int LANDMARK_GROUPS_ARCOID component for the landmark-groups arc (Section 8.2.1).- See Also:
-
MAX_ID_LENGTH
public static final int MAX_ID_LENGTHMaximum length, in bytes, of a trust anchor ID's binary representation. Section 4 of draft-ietf-tls-trust-anchor-ids-07 states that it "MUST NOT exceed 32 bytes" and transmits it asopaque TrustAnchorID<1..32>, so a valid trust anchor ID is 1..32 bytes. This bounds the IDs this class builds and parses; theMTCProofwire structures still carry the one-byte length prefix of draft-ietf-plants-merkle-tree-certs and read up to 255 bytes.- See Also:
-
-
Method Details
-
logId
public static byte[] logId(byte[] caId, long logNumber) Builds the binary trust anchor ID of an issuance log.- Parameters:
caId- binary trust anchor ID of the CAlogNumber- log number (1 <= logNumber <= 2^16-1, Section 5.2)
-
certSerial
Composes the 64-bit certificate serial number per Section 6.2 of draft-ietf-plants-merkle-tree-certs:serial = (log_number << 48) | indexThe validator decodes the same encoding inMerkleTreeCertificateValidator.validateCertificate(X509CertificateHolder, MerkleTreeCertificateValidator.ValidationParams); this method is the issuer-side counterpart.- Parameters:
logNumber- log number (1 <= logNumber <= 2^16-1, Section 5.2)index- entry index in the log (0 <= index <= 2^48-1)
-
certSerial
Equivalent tocertSerial(long, long)with the log number taken fromlog.getLogNumber(). -
landmarkId
public static byte[] landmarkId(byte[] caId, long logNumber, long landmarkNumber) Builds the binary trust anchor ID of a landmark,{caID landmarks(1) N L}(Sections 5.1 and 8.2). Section 5.1 allocates these OIDs for positive landmark numbers only: landmark 0 always has tree size zero and the empty subtrees, so it never needs an ID.- Parameters:
caId- binary trust anchor ID of the CAlogNumber- log numberlandmarkNumber- landmark number (landmarkNumber >= 1)
-
landmarkGroupId
public static byte[] landmarkGroupId(byte[] caId, long logNumber, long landmarkNumber) Builds the binary trust anchor ID of a landmark group,{caID landmarkGroups(2) N L}(Section 8.2.1): the group of the CA ID itself, selecting standalone certificates, and the landmarks 0 toLof logN. As withlandmarkId(byte[], long, long), Section 5.1 allocates these OIDs for positive landmark numbers only.- Parameters:
caId- binary trust anchor ID of the CAlogNumber- log numberlandmarkNumber- landmark number that names the group's high end (landmarkNumber >= 1)
-
issuerName
Builds the issuerX500Namefor a Merkle Tree certificate: a single RDN whoseid-rdna-trustAnchorIDattribute carries the CA's trust anchor ID as a RELATIVE-OID (Section 5.1 of draft-ietf-plants-merkle-tree-certs, which takes the construction from Section 4.1 of draft-ietf-tls-trust-anchor-ids). The validator concatenates this with the cert serial'slog_numberto recover the issuance log's full trust anchor ID.Earlier drafts used a UTF8String of the dotted-decimal ID for experimentation;
MerkleTreeCertificateValidator.extractCaIdFromIssuer(X500Name)still reads that form but it is no longer written.- Parameters:
caTrustAnchorIdDotted- dotted-decimal form of the CA's trust anchor ID (e.g."32473.1")
-
toDottedDecimal
Converts a binary trust anchor ID into the dotted-decimal form used in ASCII representations (e.g. inside the CosignedSubtreecosigner_name/log_origin). -
fromDottedDecimal
Converts a dotted-decimal trust anchor ID (e.g."32473.1.0.1") into its binary form: the base-128 encoded OID-component bytes with no ASN.1 tag or length prefix (Section 4 of draft-ietf-tls-trust-anchor-ids). -
encodeComponent
public static byte[] encodeComponent(long value) Encodes a non-negative integer as a single OID component using base-128 with continuation bits, as defined for RELATIVE-OID contents in Section 8.20 of X.690.
-