Class C509CertificationRequest
java.lang.Object
org.bouncycastle.cbor.c509.C509CertificationRequest
A C509 certification request (Section 4 of draft-ietf-cose-cbor-encoded-cert-20):
C509CertificationRequest = [ TBSCertificationRequest, subjectSignatureValue: any ]where the six elements of the TBSCertificationRequest group are inlined into the array. As with certificates, type 2 is natively signed (the signature covers the TBSCertificationRequest CBOR sequence) and type 3 is an invertible re-encoding of a DER RFC 2986 certification request whose signature is copied and remains verifiable over the reconstructed DER.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intNatively signed C509 certification request (c509CertificationRequestType = 2).static final intCBOR re-encoding of an RFC 2986 certification request (c509CertificationRequestType = 3). -
Method Summary
Modifier and TypeMethodDescriptionstatic C509CertificationRequestcreate(byte[] tbsCertificationRequest, byte[] signature) Assemble a certification request from an encoded TBSCertificationRequest (seecreateTBSCertificationRequest(int, AlgorithmIdentifier, X500Name, SubjectPublicKeyInfo, Extensions, String, C509ConversionOptions)) and the newly created signature over it.static C509CertificationRequestcreate(byte[] tbsCertificationRequest, byte[] signature, C509ConversionOptions options) Assemble a certification request from an encoded TBSCertificationRequest and the newly created signature over it, with the options controlling the ECDSA signature component width.static byte[]createTBSCertificationRequest(int requestType, org.bouncycastle.asn1.x509.AlgorithmIdentifier subjectSignatureAlgorithm, org.bouncycastle.asn1.x500.X500Name subject, org.bouncycastle.asn1.x509.SubjectPublicKeyInfo subjectPublicKeyInfo, org.bouncycastle.asn1.x509.Extensions extensionRequest, String challengePassword, C509ConversionOptions options) Encode the TBSCertificationRequest group for a request about to be signed.static C509CertificationRequestfromCertificationRequest(byte[] derEncoding) Convert a DER-encoded RFC 2986 certification request to a CBOR re-encoded C509 certification request (type 3) using the default conversion options.static C509CertificationRequestfromCertificationRequest(org.bouncycastle.asn1.pkcs.CertificationRequest request, C509ConversionOptions options) Convert a DER-encoded RFC 2986 certification request to a CBOR re-encoded C509 certification request (type 3).Return the request attributes.byte[]Return the complete CBOR encoding of this certification request.static C509CertificationRequestgetInstance(byte[] encoding) Parse a C509 certification request from its CBOR encoding.intReturn the request type (TYPE_NATIVEorTYPE_REENCODED_PKCS10).byte[]Return the signature value in its X.509 form: for an ECDSA style algorithm the DER SEQUENCE of the two INTEGERs, otherwise the BIT STRING value field unchanged.org.bouncycastle.asn1.x500.X500NameReturn the subject name.Return the subject public key algorithm.org.bouncycastle.asn1.x509.SubjectPublicKeyInfoReturn the subject public key.Return the subject signature algorithm.byte[]Return the encoding of the TBSCertificationRequest group as a CBOR sequence - for a natively signed request, the exact bytes the signature covers.org.bouncycastle.asn1.pkcs.CertificationRequestReconstruct the RFC 2986 certification request a CBOR re-encoded C509 certification request stands for.
-
Field Details
-
TYPE_NATIVE
public static final int TYPE_NATIVENatively signed C509 certification request (c509CertificationRequestType = 2).- See Also:
-
TYPE_REENCODED_PKCS10
public static final int TYPE_REENCODED_PKCS10CBOR re-encoding of an RFC 2986 certification request (c509CertificationRequestType = 3).- See Also:
-
-
Method Details
-
getInstance
Parse a C509 certification request from its CBOR encoding.- Throws:
IOException
-
create
public static C509CertificationRequest create(byte[] tbsCertificationRequest, byte[] signature) throws IOException Assemble a certification request from an encoded TBSCertificationRequest (seecreateTBSCertificationRequest(int, AlgorithmIdentifier, X500Name, SubjectPublicKeyInfo, Extensions, String, C509ConversionOptions)) and the newly created signature over it.- Throws:
IOException
-
create
public static C509CertificationRequest create(byte[] tbsCertificationRequest, byte[] signature, C509ConversionOptions options) throws IOException Assemble a certification request from an encoded TBSCertificationRequest and the newly created signature over it, with the options controlling the ECDSA signature component width.- Throws:
IOException
-
createTBSCertificationRequest
public static byte[] createTBSCertificationRequest(int requestType, org.bouncycastle.asn1.x509.AlgorithmIdentifier subjectSignatureAlgorithm, org.bouncycastle.asn1.x500.X500Name subject, org.bouncycastle.asn1.x509.SubjectPublicKeyInfo subjectPublicKeyInfo, org.bouncycastle.asn1.x509.Extensions extensionRequest, String challengePassword, C509ConversionOptions options) throws IOException Encode the TBSCertificationRequest group for a request about to be signed. For a natively signed request the returned encoding is exactly the byte string the signature is computed over.- Parameters:
requestType-TYPE_NATIVEorTYPE_REENCODED_PKCS10.subjectSignatureAlgorithm- the X.509 signature (or RFC 6955 proof-of-possession) algorithm.subject- the subject name.subjectPublicKeyInfo- the subject public key.extensionRequest- extensions requested of the CA (RFC 2985 extensionRequest), or null for none.challengePassword- a challenge password (RFC 2985), or null for none.- Throws:
IOException
-
fromCertificationRequest
public static C509CertificationRequest fromCertificationRequest(byte[] derEncoding) throws IOException Convert a DER-encoded RFC 2986 certification request to a CBOR re-encoded C509 certification request (type 3) using the default conversion options.- Throws:
IOException
-
fromCertificationRequest
public static C509CertificationRequest fromCertificationRequest(org.bouncycastle.asn1.pkcs.CertificationRequest request, C509ConversionOptions options) throws IOException Convert a DER-encoded RFC 2986 certification request to a CBOR re-encoded C509 certification request (type 3). As with certificates the conversion is gated on exact invertibility - if re-encoding the result does not reproduce the input DER byte for byte, the conversion is refused.- Throws:
IOException
-
toCertificationRequest
Reconstruct the RFC 2986 certification request a CBOR re-encoded C509 certification request stands for.- Throws:
IllegalStateException- if this is a natively signed request.IOException- if an attribute (such as a privateKeyPossessionStatement, which embeds C509 structures) has no DER reconstruction.
-
getEncoded
Return the complete CBOR encoding of this certification request.- Throws:
IOException
-
getTBSCertificationRequestEncoded
Return the encoding of the TBSCertificationRequest group as a CBOR sequence - for a natively signed request, the exact bytes the signature covers.- Throws:
IOException
-
getRequestType
public int getRequestType()Return the request type (TYPE_NATIVEorTYPE_REENCODED_PKCS10). -
getSubjectSignatureAlgorithm
Return the subject signature algorithm. -
getSubject
public org.bouncycastle.asn1.x500.X500Name getSubject()Return the subject name. -
getSubjectPublicKeyAlgorithm
Return the subject public key algorithm. -
getSubjectPublicKeyInfo
public org.bouncycastle.asn1.x509.SubjectPublicKeyInfo getSubjectPublicKeyInfo()Return the subject public key. -
getAttributes
Return the request attributes. -
getSignature
public byte[] getSignature()Return the signature value in its X.509 form: for an ECDSA style algorithm the DER SEQUENCE of the two INTEGERs, otherwise the BIT STRING value field unchanged.
-