Package org.bouncycastle.cert
Class X509AttributeCertificateHolder
- java.lang.Object
-
- org.bouncycastle.cert.X509AttributeCertificateHolder
-
- All Implemented Interfaces:
java.io.Serializable
,org.bouncycastle.util.Encodable
public class X509AttributeCertificateHolder extends java.lang.Object implements org.bouncycastle.util.Encodable, java.io.Serializable
Holding class for an X.509 AttributeCertificate structure.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description X509AttributeCertificateHolder(byte[] certEncoding)
Create a X509AttributeCertificateHolder from the passed in bytes.X509AttributeCertificateHolder(org.bouncycastle.asn1.x509.AttributeCertificate attrCert)
Create a X509AttributeCertificateHolder from the passed in ASN.1 structure.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
org.bouncycastle.asn1.x509.Attribute[]
getAttributes()
Return the attributes, if any associated with this request.org.bouncycastle.asn1.x509.Attribute[]
getAttributes(org.bouncycastle.asn1.ASN1ObjectIdentifier type)
Return an array of attributes matching the passed in type OID.java.util.Set
getCriticalExtensionOIDs()
Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the critical extensions contained in this holder's attribute certificate.byte[]
getEncoded()
Return the ASN.1 encoding of this holder's attribute certificate.org.bouncycastle.asn1.x509.Extension
getExtension(org.bouncycastle.asn1.ASN1ObjectIdentifier oid)
Look up the extension associated with the passed in OID.java.util.List
getExtensionOIDs()
Returns a list of ASN1ObjectIdentifier objects representing the OIDs of the extensions contained in this holder's attribute certificate.org.bouncycastle.asn1.x509.Extensions
getExtensions()
Return the extensions block associated with this certificate if there is one.AttributeCertificateHolder
getHolder()
Return the holder details for this attribute certificate.AttributeCertificateIssuer
getIssuer()
Return the issuer details for this attribute certificate.boolean[]
getIssuerUniqueID()
java.util.Set
getNonCriticalExtensionOIDs()
Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the non-critical extensions contained in this holder's attribute certificate.java.util.Date
getNotAfter()
Return the date after which this attribute certificate is not valid.java.util.Date
getNotBefore()
Return the date before which this attribute certificate is not valid.java.math.BigInteger
getSerialNumber()
Return the serial number of this attribute certificate.byte[]
getSignature()
Return the bytes making up the signature associated with this attribute certificate.org.bouncycastle.asn1.x509.AlgorithmIdentifier
getSignatureAlgorithm()
Return the details of the signature algorithm used to create this attribute certificate.int
getVersion()
boolean
hasExtensions()
Return whether or not the holder's attribute certificate contains extensions.int
hashCode()
boolean
isSignatureValid(ContentVerifierProvider verifierProvider)
Validate the signature on the attribute certificate in this holder.boolean
isValidOn(java.util.Date date)
Return whether or not this attribute certificate is valid on a particular date.org.bouncycastle.asn1.x509.AttributeCertificate
toASN1Structure()
Return the underlying ASN.1 structure for the attribute certificate in this holder.
-
-
-
Constructor Detail
-
X509AttributeCertificateHolder
public X509AttributeCertificateHolder(byte[] certEncoding) throws java.io.IOException
Create a X509AttributeCertificateHolder from the passed in bytes.- Parameters:
certEncoding
- BER/DER encoding of the certificate.- Throws:
java.io.IOException
- in the event of corrupted data, or an incorrect structure.
-
X509AttributeCertificateHolder
public X509AttributeCertificateHolder(org.bouncycastle.asn1.x509.AttributeCertificate attrCert)
Create a X509AttributeCertificateHolder from the passed in ASN.1 structure.- Parameters:
attrCert
- an ASN.1 AttributeCertificate structure.
-
-
Method Detail
-
getEncoded
public byte[] getEncoded() throws java.io.IOException
Return the ASN.1 encoding of this holder's attribute certificate.- Specified by:
getEncoded
in interfaceorg.bouncycastle.util.Encodable
- Returns:
- a DER encoded byte array.
- Throws:
java.io.IOException
- if an encoding cannot be generated.
-
getVersion
public int getVersion()
-
getSerialNumber
public java.math.BigInteger getSerialNumber()
Return the serial number of this attribute certificate.- Returns:
- the serial number.
-
getHolder
public AttributeCertificateHolder getHolder()
Return the holder details for this attribute certificate.- Returns:
- this attribute certificate's holder structure.
-
getIssuer
public AttributeCertificateIssuer getIssuer()
Return the issuer details for this attribute certificate.- Returns:
- this attribute certificate's issuer structure,
-
getNotBefore
public java.util.Date getNotBefore()
Return the date before which this attribute certificate is not valid.- Returns:
- the start date for the attribute certificate's validity period.
-
getNotAfter
public java.util.Date getNotAfter()
Return the date after which this attribute certificate is not valid.- Returns:
- the final date for the attribute certificate's validity period.
-
getAttributes
public org.bouncycastle.asn1.x509.Attribute[] getAttributes()
Return the attributes, if any associated with this request.- Returns:
- an array of Attribute, zero length if none present.
-
getAttributes
public org.bouncycastle.asn1.x509.Attribute[] getAttributes(org.bouncycastle.asn1.ASN1ObjectIdentifier type)
Return an array of attributes matching the passed in type OID.- Parameters:
type
- the type of the attribute being looked for.- Returns:
- an array of Attribute of the requested type, zero length if none present.
-
hasExtensions
public boolean hasExtensions()
Return whether or not the holder's attribute certificate contains extensions.- Returns:
- true if extension are present, false otherwise.
-
getExtension
public org.bouncycastle.asn1.x509.Extension getExtension(org.bouncycastle.asn1.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.
-
getExtensions
public org.bouncycastle.asn1.x509.Extensions getExtensions()
Return the extensions block associated with this certificate if there is one.- Returns:
- the extensions block, null otherwise.
-
getExtensionOIDs
public java.util.List getExtensionOIDs()
Returns a list of ASN1ObjectIdentifier objects representing the OIDs of the extensions contained in this holder's attribute certificate.- Returns:
- a list of extension OIDs.
-
getCriticalExtensionOIDs
public java.util.Set getCriticalExtensionOIDs()
Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the critical extensions contained in this holder's attribute certificate.- Returns:
- a set of critical extension OIDs.
-
getNonCriticalExtensionOIDs
public java.util.Set getNonCriticalExtensionOIDs()
Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the non-critical extensions contained in this holder's attribute certificate.- Returns:
- a set of non-critical extension OIDs.
-
getIssuerUniqueID
public boolean[] getIssuerUniqueID()
-
getSignatureAlgorithm
public org.bouncycastle.asn1.x509.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
public byte[] getSignature()
Return the bytes making up the signature associated with this attribute certificate.- Returns:
- the attribute certificate signature bytes.
-
toASN1Structure
public org.bouncycastle.asn1.x509.AttributeCertificate toASN1Structure()
Return the underlying ASN.1 structure for the attribute certificate in this holder.- Returns:
- a AttributeCertificate object.
-
isValidOn
public boolean isValidOn(java.util.Date date)
Return whether or not this attribute certificate is valid on a particular date.- Parameters:
date
- the date of interest.- Returns:
- true if the attribute certificate is valid, false otherwise.
-
isSignatureValid
public boolean isSignatureValid(ContentVerifierProvider verifierProvider) throws CertException
Validate the signature on the attribute 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
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-