Top Description Fields Constructors Methods
java.security.cert

public abstract Class X509CRL

extends CRL
implements X509Extension
Class Inheritance
All Implemented Interfaces
java.security.cert.X509Extension
Known Direct Subclasses
sun.security.x509.X509CRLImpl
Imports
sun.security.util.SignatureUtil, sun.security.x509.X509CRLImpl, javax.security.auth.x500.X500Principal, java.math.BigInteger, java.security.*, java.util.Arrays, .Date, .Set

Abstract class for an X.509 Certificate Revocation List (CRL). A CRL is a time-stamped list identifying revoked certificates. It is signed by a Certificate Authority (CA) and made freely available in a public repository.

Each revoked certificate is identified in a CRL by its certificate serial number. When a certificate-using system uses a certificate (e.g., for verifying a remote user's digital signature), that system not only checks the certificate signature and validity but also acquires a suitably- recent CRL and checks that the certificate serial number is not on that CRL. The meaning of "suitably-recent" may vary with local policy, but it usually means the most recently-issued CRL. A CA issues a new CRL on a regular periodic basis (e.g., hourly, daily, or weekly). Entries are added to CRLs as revocations occur, and an entry may be removed when the certificate expiration date is reached.

The X.509 v2 CRL format is described below in ASN.1:

CertificateList  ::=  SEQUENCE  {
    tbsCertList          TBSCertList,
    signatureAlgorithm   AlgorithmIdentifier,
    signature            BIT STRING  }

More information can be found in RFC 5280: Internet X.509 Public Key Infrastructure Certificate and CRL Profile.

The ASN.1 definition of tbsCertList is:

TBSCertList  ::=  SEQUENCE  {
    version                 Version OPTIONAL,
                            -- if present, must be v2
    signature               AlgorithmIdentifier,
    issuer                  Name,
    thisUpdate              ChoiceOfTime,
    nextUpdate              ChoiceOfTime OPTIONAL,
    revokedCertificates     SEQUENCE OF SEQUENCE  {
        userCertificate         CertificateSerialNumber,
        revocationDate          ChoiceOfTime,
        crlEntryExtensions      Extensions OPTIONAL
                                -- if present, must be v2
        }  OPTIONAL,
    crlExtensions           [0]  EXPLICIT Extensions OPTIONAL
                                 -- if present, must be v2
    }

CRLs are instantiated using a certificate factory. The following is an example of how to instantiate an X.509 CRL:

try (InputStream inStream = new FileInputStream("fileName-of-crl")) {
    CertificateFactory cf = CertificateFactory.getInstance("X.509");
    X509CRL crl = (X509CRL)cf.generateCRL(inStream);
}
Author
Hemma Prafullchandra
Since
1.2
See Also
CRL, CertificateFactory, X509Extension

Field Summary

Modifier and TypeField and Description
private transient X500Principal

Constructor Summary

AccessConstructor and Description
protected
X509CRL()

Constructor for X.509 CRLs.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true iff the encoded forms of the two CRLs match, false otherwise.
equals
(Object
the object to test for equality with this CRL.
other
)

Overrides java.lang.Object.equals.

Compares this CRL for equality with the given object.
public abstract byte[]

Returns:

the encoded form of this certificate
getEncoded
()

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

public abstract Principal

Returns:

a Principal whose name is the issuer distinguished name.
getIssuerDN
()

Deprecated since 16. Use getIssuerX500Principal instead.
Gets the issuer (issuer distinguished name) value from the CRL.
public X500Principal

Returns:

an X500Principal representing the issuer distinguished name
getIssuerX500Principal
()

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

public abstract Date

Returns:

the nextUpdate date from the CRL, or null if not present.
getNextUpdate
()

Gets the nextUpdate date from the CRL.

public abstract X509CRLEntry

Returns:

the entry with the given serial number, or null if no such entry exists in this CRL.
getRevokedCertificate
(BigInteger
the serial number of the certificate for which a CRL entry is to be looked up
serialNumber
)

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

public X509CRLEntry

Returns:

the entry for the given certificate, or null if no such entry exists in this CRL.
getRevokedCertificate
(X509Certificate
the certificate for which a CRL entry is to be looked up
certificate
)

Get the CRL entry, if any, for the given certificate.

public abstract Set<? extends X509CRLEntry>

Returns:

all the entries or null if there are none present.
getRevokedCertificates
()

Gets all the entries from this CRL.

public abstract String

Returns:

the signature algorithm name.
getSigAlgName
()

Gets the signature algorithm name for the CRL signature algorithm.

public abstract String

Returns:

the signature algorithm OID string.
getSigAlgOID
()

Gets the signature algorithm OID string from the CRL.

public abstract byte[]

Returns:

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

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

public abstract byte[]

Returns:

the signature.
getSignature
()

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

public abstract byte[]

Returns:

the DER-encoded CRL information.
getTBSCertList
()

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

public abstract Date

Returns:

the thisUpdate date from the CRL.
getThisUpdate
()

Gets the thisUpdate date from the CRL.

public abstract int

Returns:

the version number, i.e. 1 or 2.
getVersion
()

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

public int

Returns:

a hashcode value for this CRL from its encoded form
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hashcode value for this CRL from its encoded form.
public abstract void
verify(PublicKey
the PublicKey used to carry out the verification.
key
)

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

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

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
)

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

Inherited from java.security.cert.CRL:
getTypeisRevokedtoString

Field Detail

issuerPrincipalback to summary
private transient X500Principal issuerPrincipal

Constructor Detail

X509CRLback to summary
protected X509CRL()

Constructor for X.509 CRLs.

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.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.

Annotations
@Override
getEncodedback to summary
public abstract byte[] getEncoded() throws CRLException

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.
getIssuerDNback to summary
public abstract Principal getIssuerDN()

Deprecated

since 16.

Use getIssuerX500Principal instead. This method returns the issuer as an implementation specific Principal object, which should not be relied upon by portable code.

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.

Annotations
@Deprecated
since:16
getIssuerX500Principalback to summary
public X500Principal 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

Since
1.4
getNextUpdateback to summary
public abstract Date getNextUpdate()

Gets the nextUpdate date from the CRL.

Returns:Date

the nextUpdate date from the CRL, or null if not present.

getRevokedCertificateback to summary
public abstract X509CRLEntry getRevokedCertificate(BigInteger serialNumber)

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.

See Also
X509CRLEntry
getRevokedCertificateback to summary
public X509CRLEntry getRevokedCertificate(X509Certificate certificate)

Get the CRL entry, if any, for the given certificate.

This method can be used to lookup CRL entries in indirect CRLs, that means CRLs that contain entries from issuers other than the CRL issuer. The default implementation will only return entries for certificates issued by the CRL issuer. Subclasses that wish to support indirect CRLs should override this method.

Parameters
certificate:X509Certificate

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

Returns:X509CRLEntry

the entry for the given certificate, or null if no such entry exists in this CRL.

Exceptions
NullPointerException:
if certificate is null
Since
1.5
getRevokedCertificatesback to summary
public abstract Set<? extends X509CRLEntry> getRevokedCertificates()

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

Returns:Set<? extends X509CRLEntry>

all the entries or null if there are none present.

See Also
X509CRLEntry
getSigAlgNameback to summary
public abstract String 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 abstract String 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 abstract byte[] 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 abstract byte[] 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 abstract byte[] getTBSCertList() throws CRLException

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 abstract Date 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 abstract int 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.lang.Object.hashCode.

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

Returns:int

a hashcode value for this CRL from its encoded form

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

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 abstract void verify(PublicKey key, String sigProvider) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException

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

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.
Since
1.8