com.rsa.certj.cert

Class RevokedCertificates

java.lang.Object
  |
  +--com.rsa.certj.cert.RevokedCertificates
All Implemented Interfaces:
Cloneable, Serializable

public class RevokedCertificates
extends Object
implements Cloneable, Serializable

This class builds and holds revoked certificates, which are part of an X.509-defined CRL. The ASN.1 definition is as follows:

 RevokedCertificates ::= SEQUENCE OF SEQUENCE {
     userCertificate		CertificateSerialNumber,
     revocationDate		Time,
     crlEntryExtensions       Extensions OPTIONAL } 

 CertificateSerialNumber  ::=	INTEGER

 Time  ::=  CHOICE { 
	utcTime 		UTCTime, 
	generalizedTime	GeneralizedTime }

 Extensions ::= SEQUENCE OF Extension
 Extension ::= SEQUENCE {
	extnId		EXTENSION.&id ({ExtensionSet}),
	critical	BOOLEAN DEFAULT FALSE,
	extnValue	OCTET STRING
			-- contains a DER encoding of a value of type &ExtnType
			-- for the extension object identified by extnId -- }
 ExtensionSet	EXTENSION	::=	{ ... }

Copyright © RSA Security Inc., 1999-2001. All rights reserved.

See Also

Serialized Form

Constructor Summary

RevokedCertificates()

Constructs an empty RevokedCertificates object.

RevokedCertificates(byte[] valueBER, int offset, int special)

Constructs a RevokedCertificates object and initializes it with the given values.

 

Method Summary

 void

addRevokedCertificate(byte[] serialNumber, Date date, X509V3Extensions extensions)

Adds the revoked certificate using the given values.

 Object

clone()

Overrides the default clone method to get a deeper clone.

 boolean

equals(Object obj)

Returns true if this object and obj contain the same RevokedCertificates, returns false otherwise.

 int

getCertificateCount()

Gets the number of revoked certificates in this object.

 int

getDEREncoding(byte[] encoding, int offset, int special, boolean timeFlag)

Places the DER encoding of this object into encoding, beginning at offset.

 int

getDERLen(int special)

Returns the number of bytes of the DER encoding of the revoked certificates.

 X509V3Extensions

getExtensions(int index)

Gets the CRLEntryExtensions object of the revoked certificate at the specified index.

static int

getNextBEROffset(byte[] valueBER, int offset)

Given valueBER, the BER of a revoked certificate beginning at offset, finds the index to the next element in the encoding.

 Date

getRevocationDate(int index)

Gets the revocation date of the revoked certificate at the specified index.

 byte[]

getSerialNumber(int index)

Gets the serial number of the revoked certificate at the specified index.

 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RevokedCertificates

public RevokedCertificates()
Constructs an empty RevokedCertificates object.

RevokedCertificates

public RevokedCertificates(byte[] valueBER,
                           int offset,
                           int special)
                    throws CertificateException
Constructs a RevokedCertificates object and initializes it with the given values.

Parameters

         valueBER  

The byte array that contains the BER encoding of this object.

         offset  

The offset into the valueBER array.

         special  

The special circumstances of the BER encoding, if there are any. The following ASN.1 constants are possible values for special: APP_IMPLICIT, APP_EXPLICIT, PRIVATE_IMPLICIT, PRIVATE_EXPLICIT, OPTIONAL, DEFAULT, CONTEXT_IMPLICIT, or CONTEXT_EXPLICIT.

Method Detail

addRevokedCertificate

public void addRevokedCertificate(byte[] serialNumber,
                                  Date date,
                                  X509V3Extensions extensions)
                           throws CertificateException
Adds the revoked certificate using the given values.

Parameters

         serialNumber  

The certificate serial number.

         date  

The revocation date that specifies when this certificate was revoked.

         extensions  

The crlEntryExtensions. If there are no extensions, then null.

Throws

CertificateException - If the specified extensions are of the wrong type (not CRLEntryExtensions extensions).

getSerialNumber

public byte[] getSerialNumber(int index)
                       throws CertificateException
