All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.security.cert.X509CRL

java.lang.Object
    |
    +----java.security.cert.X509CRL

public abstract class X509CRL
extends Object
implements X509Extension

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  }
 

A good decription and profiling is provided in the IETF PKIX WG draft, Part I: X.509 Certificate and CRL Profile, <draft-ietf-pkix-ipki-part1-06.txt>.

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
     }
 

Here is sample code to instantiate an X509CRL:

 
 InputStream inStream = new FileInputStream("fileName-of-crl");
 X509CRL crl = X509CRL.getInstance(inStream);
 inStream.close();
 
OR

 byte[] crlData = <crl read from a file, say>
 X509CRL crl = X509CRL.getInstance(crlData);
 

In either case, the code that instantiates an X509CRL consults the Java security properties file to locate the actual implementation. The Java security properties file is located in the file named <JAVA_HOME>/lib/security/java.security, where <JAVA_HOME> refers to the directory where the JDK was installed. In the Security properties file, the default implementation for X.509 v2 CRL is given as:

 crl.provider.x509=sun.security.x509.X509CRLImpl
 

The value of this crl.provider.x509 property has to be changed to instantiate another implementation.

See Also:
X509Certificate

Constructor Index

 o X509CRL()

Method Index

 o equals(Object)
Compares this CRL for equality with the specified object.
 o getEncoded()
Returns the ASN.1 DER-encoded form of this CRL.
 o getInstance(byte[])
Instantiates an X509CRL object, and initializes it with the specified byte array.
 o getInstance(InputStream)
Instantiates an X509CRL object, and initializes it with the data read from the input stream inStream.
 o getIssuerDN()
Gets the issuer (issuer distinguished name) value from the CRL.
 o getNextUpdate()
Gets the nextUpdate date from the CRL.
 o getRevokedCertificate(BigInteger)
Gets the revoked certificate with serial number serialNumber from the CRL.
 o getRevokedCertificates()
Gets all the revoked certificates from the CRL.
 o getSigAlgName()
Gets the signature algorithm name for the CRL signature algorithm.
 o getSigAlgOID()
Gets the signature algorithm OID string from the CRL.
 o getSigAlgParams()
Gets the DER-encoded signature algorithm parameters from this CRL's signature algorithm.
 o getSignature()
Gets the signature value (the raw signature bits) from the CRL.
 o getTBSCertList()
Gets the DER-encoded CRL information, the tbsCertList from this CRL.
 o getThisUpdate()
Gets the thisUpdate date from the CRL.
 o getVersion()
Gets the version (version number) value from the CRL.
 o hashCode()
Returns a hashcode value for this CRL from its encoded form.
 o isRevoked(BigInteger)
Checks whether the given serial number is on this CRL.
 o toString()
Returns a string representation of this CRL.
 o verify(PublicKey)
Verifies that this CRL was signed using the private key that corresponds to the specified public key.
 o verify(PublicKey, String)
Verifies that this CRL was signed using the private key that corresponds to the specified public key.

Constructors

 o X509CRL
public X509CRL()

Methods

 o getInstance
public static final X509CRL getInstance(InputStream inStream) throws CRLException, X509ExtensionException
Instantiates an X509CRL object, and initializes it with the data read from the input stream inStream. The implementation (X509CRL is an abstract class) is provided by the class specified as the value of the crl.provider.x509 property in the security properties file.

Note: Only one CRL is expected to be in the input stream.

Parameters:
inStream - an input stream with the data to be read to initialize the CRL.
Returns:
an X509CRL object initialized with the data from the input stream.
Throws: CRLException
if a class initialization or CRL parsing error occurs.
Throws: X509ExtensionException
on extension parsing errors.
 o getInstance
public static final X509CRL getInstance(byte[] crlData) throws CRLException, X509ExtensionException
Instantiates an X509CRL object, and initializes it with the specified byte array. The implementation (X509CRL is an abstract class) is provided by the class specified as the value of the crl.provider.x509 property in the security properties file.

Parameters:
crlData - a byte array containing the DER-encoded CRL.
Returns:
an X509CRL object initialized with the data from crlData.
Throws: CRLException
if a class initialization or CRL parsing error occurs.
Throws: X509ExtensionException
on extension parsing errors.
 o equals
