Package org.bouncycastle.cert
Class X509CertificateHolder
java.lang.Object
org.bouncycastle.cert.X509CertificateHolder
- Direct Known Subclasses:
JcaX509CertificateHolder
public class X509CertificateHolder extends Object
Holding class for an X.509 Certificate structure.
-
Constructor Summary
Constructors Constructor Description X509CertificateHolder(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 booleanequals(Object o)Compares this instance with the specified object and indicates if they are equal.SetgetCriticalExtensionOIDs()Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the critical extensions contained in this holder's certificate.byte[]getEncoded()Return the ASN.1 encoding of this holder's certificate.ExtensiongetExtension(ASN1ObjectIdentifier oid)Look up the extension associated with the passed in OID.ListgetExtensionOIDs()Returns a list of ASN1ObjectIdentifier objects representing the OIDs of the extensions contained in this holder's certificate.ExtensionsgetExtensions()Return the extensions block associated with this certificate if there is one.X500NamegetIssuer()Return the issuer of this certificate.SetgetNonCriticalExtensionOIDs()Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the non-critical extensions contained in this holder's certificate.DategetNotAfter()Return the date after which this certificate is not valid.DategetNotBefore()Return the date before which this certificate is not valid.BigIntegergetSerialNumber()Return the serial number of this attribute certificate.byte[]getSignature()Return the bytes making up the signature associated with this attribute certificate.AlgorithmIdentifiergetSignatureAlgorithm()Return the details of the signature algorithm used to create this attribute certificate.X500NamegetSubject()Return the subject this certificate is for.SubjectPublicKeyInfogetSubjectPublicKeyInfo()Return the SubjectPublicKeyInfo describing the public key this certificate is carrying.intgetVersion()Deprecated.use getVersionNumberintgetVersionNumber()booleanhasExtensions()Return whether or not the holder's certificate contains extensions.inthashCode()Returns an integer hash code for this object.booleanisSignatureValid(ContentVerifierProvider verifierProvider)Validate the signature on the certificate in this holder.booleanisValidOn(Date date)Return whether or not this certificate is valid on a particular date.CertificatetoASN1Structure()Return the underlying ASN.1 structure for the certificate in this holder.
-
Constructor Details
-
X509CertificateHolder
Create a X509CertificateHolder from the passed in bytes.- Parameters:
certEncoding- BER/DER encoding of the certificate.- Throws:
IOException- in the event of corrupted data, or an incorrect structure.
-
X509CertificateHolder
Create a X509CertificateHolder from the passed in ASN.1 structure.- Parameters:
x509Certificate- an ASN.1 Certificate structure.
-
-
Method Details
-
getVersionNumber
public int getVersionNumber() -
getVersion
public int getVersion()Deprecated.use getVersionNumber -
hasExtensions
public boolean hasExtensions()Return whether or not the holder's certificate contains extensions.- Returns:
- true if extension are present, false otherwise.
-
getExtension
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.
-
getExtensions
Return the extensions block associated with this certificate if there is one.- Returns:
- the extensions block, null otherwise.
-
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
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
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
Return the serial number of this attribute certificate.- Returns:
- the serial number.
-
getIssuer
Return the issuer of this certificate.- Returns:
- the certificate issuer.
-
getSubject
Return the subject this certificate is for.- Returns:
- the subject for the certificate.
-
getNotBefore
Return the date before which this certificate is not valid.- Returns:
- the start time for the certificate's validity period.
-
getNotAfter
Return the date after which this certificate is not valid.- Returns:
- the final time for the certificate's validity period.
-
getSubjectPublicKeyInfo
Return the SubjectPublicKeyInfo describing the public key this certificate is carrying.- Returns:
- the public key ASN.1 structure contained in the certificate.
-
toASN1Structure
Return the underlying ASN.1 structure for the certificate in this holder.- Returns:
- a X509CertificateStructure object.
-
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
public byte[] getSignature()Return the bytes making up the signature associated with this attribute certificate.- Returns:
- the attribute certificate signature bytes.
-
isValidOn
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
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.
- Throws:
CertException- if the signature cannot be processed or is inappropriate.
-
equals
Description copied from class:ObjectCompares this instance with the specified object and indicates if they are equal. In order to be equal,omust represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.The default implementation returns
trueonly ifthis == o. See Writing a correctequalsmethod if you intend implementing your ownequalsmethod.The general contract for the
equalsandObject.hashCode()methods is that ifequalsreturnstruefor any two objects, thenhashCode()must return the same value for these objects. This means that subclasses ofObjectusually override either both methods or neither of them.- Overrides:
equalsin classObject- Parameters:
o- the object to compare this instance with.- Returns:
trueif the specified object is equal to thisObject;falseotherwise.- See Also:
Object.hashCode()
-
hashCode
public int hashCode()Description copied from class:ObjectReturns an integer hash code for this object. By contract, any two objects for whichObject.equals(java.lang.Object)returnstruemust return the same hash code value. This means that subclasses ofObjectusually override both methods or neither method.Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCodemethod if you intend implementing your ownhashCodemethod.- Overrides:
hashCodein classObject- Returns:
- this object's hash code.
- See Also:
Object.equals(java.lang.Object)
-
getEncoded
Return the ASN.1 encoding of this holder's certificate.- Returns:
- a DER encoded byte array.
- Throws:
IOException- if an encoding cannot be generated.
-