Top Description Fields Constructors Methods
org.bouncycastle.cert

public Class X509CertificateHolder

extends Object
implements Encodable, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.bouncycastle.util.Encodable
Known Direct Subclasses
org.bouncycastle.cert.jcajce.JcaX509CertificateHolder
Imports
java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .OutputStream, .Serializable, java.math.BigInteger, java.util.Date, .List, .Set, org.bouncycastle.asn1.ASN1ObjectIdentifier, .DEROutputStream, org.bouncycastle.asn1.x500.X500Name, org.bouncycastle.asn1.x509.AlgorithmIdentifier, .Certificate, .Extension, .Extensions, .SubjectPublicKeyInfo, .TBSCertificate, org.bouncycastle.operator.ContentVerifier, .ContentVerifierProvider, org.bouncycastle.util.Encodable

Holding class for an X.509 Certificate structure.

Field Summary

Modifier and TypeField and Description
private transient Extensions
private static final long
private transient Certificate

Constructor Summary

AccessConstructor and Description
public
X509CertificateHolder(byte[]
BER/DER encoding of the certificate.
certEncoding
)

Create a X509CertificateHolder from the passed in bytes.

public
X509CertificateHolder(Certificate
an ASN.1 Certificate structure.
x509Certificate
)

Create a X509CertificateHolder from the passed in ASN.1 structure.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public Set<E>

Returns:

a set of critical extension OIDs.
getCriticalExtensionOIDs
()

Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the critical extensions contained in this holder's certificate.

public byte[]

Returns:

a DER encoded byte array.
getEncoded
()

Implements org.bouncycastle.util.Encodable.getEncoded.

Return the ASN.1 encoding of this holder's certificate.
public Extension

Returns:

the extension if present, null otherwise.
getExtension
(ASN1ObjectIdentifier
the OID of the extension of interest.
oid
)

Look up the extension associated with the passed in OID.

public List<E>

Returns:

a list of extension OIDs.
getExtensionOIDs
()

Returns a list of ASN1ObjectIdentifier objects representing the OIDs of the extensions contained in this holder's certificate.

public Extensions

Returns:

the extensions block, null otherwise.
getExtensions
()

Return the extensions block associated with this certificate if there is one.

public X500Name

Returns:

the certificate issuer.
getIssuer
()

Return the issuer of this certificate.

public Set<E>

Returns:

a set of non-critical extension OIDs.
getNonCriticalExtensionOIDs
()

Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the non-critical extensions contained in this holder's certificate.

public Date

Returns:

the final time for the certificate's validity period.
getNotAfter
()

Return the date after which this certificate is not valid.

public Date

Returns:

the start time for the certificate's validity period.
getNotBefore
()

Return the date before which this certificate is not valid.

public BigInteger

Returns:

the serial number.
getSerialNumber
()

Return the serial number of this attribute certificate.

public byte[]

Returns:

the attribute certificate signature bytes.
getSignature
()

Return the bytes making up the signature associated with this attribute certificate.

public AlgorithmIdentifier

Returns:

the AlgorithmIdentifier describing the signature algorithm used to create this attribute certificate.
getSignatureAlgorithm
()

Return the details of the signature algorithm used to create this attribute certificate.

public X500Name

Returns:

the subject for the certificate.
getSubject
()

Return the subject this certificate is for.

public SubjectPublicKeyInfo

Returns:

the public key ASN.1 structure contained in the certificate.
getSubjectPublicKeyInfo
()

Return the SubjectPublicKeyInfo describing the public key this certificate is carrying.

public int
getVersion()

Deprecated use getVersionNumber
public int
public boolean

Returns:

true if extension are present, false otherwise.
hasExtensions
()

Return whether or not the holder's certificate contains extensions.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
private void
init(Certificate x509Certificate)

public boolean

Returns:

true if the signature is valid, false otherwise.
isSignatureValid
(ContentVerifierProvider
a ContentVerifierProvider that can generate a verifier for the signature.
verifierProvider
)

Validate the signature on the certificate in this holder.

public boolean

Returns:

true if the certificate is valid, false otherwise.
isValidOn
(Date
the date of interest.
date
)

Return whether or not this certificate is valid on a particular date.

private static Certificate
parseBytes(byte[] certEncoding)

private void
public Certificate

Returns:

a Certificate object.
toASN1Structure
()

Return the underlying ASN.1 structure for the certificate in this holder.

private void
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

extensionsback to summary
private transient Extensions extensions
serialVersionUIDback to summary
private static final long serialVersionUID
x509Certificateback to summary
private transient Certificate x509Certificate

Constructor Detail

X509CertificateHolderback to summary
public X509CertificateHolder(byte[] certEncoding) throws IOException

