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

public Class X509CRLObject

extends X509CRL
Class Inheritance
Imports
java.io.IOException, java.math.BigInteger, java.security.InvalidKeyException, .NoSuchAlgorithmException, .NoSuchProviderException, .Principal, .Provider, .PublicKey, .Signature, .SignatureException, java.security.cert.CRLException, .Certificate, .CertificateEncodingException, .X509CRL, .X509CRLEntry, .X509Certificate, java.util.Collections, .Date, .Enumeration, .HashSet, .Iterator, .Set, javax.security.auth.x500.X500Principal, org.bouncycastle.asn1.ASN1Encodable, .ASN1Encoding, .ASN1InputStream, .ASN1Integer, .ASN1ObjectIdentifier, .ASN1OctetString, org.bouncycastle.asn1.util.ASN1Dump, org.bouncycastle.asn1.x500.X500Name, org.bouncycastle.asn1.x509.CRLDistPoint, .CRLNumber, .CertificateList, .Extension, .Extensions, .GeneralNames, .IssuingDistributionPoint, .TBSCertList, org.bouncycastle.jce.X509Principal, org.bouncycastle.util.Strings, org.bouncycastle.util.encoders.Hex

Deprecated

Do not use this class directly - either use org.bouncycastle.cert (bcpkix) or CertificateFactory.

The following extensions are listed in RFC 2459 as relevant to CRLs Authority Key Identifier Issuer Alternative Name CRL Number Delta CRL Indicator (critical) Issuing Distribution Point (critical)

Field Summary

Modifier and TypeField and Description
private CertificateList
c

