Package org.gudy.bouncycastle.x509
Class X509V2AttributeCertificate
- java.lang.Object
-
- org.gudy.bouncycastle.x509.X509V2AttributeCertificate
-
- All Implemented Interfaces:
java.security.cert.X509Extension
,X509AttributeCertificate
public class X509V2AttributeCertificate extends java.lang.Object implements X509AttributeCertificate
An implementation of a version 2 X.509 Attribute Certificate.
-
-
Field Summary
Fields Modifier and Type Field Description private AttributeCertificate
cert
private java.util.Date
notAfter
private java.util.Date
notBefore
-
Constructor Summary
Constructors Constructor Description X509V2AttributeCertificate(byte[] encoded)
X509V2AttributeCertificate(java.io.InputStream encIn)
X509V2AttributeCertificate(AttributeCertificate cert)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkValidity()
void
checkValidity(java.util.Date date)
boolean
equals(java.lang.Object o)
X509Attribute[]
getAttributes()
Return the attributes contained in the attribute block in the certificate.X509Attribute[]
getAttributes(java.lang.String oid)
Return the attributes with the same type as the passed in oid.java.util.Set
getCriticalExtensionOIDs()
byte[]
getEncoded()
Return an ASN.1 encoded byte array representing the attribute certificate.private java.util.Set
getExtensionOIDs(boolean critical)
byte[]
getExtensionValue(java.lang.String oid)
AttributeCertificateHolder
getHolder()
Return the holder of the certificate.AttributeCertificateIssuer
getIssuer()
Return the issuer details for the certificate.boolean[]
getIssuerUniqueID()
java.util.Set
getNonCriticalExtensionOIDs()
java.util.Date
getNotAfter()
Return the date after which the certificate is not valid.java.util.Date
getNotBefore()
Return the date before which the certificate is not valid.java.math.BigInteger
getSerialNumber()
Return the serial number for the certificate.byte[]
getSignature()
int
getVersion()
Return the version number for the certificate.int
hashCode()
boolean
hasUnsupportedCriticalExtension()
void
verify(java.security.PublicKey key, java.lang.String provider)
-
-
-
Field Detail
-
cert
private AttributeCertificate cert
-
notBefore
private java.util.Date notBefore
-
notAfter
private java.util.Date notAfter
-
-
Constructor Detail
-
X509V2AttributeCertificate
public X509V2AttributeCertificate(java.io.InputStream encIn) throws java.io.IOException
- Throws:
java.io.IOException
-
X509V2AttributeCertificate
public X509V2AttributeCertificate(byte[] encoded) throws java.io.IOException
- Throws:
java.io.IOException
-
X509V2AttributeCertificate
X509V2AttributeCertificate(AttributeCertificate cert) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getVersion
public int getVersion()
Description copied from interface:X509AttributeCertificate
Return the version number for the certificate.- Specified by:
getVersion
in interfaceX509AttributeCertificate
- Returns:
- the version number.
-
getSerialNumber
public java.math.BigInteger getSerialNumber()
Description copied from interface:X509AttributeCertificate
Return the serial number for the certificate.- Specified by:
getSerialNumber
in interfaceX509AttributeCertificate
- Returns:
- the serial number.
-
getHolder
public AttributeCertificateHolder getHolder()
Description copied from interface:X509AttributeCertificate
Return the holder of the certificate.- Specified by:
getHolder
in interfaceX509AttributeCertificate
- Returns:
- the holder.
-
getIssuer
public AttributeCertificateIssuer getIssuer()
Description copied from interface:X509AttributeCertificate
Return the issuer details for the certificate.- Specified by:
getIssuer
in interfaceX509AttributeCertificate
- Returns:
- the issuer details.
-
getNotBefore
public java.util.Date getNotBefore()
Description copied from interface:X509AttributeCertificate
Return the date before which the certificate is not valid.- Specified by:
getNotBefore
in interfaceX509AttributeCertificate
- Returns:
- the "not valid before" date.
-
getNotAfter
public java.util.Date getNotAfter()
Description copied from interface:X509AttributeCertificate
Return the date after which the certificate is not valid.- Specified by:
getNotAfter
in interfaceX509AttributeCertificate
- Returns:
- the "not valid afer" date.
-
getIssuerUniqueID
public boolean[] getIssuerUniqueID()
- Specified by:
getIssuerUniqueID
in interfaceX509AttributeCertificate
-
checkValidity
public void checkValidity() throws java.security.cert.CertificateExpiredException, java.security.cert.CertificateNotYetValidException
- Specified by:
checkValidity
in interfaceX509AttributeCertificate
- Throws:
java.security.cert.CertificateExpiredException
java.security.cert.CertificateNotYetValidException
-
checkValidity
public void checkValidity(java.util.Date date) throws java.security.cert.CertificateExpiredException, java.security.cert.CertificateNotYetValidException
- Specified by:
checkValidity
in interfaceX509AttributeCertificate
- Throws:
java.security.cert.CertificateExpiredException
java.security.cert.CertificateNotYetValidException
-
getSignature
public byte[] getSignature()
- Specified by:
getSignature
in interfaceX509AttributeCertificate
-
verify
public final void verify(java.security.PublicKey key, java.lang.String provider) throws java.security.cert.CertificateException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, java.security.NoSuchProviderException, java.security.SignatureException
- Specified by:
verify
in interfaceX509AttributeCertificate
- Throws:
java.security.cert.CertificateException
java.security.NoSuchAlgorithmException
java.security.InvalidKeyException
java.security.NoSuchProviderException
java.security.SignatureException
-
getEncoded
public byte[] getEncoded() throws java.io.IOException
Description copied from interface:X509AttributeCertificate
Return an ASN.1 encoded byte array representing the attribute certificate.- Specified by:
getEncoded
in interfaceX509AttributeCertificate
- Returns:
- an ASN.1 encoded byte array.
- Throws:
java.io.IOException
- if the certificate cannot be encoded.
-
getExtensionValue
public byte[] getExtensionValue(java.lang.String oid)
- Specified by:
getExtensionValue
in interfacejava.security.cert.X509Extension
-
getExtensionOIDs
private java.util.Set getExtensionOIDs(boolean critical)
-
getNonCriticalExtensionOIDs
public java.util.Set getNonCriticalExtensionOIDs()
- Specified by:
getNonCriticalExtensionOIDs
in interfacejava.security.cert.X509Extension
-
getCriticalExtensionOIDs
public java.util.Set getCriticalExtensionOIDs()
- Specified by:
getCriticalExtensionOIDs
in interfacejava.security.cert.X509Extension
-
hasUnsupportedCriticalExtension
public boolean hasUnsupportedCriticalExtension()
- Specified by:
hasUnsupportedCriticalExtension
in interfacejava.security.cert.X509Extension
-
getAttributes
public X509Attribute[] getAttributes()
Description copied from interface:X509AttributeCertificate
Return the attributes contained in the attribute block in the certificate.- Specified by:
getAttributes
in interfaceX509AttributeCertificate
- Returns:
- an array of attributes.
-
getAttributes
public X509Attribute[] getAttributes(java.lang.String oid)
Description copied from interface:X509AttributeCertificate
Return the attributes with the same type as the passed in oid.- Specified by:
getAttributes
in interfaceX509AttributeCertificate
- Parameters:
oid
- the object identifier we wish to match.- Returns:
- an array of matched attributes, null if there is no match.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-