Create a X509CertificateHolder from the passed in bytes.

Parameters
certEncoding:byte[]

BER/DER encoding of the certificate.

Exceptions
IOException:
in the event of corrupted data, or an incorrect structure.
X509CertificateHolderback to summary
public X509CertificateHolder(Certificate x509Certificate)

Create a X509CertificateHolder from the passed in ASN.1 structure.

Parameters
x509Certificate:Certificate

an ASN.1 Certificate structure.

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

getCriticalExtensionOIDsback to summary
public Set<E> getCriticalExtensionOIDs()

Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the critical extensions contained in this holder's certificate.

Returns:Set<E>

a set of critical extension OIDs.

getEncodedback to summary
public byte[] getEncoded() throws IOException

Implements org.bouncycastle.util.Encodable.getEncoded.

Return the ASN.1 encoding of this holder's certificate.

Returns:byte[]

a DER encoded byte array.

Exceptions
IOException:
if an encoding cannot be generated.
getExtensionback to summary
public Extension getExtension(ASN1ObjectIdentifier oid)

Look up the extension associated with the passed in OID.

Parameters
oid:ASN1ObjectIdentifier

the OID of the extension of interest.

Returns:Extension

the extension if present, null otherwise.

getExtensionOIDsback to summary
public List<E> getExtensionOIDs()

Returns a list of ASN1ObjectIdentifier objects representing the OIDs of the extensions contained in this holder's certificate.

Returns:List<E>

a list of extension OIDs.

getExtensionsback to summary
public Extensions getExtensions()

Return the extensions block associated with this certificate if there is one.

Returns:Extensions

the extensions block, null otherwise.

getIssuerback to summary
public X500Name getIssuer()

Return the issuer of this certificate.

Returns:X500Name

the certificate issuer.

getNonCriticalExtensionOIDsback to summary
public Set<E> getNonCriticalExtensionOIDs()

Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the non-critical extensions contained in this holder's certificate.

Returns:Set<E>

a set of non-critical extension OIDs.

getNotAfterback to summary
public Date getNotAfter()

Return the date after which this certificate is not valid.

Returns:Date

the final time for the certificate's validity period.

getNotBeforeback to summary
public Date getNotBefore()

Return the date before which this certificate is not valid.

Returns:Date

the start time for the certificate's validity period.

getSerialNumberback to summary
public BigInteger getSerialNumber()

Return the serial number of this attribute certificate.

Returns:BigInteger

the serial number.

getSignatureback to summary
public byte[] getSignature()

Return the bytes making up the signature associated with this attribute certificate.

Returns:byte[]

the attribute certificate signature bytes.

getSignatureAlgorithmback to summary
public AlgorithmIdentifier getSignatureAlgorithm()

Return the details of the signature algorithm used to create this attribute certificate.

Returns:AlgorithmIdentifier

the AlgorithmIdentifier describing the signature algorithm used to create this attribute certificate.

getSubjectback to summary
public X500Name getSubject()

Return the subject this certificate is for.

Returns:X500Name

the subject for the certificate.

getSubjectPublicKeyInfoback to summary
public SubjectPublicKeyInfo getSubjectPublicKeyInfo()

Return the SubjectPublicKeyInfo describing the public key this certificate is carrying.

Returns:SubjectPublicKeyInfo

the public key ASN.1 structure contained in the certificate.

getVersionback to summary
public int getVersion()

Deprecated

use getVersionNumber

getVersionNumberback to summary
public int getVersionNumber()
hasExtensionsback to summary
public boolean hasExtensions()

Return whether or not the holder's certificate contains extensions.

Returns:boolean

true if extension are present, false otherwise.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

initback to summary
private void init(Certificate x509Certificate)
isSignatureValidback to summary
public boolean isSignatureValid(ContentVerifierProvider verifierProvider) throws CertException

Validate the signature on the certificate in this holder.

Parameters
verifierProvider:ContentVerifierProvider

a ContentVerifierProvider that can generate a verifier for the signature.

Returns:boolean

true if the signature is valid, false otherwise.

Exceptions
CertException:
if the signature cannot be processed or is inappropriate.
isValidOnback to summary
public boolean isValidOn(Date date)

Return whether or not this certificate is valid on a particular date.

Parameters
date:Date

the date of interest.

Returns:boolean

true if the certificate is valid, false otherwise.

parseBytesback to summary
private static Certificate parseBytes(byte[] certEncoding) throws IOException
readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
toASN1Structureback to summary
public Certificate toASN1Structure()

Return the underlying ASN.1 structure for the certificate in this holder.

Returns:Certificate

a Certificate object.

writeObjectback to summary
private void writeObject(ObjectOutputStream out) throws IOException