Class MTCCertificationAuthorityCertificate
java.lang.Object
org.bouncycastle.cert.plants.MTCCertificationAuthorityCertificate
Helpers for the CA certificate representation defined by Section 5.5 of
draft-ietf-plants-merkle-tree-certs.
A Merkle Tree CA is represented as an X.509 certificate whose:
subjectis the CA ID encoded as a single-RDN distinguished name, usingMTCObjectIdentifiers.id_rdna_trustAnchorIDwith a RELATIVE-OID value carrying the trust anchor IDsubjectPublicKeyInfois the CA cosigner's public keyextensionscarries a criticalMTCObjectIdentifiers.id_pe_mtcCertificationAuthority_SHA256extension whose value is theMTCCertificationAuthoritystructure; the extension type identifies the log hash function, SHA-256 herekeyUsage(critical) asserts at leastkeyCertSignbasicConstraints(critical) setscA=truesubjectKeyIdentifier(when present) SHOULD be the binary CA ID
Per Section 5.5 such certificates SHOULD NOT be self-signed; they are
typically distributed as unsigned trust anchors. This helper does not sign
the certificate — the caller supplies a ContentSigner
to X509v3CertificateBuilder.build(ContentSigner) when finishing the chain (e.g. an
unsigned-cert signer per draft-ietf-lamps-x509-alg-none, or an external CA).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.bouncycastle.asn1.ASN1ObjectIdentifierOID for theid-pe-mtcCertificationAuthority-SHA256certificate extension. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bouncycastle.asn1.x509.ExtensionbuildAuthorityExtension(org.bouncycastle.asn1.x509.MTCCertificationAuthority info) Builds the criticalid-pe-mtcCertificationAuthority-SHA256extension.static org.bouncycastle.asn1.x509.MTCCertificationAuthorityExtracts theMTCCertificationAuthoritystructure from theid-pe-mtcCertificationAuthority-SHA256extension of a CA certificate.static byte[]Extracts the binary CA trust anchor ID from thesubjectfield of a CA certificate.static org.bouncycastle.asn1.x509.AlgorithmIdentifierReturns the hash function the CA's issuance logs use, as identified by the type of the Merkle Tree CA extension (Section 7.1): SHA-256 forid-pe-mtcCertificationAuthority-SHA256, the one type the draft defines.static X509v3CertificateBuildernewBuilder(org.bouncycastle.asn1.x500.X500Name issuer, BigInteger serial, Date notBefore, Date notAfter, byte[] caId, org.bouncycastle.asn1.x509.SubjectPublicKeyInfo cosignerSpki, org.bouncycastle.asn1.x509.MTCCertificationAuthority info) Prepares a fully-populatedX509v3CertificateBuilderfor an MTC CA certificate.static org.bouncycastle.asn1.x500.X500NamesubjectName(byte[] caId) Builds thesubject(orissuer) distinguished name for a CA whose binary trust anchor ID iscaId: a single RDN whoseid-rdna-trustAnchorIDattribute carries the ID as a RELATIVE-OID (Section 5.1, and Section 4.1 of draft-ietf-tls-trust-anchor-ids).
-
Field Details
-
EXTENSION_OID
public static final org.bouncycastle.asn1.ASN1ObjectIdentifier EXTENSION_OIDOID for theid-pe-mtcCertificationAuthority-SHA256certificate extension.
-
-
Method Details
-
subjectName
public static org.bouncycastle.asn1.x500.X500Name subjectName(byte[] caId) Builds thesubject(orissuer) distinguished name for a CA whose binary trust anchor ID iscaId: a single RDN whoseid-rdna-trustAnchorIDattribute carries the ID as a RELATIVE-OID (Section 5.1, and Section 4.1 of draft-ietf-tls-trust-anchor-ids). -
buildAuthorityExtension
public static org.bouncycastle.asn1.x509.Extension buildAuthorityExtension(org.bouncycastle.asn1.x509.MTCCertificationAuthority info) throws IOException Builds the criticalid-pe-mtcCertificationAuthority-SHA256extension.- Throws:
IOException
-
newBuilder
public static X509v3CertificateBuilder newBuilder(org.bouncycastle.asn1.x500.X500Name issuer, BigInteger serial, Date notBefore, Date notAfter, byte[] caId, org.bouncycastle.asn1.x509.SubjectPublicKeyInfo cosignerSpki, org.bouncycastle.asn1.x509.MTCCertificationAuthority info) throws IOException Prepares a fully-populatedX509v3CertificateBuilderfor an MTC CA certificate. The caller must invokebuildwith an appropriate signer (e.g. an unsigned-cert signer, or an external CA signer).- Parameters:
issuer- the X.509 issuer (often the same assubjectwhen the trust anchor is self-attested, or the OID of the chaining CA)serial- certificate serial numbernotBefore- validity startnotAfter- validity endcaId- binary CA trust anchor IDcosignerSpki- the cosigner's SubjectPublicKeyInfoinfo- theMTCCertificationAuthorityextension value- Throws:
IOException
-
extractCaId
Extracts the binary CA trust anchor ID from thesubjectfield of a CA certificate. The encoding rules mirrorMerkleTreeCertificateValidator.extractCaIdFromIssuer(X500Name), which reads the equivalent attribute from theissuerfield of a Merkle Tree end-entity certificate.- Throws:
IOException
-
logHashAlgorithm
public static org.bouncycastle.asn1.x509.AlgorithmIdentifier logHashAlgorithm(X509CertificateHolder cert) throws IOException Returns the hash function the CA's issuance logs use, as identified by the type of the Merkle Tree CA extension (Section 7.1): SHA-256 forid-pe-mtcCertificationAuthority-SHA256, the one type the draft defines.- Throws:
IOException- if the extension is absent or not marked critical
-
extractAuthorityInfo
public static org.bouncycastle.asn1.x509.MTCCertificationAuthority extractAuthorityInfo(X509CertificateHolder cert) throws IOException Extracts theMTCCertificationAuthoritystructure from theid-pe-mtcCertificationAuthority-SHA256extension of a CA certificate.- Throws:
IOException- if the extension is absent, not marked critical, or cannot be parsed
-