Class C509CertificateBuilder


  • public class C509CertificateBuilder
    extends java.lang.Object
    Builder for natively signed C509 certificates (type 2, draft-ietf-cose-cbor-encoded-cert-20), mirroring the X.509 v3 certificate builder. The signature is computed directly over the TBSCertificate CBOR sequence, so no ASN.1 processing is needed to verify the result.

    A CBOR re-encoded certificate (type 3) is not built directly - issue an X.509 certificate in the usual way and convert it with C509Certificate.fromX509Certificate(org.bouncycastle.asn1.x509.Certificate, C509ConversionOptions).

    • Constructor Summary

      Constructors 
      Constructor Description
      C509CertificateBuilder​(org.bouncycastle.asn1.x500.X500Name issuer, java.math.BigInteger serialNumber, java.util.Date notBefore, java.util.Date notAfter, org.bouncycastle.asn1.x500.X500Name subject, org.bouncycastle.asn1.x509.SubjectPublicKeyInfo subjectPublicKeyInfo)
      Base constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      C509CertificateBuilder addExtension​(org.bouncycastle.asn1.ASN1ObjectIdentifier oid, boolean isCritical, byte[] encodedValue)
      Add a given extension field for the standard extensions tag, with the value already encoded.
      C509CertificateBuilder addExtension​(org.bouncycastle.asn1.ASN1ObjectIdentifier oid, boolean isCritical, org.bouncycastle.asn1.ASN1Encodable value)
      Add a given extension field for the standard extensions tag.
      C509CertificateHolder build​(ContentSigner signer)
      Generate the certificate, signing the TBSCertificate CBOR sequence with the given signer.
      C509CertificateBuilder setConversionOptions​(org.bouncycastle.cbor.c509.C509ConversionOptions options)
      Set the conversion options - point compression in particular.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • C509CertificateBuilder

        public C509CertificateBuilder​(org.bouncycastle.asn1.x500.X500Name issuer,
                                      java.math.BigInteger serialNumber,
                                      java.util.Date notBefore,
                                      java.util.Date notAfter,
                                      org.bouncycastle.asn1.x500.X500Name subject,
                                      org.bouncycastle.asn1.x509.SubjectPublicKeyInfo subjectPublicKeyInfo)
        Base constructor.
        Parameters:
        issuer - the certificate issuer.
        serialNumber - the certificate serial number.
        notBefore - the date before which the certificate is not valid.
        notAfter - the date after which the certificate is not valid, or null for no well-defined expiration date.
        subject - the certificate subject.
        subjectPublicKeyInfo - the info structure for the public key to be associated with this certificate.
    • Method Detail

      • setConversionOptions

        public C509CertificateBuilder setConversionOptions​(org.bouncycastle.cbor.c509.C509ConversionOptions options)
        Set the conversion options - point compression in particular. A natively signed certificate stores a compressed Weierstrass key with the SEC 1 octets 0x02/0x03.
      • addExtension

        public C509CertificateBuilder addExtension​(org.bouncycastle.asn1.ASN1ObjectIdentifier oid,
                                                   boolean isCritical,
                                                   org.bouncycastle.asn1.ASN1Encodable value)
                                            throws CertIOException
        Add a given extension field for the standard extensions tag.
        Throws:
        CertIOException
      • addExtension

        public C509CertificateBuilder addExtension​(org.bouncycastle.asn1.ASN1ObjectIdentifier oid,
                                                   boolean isCritical,
                                                   byte[] encodedValue)
        Add a given extension field for the standard extensions tag, with the value already encoded.