|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.security.cert.CRL | +--java.security.cert.X509CRL | +--iaik.x509.X509CRL
This class represents a X.509v2 CertificateRevocationList (CRL).
A Certificate Revocation List (CRL) denotes a list of certificates that have been expired for some reason (e.g. the name of the subject has changed, the private key can no more being treated to be only known by the subject, ...) prior to the regular ending of its validity period. A CRL is maintained by a certification authority (CA) making it publicly available and refreshing it in certain time intervals. Each recoked certificate included in a revocation list can be identified by its serial number. The recvocation list is signed by the maintaining CA.
A profile for X.509v2 revocation lists is presented together with the X.509v3 certificate format in RFC 2459, where a CRL is defined as an ASN.1 SEQUENCE structure containing the following components:
CertificateList ::= SEQUENCE { tbsCertList TBSCertList, signatureAlgorithm AlgorithmIdentifier, signatureValue BIT STRING }
where signatureAlgorithm identifies the signature algorithm used by
the signing certification authority for computing the digital signature upon
the ASN.1 DER encoded TBSCertList
structure, which itself is
expressed as ASN.1 SEQUENCE structure specifying the (distinguished) name of
the issuer, the issue date of the CRL, the date when the next CRL will be issued,
and optionally lists of revoked certificates (identified by their serial numbers)
and CRL extensions. The list of revoked certificates is classified as being optional
since a CA may not have revoked any issued certificate when publishing a CRL.
ASN.1 definition:
TBSCertList ::= SEQUENCE { version Version OPTIONAL, -- if present, must be v2 signature AlgorithmIdentifier, issuer Name, thisUpdate Time, nextUpdate Time OPTIONAL, revokedCertificates SEQUENCE OF SEQUENCE { userCertificate CertificateSerialNumber, revocationDate Time, crlEntryExtensions Extensions OPTIONAL -- if present, must be v2 } OPTIONAL, crlExtensions [0] EXPLICIT Extensions OPTIONAL -- if present, must be v2 }
where:
Version ::= INTEGER { v1(0), v2(1), v3(2) } -- v3 does not apply to CRLs but appears for consistency -- with definition of Version for certs
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
Name ::= CHOICE { RDNSequence }
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
RelativeDistinguishedName ::= SET OF AttributeTypeAndValue
AttributeTypeAndValue ::= SEQUENCE { type AttributeType, value AttributeValue }
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY -- Directory string type --
DirectoryString ::= CHOICE { teletexString TeletexString (SIZE (1..maxSize), printableString PrintableString (SIZE (1..maxSize)), universalString UniversalString (SIZE (1..maxSize)), bmpString BMPString (SIZE(1..maxSIZE)) }
Time ::= CHOICE { utcTime UTCTime, generalTime GeneralizedTime }
CertificateSerialNumber ::= INTEGER
Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
Extension ::= SEQUENCE { extnID OBJECT IDENTIFIER, critical BOOLEAN DEFAULT FALSE, extnValue OCTET STRING }
For a detail description of the several fields refer to RFC 2459.
For each value extists a setValue()
and a getValue()
method.
After creating a X509CRL, the, for instance, CRL issuing date may be set to the
current date by using the setThisUpdate
method:
X509CRL crl = new X509CRL(); GregorianCalendar date = (GregorianCalendar)Calendar.getInstance(); crl.setThisUpdate(date.getTime());
Manipulating the extensions of a CRL is described in class X509Extensions
.
A CRL extension (support introduced by the X.509v2 CRL format) may be a defined
standard extension (e.g. CRLNumber
, ...), or it may be a
private extension providing some community-specific information. If an
extension is marked as critical, but the CRL handling software cannot parse
this extension, the CRL validation must fail. Non-Critical extensions can be
ignored, if they cannot be handled (i.e. of unknown state).
For adding some extension to a X509CRL use the addExtension
method. The CRL profile
presented in RFC 2459 requires
confirming CAs to support the CRL number
extension conveying a monotonically increasing sequence number for each CRL issued by a
given CA through a specific CA X.500 Directory entry or CRL distribution point, e.g.:
X509CRL crl = new X509CRL(); ... CRLNumber crl_number = new CRLNumber(BigInteger.valueOf(4234234)); crl.addExtension(crl_number);
A X509Certificate
to be revoked may be added
by means of the addCertificate(X509Certificate cert, Date revocationDate)
method.
Alternatively an instance of RevokedCertificate
may be added by using the addCertificate(RevokedCertificate revokedCertificate)
method.
For finally signing the CRL with the CRL issuer´s private key, call the
sign
method.
The X509CRL(byte[])
and
X509CRL(InputStream)
constructors
may be used for parsing an X509CRL from its DER encoding.
This class supports indirect CRLs, i.e. revocation of certificates where certificate issuer is different than the CRL issuer. Some caveats apply though. Firstly, the methods isRevoked(BigInteger) containsCertificate(BigInteger) implicitly assume the CRL issuer as the certificate issuer. Secondly, when encoding an indirect CRL the certificate issuer CRL entry extension is automatically added to entries where needed. However, the issuing distribution point CRL extension also required for indirect CRLs has to be added manually.
X509Extensions
,
V3Extension
,
UnknownExtension
,
X509Certificate
,
RevokedCertificate
,
X509CRL
Constructor Summary | |
X509CRL()
Default constructor for creating a new empty X509CRL. |
|
X509CRL(byte[] crl)
Creates a CRL form a PEM or DER byte array. |
|
X509CRL(InputStream is)
Creates a CRL from an input stream supplying a DER or PEM encoded CRL. |
Method Summary | |
void |
addCertificate(RevokedCertificate revokedCert)
Adds a revoked certificate to the CRL. |
void |
addCertificate(X509Certificate cert,
Date revocationDate)
Adds a certificate to the CRL to be revoked on the given date. |
void |
addExtension(V3Extension e)
Adds the given X509v2 CRL extension. |
RevokedCertificate |
containsCertificate(BigInteger serialNumber)
Checks, if the CRL contains a certificate with the given serial number. |
RevokedCertificate |
containsCertificate(X509Certificate cert)
Checks, if the CRL contains the given certificate. |
int |
countExtensions()
Returns the number of extensions included into this CRL. |
void |
decode(ASN1Object crl)
Creates a CRL from an ASN1Object. |
Set |
getCriticalExtensionOIDs()
Returns a Set of the OID strings identifying the extension(s) that are marked CRITICAL in this CRL. |
byte[] |
getEncoded()
Returns this CRL as DER encoded ASN.1 data structure. |
V3Extension |
getExtension(ObjectID oid)
Returns a specific extension, identified by its object identifier. |
byte[] |
getExtensionValue(String oid)
Returns a byte array representing the DER encoding of the extension value identified by the passed-in OID string. |
byte[] |
getFingerprint()
Returns the fingerprint of this CRL. |
byte[] |
getFingerprint(String digestAlgorithm)
Returns the fingerprint of this crl calculated with the given hash algorithm. |
byte[] |
getFingerprintSHA()
Get the SHA fingerprint of this CRL. |
Principal |
getIssuerDN()
Returns the Distinguished Name of the issuer of this CRL, as Principal .
|
Enumeration |
getIssuerDNs()
Return the names of all issuers of this CRL. |
Date |
getNextUpdate()
Returns the date of nextUpdate .
|
Set |
getNonCriticalExtensionOIDs()
Returns a Set of the OID strings for the extension(s) marked NON-CRITICAL in this CRL. |
X509CRLEntry |
getRevokedCertificate(BigInteger serialNumber)
Searches the CRL for the specified serial number and returns the appertaining revoked certificate, if included into this CRL. |
Set |
getRevokedCertificates()
Returns a set containing all the revoked certificates included into this CRL. |
String |
getSigAlgName()
Returns the name of the signature algorithm used by the issuer for signing this CRL. |
String |
getSigAlgOID()
Returns the OID of the signature algorithm used by the issuer for signing this CRL. |
byte[] |
getSigAlgParams()
Returns the algorithm parameters associated with the signature algorithm used by the issuer for signing this CRL. |
byte[] |
getSignature()
Returns the signature of this CRL. |
AlgorithmID |
getSignatureAlgorithm()
Returns the signature algorithm of this CRL. |
byte[] |
getTBSCertList()
Returns the TBSCertList inherent to this CRL as DER encoded ASN.1 structure.
|
Date |
getThisUpdate()
Returns the date of thisUpdate .
|
int |
getVersion()
Returns the version number of this CRL as int .
|
boolean |
hasExtensions()
Checks, if there are any extensions included into this CRL. |
boolean |
hasUnsupportedCriticalExtension()
Returns true if there are unsupported critical extensions. |
boolean |
isIndirectCRL()
Return whether this CRL is an indirect CRL. |
boolean |
isRevoked(BigInteger serialNumber)
Checks if the certificate identified by the given serial number is marked as revoked by this CRL. |
boolean |
isRevoked(Certificate cert)
Checks whether the given certificate is on this CRL. |
Enumeration |
listCertificates()
Returns an enumeration of the revoked certificates this CRL contains. |
Enumeration |
listExtensions()
Returns an enumeration of all extensions included into this CRL. |
void |
removeAllCertificates()
Removes all certificates from the CRL. |
void |
removeAllExtensions()
Removes all extensions from this CRL. |
boolean |
removeCertificate(BigInteger serialNumber)
Removes the certificate with the given serial number from the CRL. |
boolean |
removeCertificate(X509Certificate cert)
Removes the certificate from the CRL. |
boolean |
removeExtension(ObjectID oid)
Removes the extension specified by its object identifier. |
void |
setIssuerDN(Principal issuer)
Sets the issuer of this CRL. |
void |
setNextUpdate(Date nextUpdate)
Sets the date of nextUpdate .
|
void |
setSignature(byte[] signatureValue)
Sets the signature value of this crl. |
void |
setSignatureAlgorithm(AlgorithmID signatureAlg)
Sets the signature algorithm for signing this CRL. |
void |
setSignatureAlgorithm(ObjectID signatureAlg)
Deprecated. use setSignatureAlgorithm(AlgorithmID); |
void |
setThisUpdate(Date thisUpdate)
Sets the date of thisUpdate .
|
void |
sign(PrivateKey privateKey)
Signs the CRL with the private key of the issuer. |
void |
sign(PrivateKey privateKey,
String provider)
Signs the CRL with the private key of the issuer. |
ASN1Object |
toASN1Object()
Returns the CRL as an ASN1Object. |
byte[] |
toByteArray()
Returns the CRL as a DER encoded ASN.1 data structure. |
String |
toString()
Returns a string that represents the contents of the CRL. |
String |
toString(boolean detailed)
Returns a string giving some - if requested - detailed information about the contents of the CRL. |
void |
verify(PublicKey key)
Verifies a signed CRL using the given public key. |
void |
verify(PublicKey key,
String sigProvider)
Uses the given public key to verify this CRL based on a signature algorithm supplied by the specified provider. |
void |
writeTo(OutputStream os)
Writes the CRL DER encoded to the given output stream. |
Methods inherited from class java.security.cert.X509CRL |
equals, hashCode |
Methods inherited from class java.security.cert.CRL |
getType |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public X509CRL()
Any value may be set using the corrseponding the set<Value>
method.
The version number per default is set to 1
indicating a
Version 1
CRL. When extensions are added
, the version field automatically is set to 2.
public X509CRL(InputStream is) throws IOException, CRLException
This constructor reads a DER or PEM encoded X509CRL that previously may have
been written with method writeTo(OutputStream)
.
For instance:
InputStream fis = new FileInputStream("crl.der"); X509CRL crl = new X509CRL(fis); fis.close();
is
- InputStream from which to create the CRLIOException
- if the CRL could not be readCRLException
- if there is a problem when parsing the CRLpublic X509CRL(byte[] crl) throws CRLException
This constructor may be used for parsing an
already exisiting X509CRL
ASN.1 object, supplied as DER encoded
byte array, which may have been created by calling the toByteArray
or the getEncoded
method.
crl
- the byte array which contains the CRLCRLException
- if there is a problem when parsing the CRLMethod Detail |
public void decode(ASN1Object crl) throws CodingException
The given ASN1Object represents an already existing X509CRL which may have been
created by calling the toASN1Object
method.
decode
in interface ASN1Type
crl
- the ASN1Object which contains the CRLCodingException
- if there is a problem when parsing the CRLpublic boolean isIndirectCRL()
public void sign(PrivateKey privateKey) throws CRLException, InvalidKeyException, NoSuchAlgorithmException
privateKey
- the private key of the issuerCRLException
- if the CRL could not be createdInvalidKeyException
- if the private key is not validpublic void sign(PrivateKey privateKey, String provider) throws CRLException, InvalidKeyException, NoSuchAlgorithmException
privateKey
- the private key of the issuerprovider
- the name of the provider supplying the Signature engine
to be usedCRLException
- if the CRL could not be createdInvalidKeyException
- if the private key is not validpublic void setSignature(byte[] signatureValue) throws CRLException
This method provides an alternative to method sign
when
it is required to set the signature value from outside (e.g. calculated
by means of a smartcard):
X509CRL crl = ...; ... // set issuer, revoked certificates, ... ... // set the signature algorithm to be used for signing crl.setSignatureAlgorithm(AlgorithmID.sha1WithRSAEncryption); // get the to-be-signed value byte[] tbs = crl.getTBSCertList(); // now calculate the signature over the tbs cert list byte[] signatureValue = calculateSignature(tbs); // and set the signatureValue crl.setSignature(signatureValue); // encode the crl byte[] encodedCrl = crl.getEncoded();
signatureValue
- the signature calculated outsideCRLException
- if the CRL could not be createdpublic void verify(PublicKey key, String sigProvider) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verify
in class X509CRL
key
- the public key of the CRL issuerCRLException
- if an encoding error occursNoSuchAlgorithmException
- if there is no implementation for the algorithm used to sign this CRLInvalidKeyException
- if the format of the public key is wrongNoSuchProviderException
- if there is no default providerSignatureException
- if the signature does not verifypublic void verify(PublicKey key) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verify(PublicKey key, String sigProvider)
setting the provider name to
null
for relying on the default provider signature architecture.verify
in class X509CRL
key
- the public key of the CRL issuerCRLException
- if an encoding error occursNoSuchAlgorithmException
- if there is no implementation for the algorithm used to sign this CRLInvalidKeyException
- if the format of the public key is wrongNoSuchProviderException
- if there is no default providerSignatureException
- if the signature does not verifypublic boolean isRevoked(BigInteger serialNumber)
serialNumber
- the serial number of the certificate which is checked
of being revokedtrue
if the certificate identified by the given serial
number is marked as revoked by this CRL, false
if notpublic boolean isRevoked(Certificate cert)
isRevoked
in class CRL
cert
- the certificate to check forpublic RevokedCertificate containsCertificate(X509Certificate cert)
cert
- the certificate to checkpublic RevokedCertificate containsCertificate(BigInteger serialNumber)
serialNumber
- the serial number of the certificatenull
if the CRL doesn't contain a certificate with this serial number,
the RevokedCertificate from the CRL otherwisepublic ASN1Object toASN1Object()
toASN1Object
in interface ASN1Type
public byte[] toByteArray()
public void writeTo(OutputStream os) throws IOException
os
- the output stream to which this CRL shall be writtenIOException
- if an I/O error occurspublic void addCertificate(X509Certificate cert, Date revocationDate)
GregorianCalendar date = (GregorianCalendar)Calendar.getInstance(); InputStream fis = new FileInputStream("cert.der"); X509Certificate cert = new X509Certificate(fis); fis.close(); crl.addCertificate(cert, date.getTime());
cert
- the X509Certificate which should be revokedrevocationDate
- the revocation datepublic void addCertificate(RevokedCertificate revokedCert)
addCertificate(X509Certificate cert, Date revocationDate)
which adds a X509Certificate,
this method adds a RevokedCertificate already including its revocation date, for instance:
GregorianCalendar date = (GregorianCalendar)Calendar.getInstance(); InputStream fis = new FileInputStream("cert.der"); X509Certificate cert = new X509Certificate(fis); fis.close(); RevokedCertificate rev_cert = new RevokedCertificate(cert, date.getTime()); crl.addCertificate(rev_cert);
revokedCert
- the RevokedCertificate to add to this CRLRevokedCertificate
public Enumeration listCertificates()
public boolean removeCertificate(X509Certificate cert)
true
if the certificate successfully has been removed
false
otherwisepublic boolean removeCertificate(BigInteger serialNumber)
crl.removeCertificate(cert.getSerialNumber());
serialNumber
- the serial number of the certificate which should be removedtrue
if the certificate successfully has been removed
false
otherwisepublic void removeAllCertificates()
public void setSignatureAlgorithm(AlgorithmID signatureAlg)
crl.setSignatureAlgorithm(AlgorithmID.md5WithRSAEncryption);
signatureAlg
- the AlgorithmID of the signature algorithm to be used for signingAlgorithmID
public void setSignatureAlgorithm(ObjectID signatureAlg)
public void setIssuerDN(Principal issuer) throws IllegalArgumentException
Name issuer = new Name(); issuer.addRDN(ObjectID.country, "AT"); issuer.addRDN(ObjectID.organization ,"TU Graz"); issuer.addRDN(ObjectID.organizationalUnit ,"IAIK"); issuer.addRDN(ObjectID.commonName ,"IAIK Test CA"); crl.setIssuerDN(issuer);
issuer
- the distinguished name of the issuer of the CRLIllegalArgumentException
- if the issuer is not an instance of namegetIssuerDN()
public void setThisUpdate(Date thisUpdate)
thisUpdate
.
The thisUpdate
time value specifies the date on which the
CRL has been issued.
For instance, set ThisUpdate
to the current date by writing:
GregorianCalendar date = (GregorianCalendar)Calendar.getInstance(); crl.setThisUpdate(date.getTime());
The X.509 Certificate and CRL Profile specified in
RFC 2459 recommends to encode
thisUpdate
dates through the year 2049 as UTCTime, and
thisUpdate
dates in 2050 or later as GeneralizedTime.
thisUpdate
- the date when this CRL has been issuedgetThisUpdate()
public void setNextUpdate(Date nextUpdate)
nextUpdate
.
The nextUpdate
time value specifies the date on which the
next CRL will be issued.
If the next update will be done, for instance, next month, you may write:
GregorianCalendar date = (GregorianCalendar)Calendar.getInstance(); date.add(Calendar.MONTH, 1); crl.setNextUpdate(date.getTime());
The X.509 Certificate and CRL Profile specified in
RFC 2459 recommends to encode
nextUpdate
dates through the year 2049 as UTCTime, and
nextUpdate
dates in 2050 or later as GeneralizedTime.
nextUpdate
- when the next CRL will be createdgetNextUpdate()
public byte[] getEncoded() throws CRLException
getEncoded
in class X509CRL
CRLException
- if an encoding error occurspublic int getVersion()
int
.
The version number may specify a v1 or v2 CRL.
ASN.1 definition:
Version ::= INTEGER { v1(0), v2(1), v3(2) } v3 only appears for consistency reasons
getVersion
in class X509CRL
int
public AlgorithmID getSignatureAlgorithm()
AlgorithmID
public Principal getIssuerDN()
Principal
.
A Distinguished Name is used to specify a path within a X.500 directory information tree.
A distinguished name is defined as a sequence of relative distinguished names:
Name ::= CHOICE { RDNSequence } RDNSequence ::= SEQUENCE OF RelativeDistinguishedName RelativeDistinguishedName ::= SET OF AttributeTypeAndValue AttributeTypeAndValue ::= SEQUENCE { type AttributeType, value AttributeValue } AttributeType ::= OBJECT IDENTIFIER AttributeValue ::= ANY
The AttributeType
generally will be of ASN.1 type DirectoryString
which either may be a PrintableString, TeletexString, BMPString
, or an
UniversalString
. A name may consist of, for instance, the following Attribute Type/Value
"pairs" defining a path through a X.500 directory tree:
country: "AT" locality: "Graz" organization: "TU Graz" organizationalUnit: "IAIK" commonName: "IAIK TestCA"CAs conforming to RFC 2459 have to ensure to only issue crls having a non-empty distinguished name (DN) in their issuer field. Additional identities about the issuer may be included in the
IssuerAltName
extension.getIssuerDN
in class X509CRL
Principal
setIssuerDN(java.security.Principal)
public Enumeration getIssuerDNs()
public Date getThisUpdate()
thisUpdate
.
The thisUpdate
time value specifies the date on which the
CRL has been issued.
ASN.1 definition:
thisUpdate Time Time ::= CHOICE { utcTime UTCTime, generalTime GeneralizedTime }
The X.509 Certificate and CRL Profile specified in
RFC 2459 recommends to encode
thisUpdate
dates through the year 2049 as UTCTime, and
thisUpdate
dates in 2050 or later as GeneralizedTime.
getThisUpdate
in class X509CRL
setThisUpdate(java.util.Date)
public Date getNextUpdate()
nextUpdate
.
The nextUpdate
time value specifies the date on which the
next CRL will be issued.
ASN.1 definition:
nextUpdate Time OPTIONAL Time ::= CHOICE { utcTime UTCTime, generalTime GeneralizedTime }
The PKIX CRL (RFC 2459) profile
requires the inclusion of the nextUpdate
field in CRLs issued by
confroming CAs, although it is marked as OPTIONAL in the ASN.1 definition above.
The X.509 Certificate and CRL Profile specified in RFC 2459 recommends to encode
nextUpdate
dates through the year 2049 as UTCTime, and
nextUpdate
dates in 2050 or later as GeneralizedTime.
getNextUpdate
in class X509CRL
setNextUpdate(java.util.Date)
public X509CRLEntry getRevokedCertificate(BigInteger serialNumber)
getRevokedCertificate
in class X509CRL
serialNumber
- the serial number to be searched fornull
otherwisepublic Set getRevokedCertificates()
getRevokedCertificates
in class X509CRL
null
if there are no certificates revoked by
this CRLpublic byte[] getTBSCertList() throws CRLException
TBSCertList
inherent to this CRL as DER encoded ASN.1 structure.
The TBSCertList
specifies the (distinguished) name of the issuer,
the issue date of the CRL, the date when the next CRL will be issued, and optionally
lists of revoked certificates (identified by their serial numbers) and CRL extensions.
The list of revoked certificates is classified as being optional, since a CA may not
have revoked any issued certificate when publishing a CRL:
TBSCertList ::= SEQUENCE { version Version OPTIONAL, -- if present, must be v2 signature AlgorithmIdentifier, issuer Name, thisUpdate Time, nextUpdate Time OPTIONAL, revokedCertificates SEQUENCE OF SEQUENCE { userCertificate CertificateSerialNumber, revocationDate Time, crlEntryExtensions Extensions OPTIONAL -- if present, must be v2 } OPTIONAL, crlExtensions [0] EXPLICIT Extensions OPTIONAL -- if present, must be v2 }
where:
Version ::= INTEGER { v1(0), v2(1), v3(2) } -- v3 does not apply to CRLs but appears for consistency -- with definition of Version for certs
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
Name ::= CHOICE { RDNSequence }
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
RelativeDistinguishedName ::= SET OF AttributeTypeAndValue
AttributeTypeAndValue ::= SEQUENCE { type AttributeType, value AttributeValue }
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY -- Directory string type --
DirectoryString ::= CHOICE { teletexString TeletexString (SIZE (1..maxSize), printableString PrintableString (SIZE (1..maxSize)), universalString UniversalString (SIZE (1..maxSize)), bmpString BMPString (SIZE(1..maxSIZE)) }
Time ::= CHOICE { utcTime UTCTime, generalTime GeneralizedTime }
CertificateSerialNumber ::= INTEGER
Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
Extension ::= SEQUENCE { extnID OBJECT IDENTIFIER, critical BOOLEAN DEFAULT FALSE, extnValue OCTET STRING }
The CRL issuing CA computes the digital signature upon the ASN.1
DER encoded TBSCertList
structure.
getTBSCertList
in class X509CRL
TBSCertList
structure inherent to this CRLCRLException
- if an error occurs when parsing the CRLpublic byte[] getSignature()
getSignature
in class X509CRL
public String getSigAlgName()
getSigAlgName
in class X509CRL
public String getSigAlgOID()
getSigAlgOID
in class X509CRL
ObjectID
,
AlgorithmID
public byte[] getSigAlgParams()
getSigAlgParams
in class X509CRL
null
if there are no parameters usedpublic Set getCriticalExtensionOIDs()
getCriticalExtensionOIDs
in class X509CRL
null
getNonCriticalExtensionOIDs()
public Set getNonCriticalExtensionOIDs()
getNonCriticalExtensionOIDs
in class X509CRL
getCriticalExtensionOIDs()
public byte[] getExtensionValue(String oid)
The oid
string is represented by a set of positive whole numbers
separated by periods, e.g. "2.5.29.20" for the CrlNumber
extension.
In ASN.1, the Extensions
field is defined as a SEQUENCE of Extension:
Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension Extension ::= SEQUENCE { extnID OBJECT IDENTIFIER, critical BOOLEAN DEFAULT FALSE, extnValue OCTET STRING }
where critical
specifies whether an extension has to be treated
as being critical or not; the default value is FALSE. An extension can be identified by
its object identifier, given in the extnID
field. The value of the extension
is represented as ASN.1 OCTET STRING data structure in the extnValue
field.
The byte value returned by this method represents the DER encoding of the extnValue (OCTET_STRING) from above, and the value of this OCTET STRING represents the DER encoding of the specific extension´s ASN.1 representation itsself.
Attention: For compatibility reasons to the standard JCA certificate API this method has been changed to return the OCTET STRING value as described above. Prior versions of this class have returned the DER encoding of the specific extension´s ASN.1 representation itsself.
getExtensionValue
in class X509CRL
oid
- the Object Identifier value of the extension to be queried fornull
if it is not presentpublic void addExtension(V3Extension e) throws X509ExtensionException
The extension to be added shall be an implemented V3Extension
.
Extensions are managed by the X509Extensions
class which maintaines two hashtables, one
for recording critical extensions, and the other for non-critical extensions.
This method only calls the addExtension
method of the X509Extensions
class for
putting the given extension into the proper hashtable. Note that only the DER
encoded extension value is written to the hashtable using the OID of the extension
as key. If an extension with the same object ID already exists, it is replaced.
For instance:
X509CRL crl = new X509CRL(); ... CRLNumber crl_number = new CRLNumber(BigInteger.valueOf(4234234)); crl.addExtension(crl_number);
For reading back some extension from one of the hashtables, use the
getExtension(ObjectID)
method. Only at this time actually the appropriate implementation class is
created and initialized through the DER encoded extension value derived from
the corresponding hashtable.
e
- the X509v2 CRL extension to add to the list of extensionsX509ExtensionException
- if an error occurs while DER encoding the extensionV3Extension
public boolean removeExtension(ObjectID oid)
objectID
- the object ID of the extension to removetrue
if the extension successfully has been removed
false
otherwisepublic void removeAllExtensions()
public Enumeration listExtensions()
The returned enumeration may contain unknown extensions (instances of
UnknownExtension
if there are any extensions included in this certificate, for which there
exists no registered implementation, and it may contain error extensions
(instances of ErrorExtension
) indicating extensions which cannot be
parsed properly because of some kind of error.
Notice that this method only calls the listExtensions
method of the X509Extensions
class for actually instantiating implementations for the included extensions and
initializing them with the appertaining extension values previously written to
proper hashtables. If any extension cannot be parsed properly, an
ErrorExtension
is created from it and written to the enumeration list
returned by this method.
null
if there are no
extensions present at allpublic boolean hasExtensions()
true
if there are extensions, false
if notpublic boolean hasUnsupportedCriticalExtension()
hasUnsupportedCriticalExtension
in class X509CRL
public int countExtensions()
public V3Extension getExtension(ObjectID oid) throws X509ExtensionInitException
This method only calls the getExtension
method of the X509Extensions
class for actually instantiating an implementation
for the requested extension and initializing it with the appertaining extension
value previously written to a proper hashtable. If the extension cannot be initialized
for some reason, an X509ExtensionInitException is thrown. If the requested extension is
an unknown extension, which is not supported by a registered implementation,
this method creates and returns an UnknownExtension
which may be queried for obtaining as much information
as possible about the unknown extension.
objectID
- the object ID of the extensionnull
if the requested
extension is not presentX509ExtensionInitException
- if the extension can not be initializedX509Extensions.getExtension(iaik.asn1.ObjectID)
public byte[] getFingerprint()
public byte[] getFingerprint(String digestAlgorithm) throws NoSuchAlgorithmException
digestAlgorithm
- the digest algorithm to be usedNoSuchAlgorithmException
- if the requested algorithm is not supportedpublic byte[] getFingerprintSHA()
public String toString()
toString
in class CRL
public String toString(boolean detailed)
detailed
- whether or not to give detailed information about the CRL.
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |