Top Description Fields Constructors Methods
org.bouncycastle.jce.provider

public Class X509CRLEntryObject

extends X509CRLEntry
Class Inheritance
Imports
java.io.IOException, java.math.BigInteger, java.security.cert.CRLException, .X509CRLEntry, java.util.Date, .Enumeration, .HashSet, .Set, javax.security.auth.x500.X500Principal, org.bouncycastle.asn1.ASN1Encoding, .ASN1Enumerated, .ASN1InputStream, .ASN1ObjectIdentifier, org.bouncycastle.asn1.util.ASN1Dump, org.bouncycastle.asn1.x500.X500Name, org.bouncycastle.asn1.x509.CRLReason, .Extension, .Extensions, .GeneralName, .GeneralNames, .TBSCertList, org.bouncycastle.util.Strings

The following extensions are listed in RFC 2459 as relevant to CRL Entries ReasonCode Hode Instruction Code Invalidity Date Certificate Issuer (critical)

Field Summary

Modifier and TypeField and Description
private TBSCertList.CRLEntry
c

private X500Name
private int
private boolean

Constructor Summary

AccessConstructor and Description
public
public
X509CRLEntryObject(TBSCertList.CRLEntry
TBSCertList.CRLEntry object.
c
,
boolean
true if the corresponding CRL is a indirect CRL.
isIndirect
,
X500Name
Certificate issuer of the previous CRLEntry.
previousCertificateIssuer
)

Constructor for CRLEntries of indirect CRLs.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the object to test for equality with this CRL entry.
o
)

Overrides java.security.cert.X509CRLEntry.equals.

Compares this CRL entry for equality with the given object.

public X500Principal
getCertificateIssuer()

Overrides java.security.cert.X509CRLEntry.getCertificateIssuer.

Get the issuer of the X509Certificate described by this entry.

public Set<E>
getCriticalExtensionOIDs()

Implements java.security.cert.X509Extension.getCriticalExtensionOIDs.

Gets a Set of the OID strings for the extension(s) marked CRITICAL in the certificate/CRL managed by the object implementing this interface.

public byte[]
getEncoded()

Implements abstract java.security.cert.X509CRLEntry.getEncoded.

Returns the ASN.1 DER-encoded form of this CRL Entry, that is the inner SEQUENCE.

private Extension
private Set<E>
getExtensionOIDs(boolean critical)

public byte[]
getExtensionValue(String
the Object Identifier value for the extension.
oid
)

Implements java.security.cert.X509Extension.getExtensionValue.

Gets the DER-encoded OCTET string for the extension value (extnValue) identified by the passed-in oid String.

public Set<E>
getNonCriticalExtensionOIDs()

Implements java.security.cert.X509Extension.getNonCriticalExtensionOIDs.

Gets a Set of the OID strings for the extension(s) marked NON-CRITICAL in the certificate/CRL managed by the object implementing this interface.

public Date
getRevocationDate()

Implements abstract java.security.cert.X509CRLEntry.getRevocationDate.

Gets the revocation date from this X509CRLEntry, the revocationDate.

public BigInteger
getSerialNumber()

Implements abstract java.security.cert.X509CRLEntry.getSerialNumber.

Gets the serial number from this X509CRLEntry, the userCertificate.

public boolean
hasExtensions()

Implements abstract java.security.cert.X509CRLEntry.hasExtensions.

Returns true if this CRL entry has extensions.

public int

Returns:

calculated hashCode.
hashCode
()

Overrides java.security.cert.X509CRLEntry.hashCode.

Cache the hashCode value - calculating it with the standard method.

public boolean
hasUnsupportedCriticalExtension()

Implements java.security.cert.X509Extension.hasUnsupportedCriticalExtension.

Will return true if any extensions are present and marked as critical as we currently don't handle any extensions!

private X500Name
loadCertificateIssuer(boolean isIndirect, X500Name previousCertificateIssuer)

public String
toString()

Implements abstract java.security.cert.X509CRLEntry.toString.

Returns a string representation of this CRL entry.

Inherited from java.security.cert.X509CRLEntry:
getRevocationReason

Field Detail

cback to summary
private TBSCertList.CRLEntry c
certificateIssuerback to summary
private X500Name certificateIssuer
hashValueback to summary
private int hashValue
isHashValueSetback to summary
private boolean isHashValueSet

Constructor Detail

X509CRLEntryObjectback to summary
public X509CRLEntryObject(TBSCertList.CRLEntry c)
X509CRLEntryObjectback to summary
public X509CRLEntryObject(TBSCertList.CRLEntry c, boolean isIndirect, X500Name previousCertificateIssuer)

Constructor for CRLEntries of indirect CRLs. If isIndirect is false getCertificateIssuer() will always return null, previousCertificateIssuer is ignored. If this isIndirect is specified and this CRLEntry has no certificate issuer CRL entry extension previousCertificateIssuer is returned by getCertificateIssuer().

Parameters
c:TBSCertList.CRLEntry

TBSCertList.CRLEntry object.

isIndirect:boolean

true if the corresponding CRL is a indirect CRL.

previousCertificateIssuer:X500Name

Certificate issuer of the previous CRLEntry.

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.security.cert.X509CRLEntry.equals.

Doc from java.security.cert.X509CRLEntry.equals.

Compares this CRL entry for equality with the given object. If the other object is an instanceof X509CRLEntry, then its encoded form (the inner SEQUENCE) is retrieved and compared with the encoded form of this CRL entry.

Parameters
o:Object

the object to test for equality with this CRL entry.

Returns:boolean

true iff the encoded forms of the two CRL entries match, false otherwise.

getCertificateIssuerback to summary
public X500Principal getCertificateIssuer()

Overrides java.security.cert.X509CRLEntry.getCertificateIssuer.

Doc from java.security.cert.X509CRLEntry.getCertificateIssuer.

Get the issuer of the X509Certificate described by this entry. If the certificate issuer is also the CRL issuer, this method returns null.

This method is used with indirect CRLs. The default implementation always returns null. Subclasses that wish to support indirect CRLs should override it.

Returns:X500Principal

the issuer of the X509Certificate described by this entry or null if it is issued by the CRL issuer.

getCriticalExtensionOIDsback to summary
public Set<E> getCriticalExtensionOIDs()

Implements java.security.cert.X509Extension.getCriticalExtensionOIDs.

Doc from java.security.cert.X509Extension.getCriticalExtensionOIDs.

Gets a Set of the OID strings for the extension(s) marked CRITICAL in the certificate/CRL managed by the object implementing this interface. Here is sample code to get a Set of critical extensions from an X509Certificate and print the OIDs:

X509Certificate cert = null;
try (InputStream inStrm = new FileInputStream("DER-encoded-Cert")) {
    CertificateFactory cf = CertificateFactory.getInstance("X.509");
    cert = (X509Certificate)cf.generateCertificate(inStrm);
}

Set<String> critSet = cert.getCriticalExtensionOIDs();
if (critSet != null && !critSet.isEmpty()) {
    System.out.println("Set of critical extensions:");
    for (String oid : critSet) {
        System.out.println(oid);
    }
}
Returns:Set<E>

a Set (or an empty Set if none are marked critical) of the extension OID strings for extensions that are marked critical. If there are no extensions present at all, then this method returns null.

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

Implements abstract java.security.cert.X509CRLEntry.getEncoded.

Doc from java.security.cert.X509CRLEntry.getEncoded.

Returns the ASN.1 DER-encoded form of this CRL Entry, that is the inner SEQUENCE.

Returns:byte[]

the encoded form of this certificate

Exceptions
CRLException:
if an encoding error occurs.
getExtensionback to summary
private Extension getExtension(ASN1ObjectIdentifier oid)
getExtensionOIDsback to summary
private Set<E> getExtensionOIDs(boolean critical)
getExtensionValueback to summary
public byte[] getExtensionValue(String oid)

Implements java.security.cert.X509Extension.getExtensionValue.

Doc from java.security.cert.X509Extension.getExtensionValue.

Gets the DER-encoded OCTET string for the extension value (extnValue) identified by the passed-in oid String. The oid string is represented by a set of nonnegative whole numbers separated by periods.

For example:

Examples of OIDs and extension names
OID (Object Identifier) Extension Name
1.3.6.1.5.5.7.1.1 AuthorityInformationAccess
2.5.29.14 SubjectKeyIdentifier
2.5.29.15 KeyUsage
2.5.29.17 SubjectAlternativeName
2.5.29.18 IssuerAlternativeName
2.5.29.19 BasicConstraints
2.5.29.30 NameConstraints
2.5.29.31 CRLDistributionPoints
2.5.29.32 CertificatePolicies
2.5.29.33 PolicyMappings
2.5.29.35 AuthorityKeyIdentifier
2.5.29.36 PolicyConstraints
2.5.29.37 ExtendedKeyUsage
Parameters
oid:String

the Object Identifier value for the extension.

Returns:byte[]

the DER-encoded octet string of the extension value or null if it is not present.

getNonCriticalExtensionOIDsback to summary
public Set<E> getNonCriticalExtensionOIDs()

Implements java.security.cert.X509Extension.getNonCriticalExtensionOIDs.

Doc from java.security.cert.X509Extension.getNonCriticalExtensionOIDs.

Gets a Set of the OID strings for the extension(s) marked NON-CRITICAL in the certificate/CRL managed by the object implementing this interface. Here is sample code to get a Set of non-critical extensions from an X509CRL revoked certificate entry and print the OIDs:

CertificateFactory cf = null;
X509CRL crl = null;
try (InputStream inStrm = new FileInputStream("DER-encoded-CRL")) {
    cf = CertificateFactory.getInstance("X.509");
    crl = (X509CRL)cf.generateCRL(inStrm);
}

byte[] certData = <DER-encoded certificate data>
ByteArrayInputStream bais = new ByteArrayInputStream(certData);
X509Certificate cert = (X509Certificate)cf.generateCertificate(bais);
X509CRLEntry badCert =
             crl.getRevokedCertificate(cert.getSerialNumber());

if (badCert != null) {
    Set<String> nonCritSet = badCert.getNonCriticalExtensionOIDs();
    if (nonCritSet != null)
        for (String oid : nonCritSet) {
            System.out.println(oid);
        }
}
Returns:Set<E>

a Set (or an empty Set if none are marked non-critical) of the extension OID strings for extensions that are marked non-critical. If there are no extensions present at all, then this method returns null.

getRevocationDateback to summary
public Date getRevocationDate()

Implements abstract java.security.cert.X509CRLEntry.getRevocationDate.

Doc from java.security.cert.X509CRLEntry.getRevocationDate.

Gets the revocation date from this X509CRLEntry, the revocationDate.

Returns:Date

the revocation date.

getSerialNumberback to summary
public BigInteger getSerialNumber()

Implements abstract java.security.cert.X509CRLEntry.getSerialNumber.

Doc from java.security.cert.X509CRLEntry.getSerialNumber.

Gets the serial number from this X509CRLEntry, the userCertificate.

Returns:BigInteger

the serial number.

hasExtensionsback to summary
public boolean hasExtensions()

Implements abstract java.security.cert.X509CRLEntry.hasExtensions.

Doc from java.security.cert.X509CRLEntry.hasExtensions.

Returns true if this CRL entry has extensions.

Returns:boolean

true if this entry has extensions, false otherwise.

hashCodeback to summary
public int hashCode()

Overrides java.security.cert.X509CRLEntry.hashCode.

Cache the hashCode value - calculating it with the standard method.

Returns:int

calculated hashCode.

hasUnsupportedCriticalExtensionback to summary
public boolean hasUnsupportedCriticalExtension()

Implements java.security.cert.X509Extension.hasUnsupportedCriticalExtension.

Will return true if any extensions are present and marked as critical as we currently don't handle any extensions!

Returns:boolean

Doc from java.security.cert.X509Extension.hasUnsupportedCriticalExtension.

true if a critical extension is found that is not supported, otherwise false.

loadCertificateIssuerback to summary
private X500Name loadCertificateIssuer(boolean isIndirect, X500Name previousCertificateIssuer)
toStringback to summary
public String toString()

Implements abstract java.security.cert.X509CRLEntry.toString.

Doc from java.security.cert.X509CRLEntry.toString.

Returns a string representation of this CRL entry.

Returns:String

a string representation of this CRL entry.