Gets the serial number of the revoked certificate at the specified index.

Parameters

         index  

The index to the revoked certificate.

Returns

The specified certificate serial number.

Throws

CertificateException - If the specified index is invalid.

getRevocationDate

public Date getRevocationDate(int index)
                       throws CertificateException
Gets the revocation date of the revoked certificate at the specified index.

Parameters

         index  

The index to the certificate.

Returns

The specified certificate revocation date.

Throws

CertificateException - If the specified index is invalid.

getExtensions

public X509V3Extensions getExtensions(int index)
                               throws CertificateException
Gets the CRLEntryExtensions object of the revoked certificate at the specified index. If this object is not set with values, then this method returns null.

Parameters

         index  

The index to the revoked certificate.

Returns

The revoked certificate's extensions. If there are none, returns null.

Throws

CertificateException - If the specified index is invalid.

getCertificateCount

public int getCertificateCount()
Gets the number of revoked certificates in this object.

Returns

The number of revoked certificates in this object.

getNextBEROffset

public static int getNextBEROffset(byte[] valueBER,
                                   int offset)
                            throws CertificateException
Given valueBER, the BER of a revoked certificate beginning at offset, finds the index to the next element in the encoding. In other words, gets the next offset after this certificate.

For example, if the offset is 120 and the certificate's BER encoding is 1819 bytes, this method will return 1939, the index immediately following the certificate. That is, valueBER[120] is the first byte in the encoding of the certificate, valueBER[1938] is the last byte in the encoding of the certificate, and the next element begins at index 1939.

Parameters

         valueBER  

The BER encoding of a revoked certificate.

         offset  

The offset into valueBER where the encoding begins.

Returns

An int that contains the index to the next element in the BER encoding.

Throws

CertificateException - If the method cannot read the BER encoding.

getDERLen

public int getDERLen(int special)
              throws CertificateException
Returns the number of bytes of the DER encoding of the revoked certificates. If this object is not set with values, then this method returns zero.

Parameters

         special  

The special circumstances of the DER encoding, if there are any. The following ASN.1 constants are possible values for special: APP_IMPLICIT, APP_EXPLICIT, PRIVATE_IMPLICIT, PRIVATE_EXPLICIT, OPTIONAL, DEFAULT, CONTEXT_IMPLICIT, or CONTEXT_EXPLICIT.

Returns

The number of bytes of the DER encoding of the revoked certificate.

getDEREncoding

public int getDEREncoding(byte[] encoding,
                          int offset,
                          int special,
                          boolean timeFlag)
                   throws CertificateException
Places the DER encoding of this object into encoding, beginning at offset. To determine the length of the encoding, call getDERLen. If this object is not yet set with values, this method places nothing into the array and returns zero.

To indicate that the DER encoding should follow any special circumstances, use the special argument. If there are no special circumstances, pass in special = 0. The following ASN.1 constants are possible values for special: APP_IMPLICIT, APP_EXPLICIT, PRIVATE_IMPLICIT, PRIVATE_EXPLICIT, OPTIONAL, DEFAULT, CONTEXT_IMPLICIT, or CONTEXT_EXPLICIT.

Parameters

         encoding  

The byte array into which the result will be placed.

         offset  

The offset into encoding where writing begins.

         special  

The special DER circumstances of the encoding, if there are any.

         timeFlag  

The flag indicating how to encode time values: true means GenTime, false means UTC.

Returns

The number of bytes placed into encoding.

equals

public boolean equals(Object obj)
Returns true if this object and obj contain the same RevokedCertificates, returns false otherwise.

Overrides

equals in class Object

Parameters

         obj  

An instance of the RevokedCertificates object.

Returns

A boolean indicating whether these objects are equal.

clone

public Object clone()
             throws CloneNotSupportedException
Overrides the default clone method to get a deeper clone.

Returns

A new RevokedCertificates object, a copy of this object.

Throws

CloneNotSupportedException - If the cloning operation is not successful.


RSA BSAFE ® Cert-J 2.1.1 001-047007-211-001-000