Class X509CertificateHolder
-
- All Implemented Interfaces:
-
io.anyline.nfc.bouncycastle.util.Encodable
,java.io.Serializable
public class X509CertificateHolder implements Encodable, Serializable
Holding class for an X.509 Certificate structure.
-
-
Field Summary
Fields Modifier and Type Field Description public transient Extensions
extensions
-
Constructor Summary
Constructors Constructor Description X509CertificateHolder(Array<byte> certEncoding)
Create a X509CertificateHolder from the passed in bytes. X509CertificateHolder(Certificate x509Certificate)
Create a X509CertificateHolder from the passed in ASN.1 structure.
-
Method Summary
Modifier and Type Method Description Extensions
getExtensions()
Return the extensions block associated with this certificate if there is one. int
getVersionNumber()
int
getVersion()
boolean
hasExtensions()
Return whether or not the holder's certificate contains extensions. Extension
getExtension(ASN1ObjectIdentifier oid)
Look up the extension associated with the passed in OID. List
getExtensionOIDs()
Returns a list of ASN1ObjectIdentifier objects representing the OIDs of the extensions contained in this holder's certificate. Set
getCriticalExtensionOIDs()
Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the critical extensions contained in this holder's certificate. Set
getNonCriticalExtensionOIDs()
Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the non-critical extensions contained in this holder's certificate. BigInteger
getSerialNumber()
Return the serial number of this attribute certificate. X500Name
getIssuer()
Return the issuer of this certificate. X500Name
getSubject()
Return the subject this certificate is for. Date
getNotBefore()
Return the date before which this certificate is not valid. Date
getNotAfter()
Return the date after which this certificate is not valid. SubjectPublicKeyInfo
getSubjectPublicKeyInfo()
Return the SubjectPublicKeyInfo describing the public key this certificate is carrying. Certificate
toASN1Structure()
Return the underlying ASN.1 structure for the certificate in this holder. AlgorithmIdentifier
getSignatureAlgorithm()
Return the details of the signature algorithm used to create this attribute certificate. Array<byte>
getSignature()
Return the bytes making up the signature associated with this attribute certificate. boolean
isValidOn(Date date)
Return whether or not this certificate is valid on a particular date. boolean
isSignatureValid(ContentVerifierProvider verifierProvider)
Validate the signature on the certificate in this holder. boolean
equals(Object o)
int
hashCode()
Array<byte>
getEncoded()
Return the ASN.1 encoding of this holder's certificate. -
-
Constructor Detail
-
X509CertificateHolder
X509CertificateHolder(Array<byte> certEncoding)
Create a X509CertificateHolder from the passed in bytes.- Parameters:
certEncoding
- BER/DER encoding of the certificate.
-
X509CertificateHolder
X509CertificateHolder(Certificate x509Certificate)
Create a X509CertificateHolder from the passed in ASN.1 structure.- Parameters:
x509Certificate
- an ASN.1 Certificate structure.
-
-
Method Detail
-
getExtensions
Extensions getExtensions()
Return the extensions block associated with this certificate if there is one.
- Returns:
the extensions block, null otherwise.
-
getVersionNumber
int getVersionNumber()
-
getVersion
int getVersion()
-
hasExtensions
boolean hasExtensions()
Return whether or not the holder's certificate contains extensions.
- Returns:
true if extension are present, false otherwise.
-
getExtension
Extension getExtension(ASN1ObjectIdentifier oid)
Look up the extension associated with the passed in OID.
- Parameters:
oid
- the OID of the extension of interest.- Returns:
the extension if present, null otherwise.
-
getExtensionOIDs
List getExtensionOIDs()
Returns a list of ASN1ObjectIdentifier objects representing the OIDs of the extensions contained in this holder's certificate.
- Returns:
a list of extension OIDs.
-
getCriticalExtensionOIDs
Set getCriticalExtensionOIDs()
Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the critical extensions contained in this holder's certificate.
- Returns:
a set of critical extension OIDs.
-
getNonCriticalExtensionOIDs
Set getNonCriticalExtensionOIDs()
Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the non-critical extensions contained in this holder's certificate.
- Returns:
a set of non-critical extension OIDs.
-
getSerialNumber
BigInteger getSerialNumber()
Return the serial number of this attribute certificate.
- Returns:
the serial number.
-
getIssuer
X500Name getIssuer()
Return the issuer of this certificate.
- Returns:
the certificate issuer.
-
getSubject
X500Name getSubject()
Return the subject this certificate is for.
- Returns:
the subject for the certificate.
-
getNotBefore
Date getNotBefore()
Return the date before which this certificate is not valid.
- Returns:
the start time for the certificate's validity period.
-
getNotAfter
Date getNotAfter()
Return the date after which this certificate is not valid.
- Returns:
the final time for the certificate's validity period.
-
getSubjectPublicKeyInfo
SubjectPublicKeyInfo getSubjectPublicKeyInfo()
Return the SubjectPublicKeyInfo describing the public key this certificate is carrying.
- Returns:
the public key ASN.1 structure contained in the certificate.
-
toASN1Structure
Certificate toASN1Structure()
Return the underlying ASN.1 structure for the certificate in this holder.
- Returns:
a Certificate object.
-
getSignatureAlgorithm
AlgorithmIdentifier getSignatureAlgorithm()
Return the details of the signature algorithm used to create this attribute certificate.
- Returns:
the AlgorithmIdentifier describing the signature algorithm used to create this attribute certificate.
-
getSignature
Array<byte> getSignature()
Return the bytes making up the signature associated with this attribute certificate.
- Returns:
the attribute certificate signature bytes.
-
isValidOn
boolean isValidOn(Date date)
Return whether or not this certificate is valid on a particular date.
- Parameters:
date
- the date of interest.- Returns:
true if the certificate is valid, false otherwise.
-
isSignatureValid
boolean isSignatureValid(ContentVerifierProvider verifierProvider)
Validate the signature on the certificate in this holder.
- Parameters:
verifierProvider
- a ContentVerifierProvider that can generate a verifier for the signature.- Returns:
true if the signature is valid, false otherwise.
-
hashCode
int hashCode()
-
getEncoded
Array<byte> getEncoded()
Return the ASN.1 encoding of this holder's certificate.
- Returns:
a DER encoded byte array.
-
-
-
-