Package org.bouncycastle.cert.plants
Class MTCCertificationAuthorityCertificate
- java.lang.Object
-
- org.bouncycastle.cert.plants.MTCCertificationAuthorityCertificate
-
public final class MTCCertificationAuthorityCertificate extends java.lang.ObjectHelpers 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 UTF8String value of the dotted-decimal trust anchor IDsubjectPublicKeyInfois the CA cosigner's public keyextensionscarries a criticalMTCObjectIdentifiers.id_pe_mtcCertificationAuthorityextension whose value is theMTCCertificationAuthoritystructurekeyUsage(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
ContentSignertoX509v3CertificateBuilder.build(org.bouncycastle.operator.ContentSigner)when finishing the chain (e.g. an unsigned-cert signer per draft-ietf-lamps-x509-alg-none, or an external CA).
-
-
Field Summary
Fields Modifier and Type Field Description static org.bouncycastle.asn1.ASN1ObjectIdentifierEXTENSION_OIDOID for theid-pe-mtcCertificationAuthoritycertificate extension.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.bouncycastle.asn1.x509.ExtensionbuildAuthorityExtension(org.bouncycastle.asn1.x509.MTCCertificationAuthority info)Builds the criticalid-pe-mtcCertificationAuthorityextension.static org.bouncycastle.asn1.x509.MTCCertificationAuthorityextractAuthorityInfo(X509CertificateHolder cert)Extracts theMTCCertificationAuthoritystructure from theid-pe-mtcCertificationAuthorityextension of a CA certificate.static byte[]extractCaId(X509CertificateHolder cert)Extracts the binary CA trust anchor ID from thesubjectfield of a CA certificate.static X509v3CertificateBuildernewBuilder(org.bouncycastle.asn1.x500.X500Name issuer, java.math.BigInteger serial, java.util.Date notBefore, java.util.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, using the experimental encoding from Section 5.1.
-
-
-
Method Detail
-
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, using the experimental encoding from Section 5.1.
-
buildAuthorityExtension
public static org.bouncycastle.asn1.x509.Extension buildAuthorityExtension(org.bouncycastle.asn1.x509.MTCCertificationAuthority info) throws java.io.IOExceptionBuilds the criticalid-pe-mtcCertificationAuthorityextension.- Throws:
java.io.IOException
-
newBuilder
public static X509v3CertificateBuilder newBuilder(org.bouncycastle.asn1.x500.X500Name issuer, java.math.BigInteger serial, java.util.Date notBefore, java.util.Date notAfter, byte[] caId, org.bouncycastle.asn1.x509.SubjectPublicKeyInfo cosignerSpki, org.bouncycastle.asn1.x509.MTCCertificationAuthority info) throws java.io.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:
java.io.IOException
-
extractCaId
public static byte[] extractCaId(X509CertificateHolder cert) throws java.io.IOException
Extracts the binary CA trust anchor ID from thesubjectfield of a CA certificate. The encoding rules mirrorMerkleTreeCertificateValidator.extractCaIdFromIssuer(org.bouncycastle.asn1.x500.X500Name), which reads the equivalent attribute from theissuerfield of a Merkle Tree end-entity certificate.- Throws:
java.io.IOException
-
extractAuthorityInfo
public static org.bouncycastle.asn1.x509.MTCCertificationAuthority extractAuthorityInfo(X509CertificateHolder cert) throws java.io.IOException
Extracts theMTCCertificationAuthoritystructure from theid-pe-mtcCertificationAuthorityextension of a CA certificate.- Throws:
java.io.IOException- if the extension is absent, not marked critical, or cannot be parsed
-
-