public boolean equals(Object other)
Compares this CRL for equality with the specified 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 - the object to test for equality with this CRL.
Returns:
true iff the encoded forms of the two CRLs match, false otherwise.
Overrides:
equals in class Object
 o hashCode
public int hashCode()
Returns a hashcode value for this CRL from its encoded form.

Returns:
the hashcode value.
Overrides:
hashCode in class Object
 o getEncoded
public abstract byte[] getEncoded() throws CRLException
Returns the ASN.1 DER-encoded form of this CRL.

Throws: CRLException
if an encoding error occurs.
 o verify
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 specified public key.

Parameters:
key - the PublicKey used to carry out the verification.
Throws: NoSuchAlgorithmException
on unsupported signature algorithms.
Throws: InvalidKeyException
on incorrect key.
Throws: NoSuchProviderException
if there's no default provider.
Throws: SignatureException
on signature errors.
Throws: CRLException
on encoding errors.
 o verify
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 specified public key. This method uses the signature verification engine supplied by the specified provider.

Parameters:
key - the PublicKey used to carry out the verification.
sigProvider - the name of the signature provider.
Throws: NoSuchAlgorithmException
on unsupported signature algorithms.
Throws: InvalidKeyException
on incorrect key.
Throws: NoSuchProviderException
on incorrect provider.
Throws: SignatureException
on signature errors.
Throws: CRLException
on encoding errors.
 o toString
public abstract String toString()
Returns a string representation of this CRL.

Returns:
a string representation of this CRL.
Overrides:
toString in class Object
 o isRevoked
public abstract boolean isRevoked(BigInteger serialNumber)
Checks whether the given serial number is on this CRL. Here is sample code to use this:

 X509Certificate cert;
 X509CRL         crl;
 ...
 if (crl.isRevoked(cert.getSerialNumber()))
     throw new SensibleException;
 else {
     doUsefulWork();
 }
 

Parameters:
serialNumber - the number to check for.
Returns:
true if the given serial number is on this CRL, false otherwise.
 o getVersion
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:
the version number.
 o getIssuerDN
public abstract Principal 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:
a Principal whose name is the issuer distinguished name.
 o getThisUpdate
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:
the thisUpdate date from the CRL.
 o getNextUpdate
public abstract Date getNextUpdate()
Gets the nextUpdate date from the CRL.

Returns:
the nextUpdate date from the CRL, or null if not present.
 o getRevokedCertificate
public abstract RevokedCertificate getRevokedCertificate(BigInteger serialNumber)
Gets the revoked certificate with serial number serialNumber from the CRL.

Returns:
the revoked certificate, or null if there is no entry in the CRL marked with the provided serial number.
See Also:
RevokedCertificate
 o getRevokedCertificates
public abstract Set getRevokedCertificates()
Gets all the revoked certificates from the CRL. This returns a Set of RevokedCertificate objects.

Returns:
all the revoked certificates or null if there are none present.
See Also:
RevokedCertificate
 o getTBSCertList
public abstract byte[] getTBSCertList() throws CRLException, X509ExtensionException
Gets the DER-encoded CRL information, the tbsCertList from this CRL. This can be used to verify the signature independently.

Returns:
the DER-encoded CRL information.
Throws: CRLException
if a parsing error occurs.
Throws: X509ExtensionException
on extension parsing errors.
 o getSignature
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:
the signature.
 o getSigAlgName
public abstract String getSigAlgName()
Gets the signature algorithm name for the CRL signature algorithm. An example is the string "SHA-1/DSA". 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:
the signature algorithm name.
 o getSigAlgOID
public abstract String getSigAlgOID()
Gets the signature algorithm OID string from the CRL. An OID is represented by a set of positive whole numbers separated by periods. For example, the string "1.2.840.10040.4.3" identifies the SHA-1 with DSA signature algorithm, as per the PKIX part I.

See getSigAlgName for relevant ASN.1 definitions.

Returns:
the signature algorithm OID string.
 o getSigAlgParams
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:
the DER-encoded signature algorithm parameters, or null if no parameters are present.

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature