All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.security.cert.X509CRL
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.
inStream
.
issuer
(issuer distinguished name) value from
the CRL.
nextUpdate
date from the CRL.
serialNumber
from the CRL.
signature
value (the raw signature bits) from
the CRL.
tbsCertList
from this CRL.
thisUpdate
date from the CRL.
version
(version number) value from the CRL.
public X509CRL()
public static final X509CRL getInstance(InputStream inStream) throws CRLException, X509ExtensionException
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.
public static final X509CRL getInstance(byte[] crlData) throws CRLException, X509ExtensionException
crl.provider.x509
property in the security properties file.
crlData
.public boolean equals(Object other)
other
object is an
instanceof
X509CRL
, then
its encoded form is retrieved and compared with the
encoded form of this CRL.
public int hashCode()
public abstract byte[] getEncoded() throws CRLException
public abstract void verify(PublicKey key) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
public abstract void verify(PublicKey key, String sigProvider) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
public abstract String toString()
public abstract boolean isRevoked(BigInteger serialNumber)
X509Certificate cert;
X509CRL crl;
...
if (crl.isRevoked(cert.getSerialNumber()))
throw new SensibleException;
else {
doUsefulWork();
}
public abstract int getVersion()
version
(version number) value from the CRL.
The ASN.1 definition for this is:
version Version OPTIONAL, -- if present, must be v2Version ::= INTEGER { v1(0), v2(1), v3(2) } -- v3 does not apply to CRLs but appears for consistency -- with definition of Version for certs
public abstract Principal getIssuerDN()
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 ::= ANYThe
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
.
public abstract Date getThisUpdate()
thisUpdate
date from the CRL.
The ASN.1 definition for this is:
thisUpdate ChoiceOfTime ChoiceOfTime ::= CHOICE { utcTime UTCTime, generalTime GeneralizedTime }
thisUpdate
date from the CRL.public abstract Date getNextUpdate()
nextUpdate
date from the CRL.
nextUpdate
date from the CRL, or null if
not present.public abstract RevokedCertificate getRevokedCertificate(BigInteger serialNumber)
serialNumber
from the CRL.
public abstract Set getRevokedCertificates()
public abstract byte[] getTBSCertList() throws CRLException, X509ExtensionException
tbsCertList
from this CRL.
This can be used to verify the signature independently.
public abstract byte[] getSignature()
signature
value (the raw signature bits) from
the CRL.
The ASN.1 definition for this is:
signature BIT STRING
public abstract String getSigAlgName()
signatureAlgorithm AlgorithmIdentifierAlgorithmIdentifier ::= 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.
public abstract String getSigAlgOID()
See getSigAlgName for relevant ASN.1 definitions.
public abstract byte[] getSigAlgParams()
See getSigAlgName for relevant ASN.1 definitions.
All Packages Class Hierarchy This Package Previous Next Index