private int
private boolean
private boolean
private String
private byte[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

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

Overrides java.security.cert.X509CRL.equals.

Compares this CRL for equality with the given object.

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.X509CRL.getEncoded.

Returns the ASN.1 DER-encoded form of this CRL.

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 Principal
getIssuerDN()

Implements abstract java.security.cert.X509CRL.getIssuerDN.

Gets the issuer (issuer distinguished name) value from the CRL.

public X500Principal
getIssuerX500Principal()

Overrides java.security.cert.X509CRL.getIssuerX500Principal.

Returns the issuer (issuer distinguished name) value from the CRL as an X500Principal.

public Date
getNextUpdate()

Implements abstract java.security.cert.X509CRL.getNextUpdate.

Gets the nextUpdate date from the CRL.

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 X509CRLEntry
getRevokedCertificate(BigInteger
the serial number of the certificate for which a CRL entry is to be looked up
serialNumber
)

Implements abstract java.security.cert.X509CRL.getRevokedCertificate.

Gets the CRL entry, if any, with the given certificate serialNumber.

public Set<E>
getRevokedCertificates()

Implements abstract java.security.cert.X509CRL.getRevokedCertificates.

Gets all the entries from this CRL.

public String
getSigAlgName()

Implements abstract java.security.cert.X509CRL.getSigAlgName.

Gets the signature algorithm name for the CRL signature algorithm.

public String
getSigAlgOID()

Implements abstract java.security.cert.X509CRL.getSigAlgOID.

Gets the signature algorithm OID string from the CRL.

public byte[]
getSigAlgParams()

Implements abstract java.security.cert.X509CRL.getSigAlgParams.

Gets the DER-encoded signature algorithm parameters from this CRL's signature algorithm.

public byte[]
getSignature()

Implements abstract java.security.cert.X509CRL.getSignature.

Gets the signature value (the raw signature bits) from the CRL.

public byte[]
getTBSCertList()

Implements abstract java.security.cert.X509CRL.getTBSCertList.

Gets the DER-encoded CRL information, the tbsCertList from this CRL.

public Date
getThisUpdate()

Implements abstract java.security.cert.X509CRL.getThisUpdate.

Gets the thisUpdate date from the CRL.

public int
getVersion()

Implements abstract java.security.cert.X509CRL.getVersion.

Gets the version (version number) value from the CRL.

public int
hashCode()

Overrides java.security.cert.X509CRL.hashCode.

Returns a hashcode value for this CRL from its encoded form.

public boolean
hasUnsupportedCriticalExtension()

Implements java.security.cert.X509Extension.hasUnsupportedCriticalExtension.

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

public static boolean
public boolean

Returns:

true if the given certificate is on this CRL, false otherwise.
isRevoked
(Certificate
the certificate to check for.
cert
)

Implements abstract java.security.cert.CRL.isRevoked.

Checks whether the given certificate is on this CRL.

private Set<E>
public String

Returns:

a string representation of this CRL.
toString
()

Implements abstract java.security.cert.CRL.toString.

Returns a string representation of this CRL.

public void
verify(PublicKey
the PublicKey used to carry out the verification.
key
)

Implements abstract java.security.cert.X509CRL.verify.

Verifies that this CRL was signed using the private key that corresponds to the given public key.

public void
verify(PublicKey
the PublicKey used to carry out the verification.
key
,
String
the name of the signature provider.
sigProvider
)

Implements abstract java.security.cert.X509CRL.verify.

Verifies that this CRL was signed using the private key that corresponds to the given public key.

public void
verify(PublicKey
the PublicKey used to carry out the verification.
key
,
Provider
the signature provider.
sigProvider
)

Overrides java.security.cert.X509CRL.verify.

Verifies that this CRL was signed using the private key that corresponds to the given public key.

Inherited from java.security.cert.X509CRL:
getRevokedCertificate

Field Detail

cback to summary
private CertificateList c
hashCodeValueback to summary
private int hashCodeValue
isHashCodeSetback to summary
private boolean isHashCodeSet
isIndirectback to summary
private boolean isIndirect
sigAlgNameback to summary
private String sigAlgName
sigAlgParamsback to summary
private byte[] sigAlgParams

Constructor Detail

X509CRLObjectback to summary
public X509CRLObject(CertificateList c) throws CRLException

Method Detail

doVerifyback to summary
private void doVerify(PublicKey key, Signature sig) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, SignatureException
equalsback to summary
public boolean equals(Object other)

Overrides java.security.cert.X509CRL.equals.

Doc from java.security.cert.X509CRL.equals.

Compares this CRL for equality with the given object. If the other object is an instanceof X509CRL, then its encoded form is retrieved and compared with the encoded form of this CRL.

Parameters
other:Object

the object to test for equality with this CRL.

Returns:boolean

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

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.X509CRL.getEncoded.

Doc from java.security.cert.X509CRL.getEncoded.

Returns the ASN.1 DER-encoded form of this CRL.

Returns:byte[]

the encoded form of this certificate

Exceptions
CRLException:
if an encoding error occurs.
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.

getIssuerDNback to summary
public Principal getIssuerDN()

Implements abstract java.security.cert.X509CRL.getIssuerDN.

Doc from java.security.cert.X509CRL.getIssuerDN.

Gets the issuer (issuer distinguished name) value from the CRL. The issuer name identifies the entity that signed (and issued) the CRL.

The issuer name field contains an X.500 distinguished name (DN). The ASN.1 definition for this is:

issuer    Name

Name ::= CHOICE { RDNSequence }
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
RelativeDistinguishedName ::=
    SET OF AttributeValueAssertion

AttributeValueAssertion ::= SEQUENCE {
                              AttributeType,
                              AttributeValue }
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY
The Name describes a hierarchical name composed of attributes, such as country name, and corresponding values, such as US. The type of the AttributeValue component is determined by the AttributeType; in general it will be a directoryString. A directoryString is usually one of PrintableString, TeletexString or UniversalString.
Returns:Principal

a Principal whose name is the issuer distinguished name.

getIssuerX500Principalback to summary
public X500Principal getIssuerX500Principal()

Overrides java.security.cert.X509CRL.getIssuerX500Principal.

Doc from java.security.cert.X509CRL.getIssuerX500Principal.

Returns the issuer (issuer distinguished name) value from the CRL as an X500Principal.

It is recommended that subclasses override this method.

Returns:X500Principal

an X500Principal representing the issuer distinguished name

getNextUpdateback to summary
public Date getNextUpdate()

Implements abstract java.security.cert.X509CRL.getNextUpdate.

Doc from java.security.cert.X509CRL.getNextUpdate.

Gets the nextUpdate date from the CRL.

Returns:Date

the nextUpdate date from the CRL, or null if 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.

getRevokedCertificateback to summary
public X509CRLEntry getRevokedCertificate(BigInteger serialNumber)

Implements abstract java.security.cert.X509CRL.getRevokedCertificate.

Doc from java.security.cert.X509CRL.getRevokedCertificate.

Gets the CRL entry, if any, with the given certificate serialNumber.

Parameters
serialNumber:BigInteger

the serial number of the certificate for which a CRL entry is to be looked up

Returns:X509CRLEntry

the entry with the given serial number, or null if no such entry exists in this CRL.

getRevokedCertificatesback to summary
public Set<E> getRevokedCertificates()

Implements abstract java.security.cert.X509CRL.getRevokedCertificates.

Doc from java.security.cert.X509CRL.getRevokedCertificates.

Gets all the entries from this CRL. This returns a Set of X509CRLEntry objects.

Returns:Set<E>

all the entries or null if there are none present.

getSigAlgNameback to summary
public String getSigAlgName()

Implements abstract java.security.cert.X509CRL.getSigAlgName.

Doc from java.security.cert.X509CRL.getSigAlgName.

Gets the signature algorithm name for the CRL signature algorithm. An example is the string "SHA256withRSA". The ASN.1 definition for this is:

signatureAlgorithm   AlgorithmIdentifier

AlgorithmIdentifier  ::=  SEQUENCE  {
    algorithm               OBJECT IDENTIFIER,
    parameters              ANY DEFINED BY algorithm OPTIONAL  }
                            -- contains a value of the type
                            -- registered for use with the
                            -- algorithm object identifier value

The algorithm name is determined from the algorithm OID string.

Returns:String

the signature algorithm name.

getSigAlgOIDback to summary
public String getSigAlgOID()

Implements abstract java.security.cert.X509CRL.getSigAlgOID.

Doc from java.security.cert.X509CRL.getSigAlgOID.

Gets the signature algorithm OID string from the CRL. An OID is represented by a set of nonnegative whole numbers separated by periods. For example, the string "1.2.840.10040.4.3" identifies the SHA-1 with DSA signature algorithm defined in RFC 3279: Algorithms and Identifiers for the Internet X.509 Public Key Infrastructure Certificate and CRL Profile.

See getSigAlgName for relevant ASN.1 definitions.

Returns:String

the signature algorithm OID string.

getSigAlgParamsback to summary
public byte[] getSigAlgParams()

Implements abstract java.security.cert.X509CRL.getSigAlgParams.

Doc from java.security.cert.X509CRL.getSigAlgParams.

Gets the DER-encoded signature algorithm parameters from this CRL's signature algorithm. In most cases, the signature algorithm parameters are null; the parameters are usually supplied with the public key. If access to individual parameter values is needed then use AlgorithmParameters and instantiate with the name returned by getSigAlgName.

See getSigAlgName for relevant ASN.1 definitions.

Returns:byte[]

the DER-encoded signature algorithm parameters, or null if no parameters are present.

getSignatureback to summary
public byte[] getSignature()

Implements abstract java.security.cert.X509CRL.getSignature.

Doc from java.security.cert.X509CRL.getSignature.

Gets the signature value (the raw signature bits) from the CRL. The ASN.1 definition for this is:

signature     BIT STRING
Returns:byte[]

the signature.

getTBSCertListback to summary
public byte[] getTBSCertList() throws CRLException

Implements abstract java.security.cert.X509CRL.getTBSCertList.

Doc from java.security.cert.X509CRL.getTBSCertList.

Gets the DER-encoded CRL information, the tbsCertList from this CRL. This can be used to verify the signature independently.

Returns:byte[]

the DER-encoded CRL information.

Exceptions
CRLException:
if an encoding error occurs.
getThisUpdateback to summary
public Date getThisUpdate()

Implements abstract java.security.cert.X509CRL.getThisUpdate.

Doc from java.security.cert.X509CRL.getThisUpdate.

Gets the thisUpdate date from the CRL. The ASN.1 definition for this is:

thisUpdate   ChoiceOfTime
ChoiceOfTime ::= CHOICE {
    utcTime        UTCTime,
    generalTime    GeneralizedTime }
Returns:Date

the thisUpdate date from the CRL.

getVersionback to summary
public int getVersion()

Implements abstract java.security.cert.X509CRL.getVersion.

Doc from java.security.cert.X509CRL.getVersion.

Gets the version (version number) value from the CRL. The ASN.1 definition for this is:

version    Version OPTIONAL,
            -- if present, must be v2

Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  }
            -- v3 does not apply to CRLs but appears for consistency
            -- with definition of Version for certs
Returns:int

the version number, i.e. 1 or 2.

hashCodeback to summary
public int hashCode()

Overrides java.security.cert.X509CRL.hashCode.

Doc from java.security.cert.X509CRL.hashCode.

Returns a hashcode value for this CRL from its encoded form.

Returns:int

a hashcode value for this CRL from its encoded form

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 dont 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.

isIndirectCRLback to summary
public static boolean isIndirectCRL(X509CRL crl) throws CRLException
isRevokedback to summary
public boolean isRevoked(Certificate cert)

Implements abstract java.security.cert.CRL.isRevoked.

Checks whether the given certificate is on this CRL.

Parameters
cert:Certificate

the certificate to check for.

Returns:boolean

true if the given certificate is on this CRL, false otherwise.

loadCRLEntriesback to summary
private Set<E> loadCRLEntries()
toStringback to summary
public String toString()

Implements abstract java.security.cert.CRL.toString.

Returns a string representation of this CRL.

Returns:String

a string representation of this CRL.

verifyback to summary
public void verify(PublicKey key) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException

Implements abstract java.security.cert.X509CRL.verify.

Doc from java.security.cert.X509CRL.verify.

Verifies that this CRL was signed using the private key that corresponds to the given public key.

Parameters
key:PublicKey

the PublicKey used to carry out the verification.

Exceptions
CRLException:
on encoding errors.
NoSuchAlgorithmException:
on unsupported signature algorithms.
InvalidKeyException:
on incorrect key.
NoSuchProviderException:
if there's no default provider.
SignatureException:
on signature errors.
verifyback to summary
public void verify(PublicKey key, String sigProvider) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException

Implements abstract java.security.cert.X509CRL.verify.

Doc from java.security.cert.X509CRL.verify.

Verifies that this CRL was signed using the private key that corresponds to the given public key. This method uses the signature verification engine supplied by the given provider.

Parameters
key:PublicKey

the PublicKey used to carry out the verification.

sigProvider:String

the name of the signature provider.

Exceptions
CRLException:
on encoding errors.
NoSuchAlgorithmException:
on unsupported signature algorithms.
InvalidKeyException:
on incorrect key.
NoSuchProviderException:
on incorrect provider.
SignatureException:
on signature errors.
verifyback to summary
public void verify(PublicKey key, Provider sigProvider) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, SignatureException

Overrides java.security.cert.X509CRL.verify.

Doc from java.security.cert.X509CRL.verify.

Verifies that this CRL was signed using the private key that corresponds to the given public key. This method uses the signature verification engine supplied by the given provider. Note that the specified Provider object does not have to be registered in the provider list. This method was added to version 1.8 of the Java Platform Standard Edition. In order to maintain backwards compatibility with existing service providers, this method is not abstract and it provides a default implementation.

Parameters
key:PublicKey

the PublicKey used to carry out the verification.

sigProvider:Provider

the signature provider.

Exceptions
CRLException:
on encoding errors.
NoSuchAlgorithmException:
on unsupported signature algorithms.
InvalidKeyException:
on incorrect key.
SignatureException:
on signature errors.