Package org.bouncycastle.cert.c509
Class C509CertificateBuilder
- java.lang.Object
-
- org.bouncycastle.cert.c509.C509CertificateBuilder
-
public class C509CertificateBuilder extends java.lang.ObjectBuilder 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 C509CertificateBuilderaddExtension(org.bouncycastle.asn1.ASN1ObjectIdentifier oid, boolean isCritical, byte[] encodedValue)Add a given extension field for the standard extensions tag, with the value already encoded.C509CertificateBuilderaddExtension(org.bouncycastle.asn1.ASN1ObjectIdentifier oid, boolean isCritical, org.bouncycastle.asn1.ASN1Encodable value)Add a given extension field for the standard extensions tag.C509CertificateHolderbuild(ContentSigner signer)Generate the certificate, signing the TBSCertificate CBOR sequence with the given signer.C509CertificateBuildersetConversionOptions(org.bouncycastle.cbor.c509.C509ConversionOptions options)Set the conversion options - point compression in particular.
-
-
-
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.
-
build
public C509CertificateHolder build(ContentSigner signer) throws CertIOException
Generate the certificate, signing the TBSCertificate CBOR sequence with the given signer.- Throws:
CertIOException
-
-