Class C509CertificateHolder
java.lang.Object
org.bouncycastle.cert.c509.C509CertificateHolder
- All Implemented Interfaces:
org.bouncycastle.util.Encodable
Holding class for a C509 certificate (draft-ietf-cose-cbor-encoded-cert-20),
mirroring
X509CertificateHolder.
For a natively signed certificate (type 2) the signature covers the
TBSCertificate CBOR sequence and isSignatureValid(ContentVerifierProvider) checks it directly over
those bytes. For a CBOR re-encoded X.509 certificate (type 3) the signature covers
the reconstructed DER TBSCertificate, and the holder can also be turned back into
an X509CertificateHolder with toX509CertificateHolder().
-
Constructor Summary
ConstructorsConstructorDescriptionC509CertificateHolder(byte[] encoding) Create a holder from the CBOR encoding of a C509 certificate.C509CertificateHolder(org.bouncycastle.cbor.c509.C509Certificate certificate) Base constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanorg.bouncycastle.cbor.c509.C509CertificateReturn the certificate this holder wraps.intReturn the certificate type (C509Certificate.TYPE_NATIVEorC509Certificate.TYPE_REENCODED_X509).byte[]Return the CBOR encoding of the certificate.org.bouncycastle.asn1.x509.ExtensionsReturn the X.509 view of the extensions, or null if there are none.org.bouncycastle.asn1.x500.X500NameReturn the end of the validity period.org.bouncycastle.cbor.c509.C509AlgorithmIdentifierbyte[]Return the bytes the certificate signature is computed over: the TBSCertificate CBOR sequence for a natively signed certificate, the reconstructed DER TBSCertificate for a re-encoded one.org.bouncycastle.asn1.x500.X500Nameorg.bouncycastle.asn1.x509.SubjectPublicKeyInfointhashCode()booleanisSignatureValid(ContentVerifierProvider verifierProvider) Validate the signature on this certificate.booleanReturn whether or not the certificate is valid on the date given.Return the X.509 holder for a CBOR re-encoded (type 3) certificate.
-
Constructor Details
-
C509CertificateHolder
public C509CertificateHolder(org.bouncycastle.cbor.c509.C509Certificate certificate) Base constructor.- Parameters:
certificate- the certificate this holder wraps.
-
C509CertificateHolder
Create a holder from the CBOR encoding of a C509 certificate.- Throws:
IOException
-
-
Method Details
-
getC509Certificate
public org.bouncycastle.cbor.c509.C509Certificate getC509Certificate()Return the certificate this holder wraps. -
getCertificateType
public int getCertificateType()Return the certificate type (C509Certificate.TYPE_NATIVEorC509Certificate.TYPE_REENCODED_X509). -
getSerialNumber
-
getIssuer
public org.bouncycastle.asn1.x500.X500Name getIssuer() -
getSubject
public org.bouncycastle.asn1.x500.X500Name getSubject() -
getNotBefore
-
getNotAfter
Return the end of the validity period. A certificate with no well-defined expiration date (99991231235959Z) returns the corresponding date. -
isValidOn
Return whether or not the certificate is valid on the date given. -
getSubjectPublicKeyInfo
public org.bouncycastle.asn1.x509.SubjectPublicKeyInfo getSubjectPublicKeyInfo() -
getSignatureAlgorithm
public org.bouncycastle.cbor.c509.C509AlgorithmIdentifier getSignatureAlgorithm() -
getExtensions
public org.bouncycastle.asn1.x509.Extensions getExtensions()Return the X.509 view of the extensions, or null if there are none. -
isSignatureValid
Validate the signature on this certificate.- Parameters:
verifierProvider- a provider of verifiers built on the issuer's public key.- Returns:
- true if the signature verifies, false otherwise.
- Throws:
CertException
-
getSignedBytes
Return the bytes the certificate signature is computed over: the TBSCertificate CBOR sequence for a natively signed certificate, the reconstructed DER TBSCertificate for a re-encoded one.- Throws:
IOException
-
toX509CertificateHolder
Return the X.509 holder for a CBOR re-encoded (type 3) certificate.- Throws:
IllegalStateException- if this is a natively signed certificate.IOException
-
getEncoded
Return the CBOR encoding of the certificate.- Specified by:
getEncodedin interfaceorg.bouncycastle.util.Encodable- Throws:
IOException
-
equals
-
hashCode
-