Top Description Fields Constructors Methods
org.bouncycastle.cert

public Class X509v2CRLBuilder

extends Object
Class Inheritance
Known Direct Subclasses
org.bouncycastle.cert.jcajce.JcaX509v2CRLBuilder
Imports
java.io.IOException, .OutputStream, java.math.BigInteger, java.util.Date, .Enumeration, .Locale, org.bouncycastle.asn1.ASN1Encodable, .ASN1EncodableVector, .ASN1Encoding, .ASN1GeneralizedTime, .ASN1Integer, .ASN1Object, .ASN1ObjectIdentifier, .ASN1Sequence, .DERBitString, .DERSequence, org.bouncycastle.asn1.x500.X500Name, org.bouncycastle.asn1.x509.AlgorithmIdentifier, .CertificateList, .Extension, .Extensions, .ExtensionsGenerator, .TBSCertList, .Time, .V2TBSCertListGenerator, org.bouncycastle.operator.ContentSigner, org.bouncycastle.util.Exceptions

class to produce an X.509 Version 2 CRL.

Field Summary

Modifier and TypeField and Description
private ExtensionsGenerator
private V2TBSCertListGenerator

Constructor Summary

AccessConstructor and Description
public
X509v2CRLBuilder(X500Name
the issuer this CRL is associated with.
issuer
,
Date
the date of this update.
thisUpdate
)

Basic constructor.

public
X509v2CRLBuilder(X500Name
the issuer this CRL is associated with.
issuer
,
Date
the date of this update.
thisUpdate
,
Locale
locale to be used for date interpretation.
dateLocale
)

Basic constructor with Locale.

public
X509v2CRLBuilder(X500Name
the issuer this CRL is associated with.
issuer
,
Time
the Time of this update.
thisUpdate
)

Basic constructor.

public
X509v2CRLBuilder(X509CRLHolder
template CRL to base the new one on.
template
)

Create a builder for a version 2 CRL, initialised with another CRL.

Method Summary

Modifier and TypeMethod and Description
public X509v2CRLBuilder

Returns:

the current builder.
addCRL
(X509CRLHolder
the X509CRLHolder to source the other entries from.
other
)

Add the CRLEntry objects contained in a previous CRL.

public X509v2CRLBuilder

Returns:

the current builder.
addCRLEntry
(BigInteger
serial number of revoked certificate.
userCertificateSerial
,
Date
date of certificate revocation.
revocationDate
,
int
the reason code, as indicated in CRLReason, i.e CRLReason.keyCompromise, or 0 if not to be used.
reason
)

Add a CRL entry with the just reasonCode extension.

public X509v2CRLBuilder

Returns:

the current builder.
addCRLEntry
(BigInteger
serial number of revoked certificate.
userCertificateSerial
,
Date
date of certificate revocation.
revocationDate
,
int
the reason code, as indicated in CRLReason, i.e CRLReason.keyCompromise, or 0 if not to be used.
reason
,
Date
the date on which the private key for the certificate became compromised or the certificate otherwise became invalid.
invalidityDate
)

Add a CRL entry with an invalidityDate extension as well as a reasonCode extension.

public X509v2CRLBuilder

Returns:

the current builder.
addCRLEntry
(BigInteger
serial number of revoked certificate.
userCertificateSerial
,
Date
date of certificate revocation.
revocationDate
,
Extensions
extension set to be associated with this CRLEntry.
extensions
)

Add a CRL entry with extensions.

public X509v2CRLBuilder

Returns:

this builder object.
addExtension
(ASN1ObjectIdentifier
the OID defining the extension type.
oid
,
boolean
true if the extension is critical, false otherwise.
isCritical
,
ASN1Encodable
the ASN.1 structure that forms the extension's value.
value
)

Add a given extension field for the standard extensions tag (tag 3)

public X509v2CRLBuilder

Returns:

this builder object.
addExtension
(ASN1ObjectIdentifier
the OID defining the extension type.
oid
,
boolean
true if the extension is critical, false otherwise.
isCritical
,
byte[]
a byte array representing the encoding of the extension value.
encodedValue
)

Add a given extension field for the standard extensions tag (tag 3) using a byte encoding of the extension value.

public X509v2CRLBuilder

Returns:

this builder object.
addExtension
(Extension
the full extension value.
extension
)

Add a given extension field for the standard extensions tag (tag 3).

public X509CRLHolder

Returns:

a holder containing the resulting signed certificate.
build
(ContentSigner
the content signer to be used to generate the signature validating the certificate.
signer
)

Generate an X.509 CRL, based on the current issuer and subject using the passed in signer.

public X509CRLHolder

Returns:

a holder containing the resulting signed CRL.
build
(ContentSigner
the content signer to be used to generate the signature validating the CRL.
signer
,
boolean isCritical, ContentSigner
the content signer used to create the altSignatureAlgorithm and altSignatureValue extension.
altSigner
)

Generate an X.509 CRL, based on the current issuer using the passed in signer and containing altSignatureAlgorithm and altSignatureValue extensions based on the passed altSigner.

private Extension
private static CertificateList
generateCRLStructure(TBSCertList tbsCertList, AlgorithmIdentifier sigAlgId, byte[] signature)

private static X509CRLHolder
private static byte[]
public Extension

Returns:

true if a matching extension is present, false otherwise.
getExtension
(ASN1ObjectIdentifier
the OID for the extension we want to fetch.
oid
)

Return the current value of the extension for OID.

public boolean

Returns:

the Extension, or null if it is not present.
hasExtension
(ASN1ObjectIdentifier
the OID for the extension of interest.
oid
)

Return if the extension indicated by OID is present.

public X509v2CRLBuilder

Returns:

this builder object.
removeExtension
(ASN1ObjectIdentifier
the OID of the extension to be removed.
oid
)

Remove the extension indicated by OID.

public X509v2CRLBuilder

Returns:

this builder object.
replaceExtension
(ASN1ObjectIdentifier
the OID defining the extension type.
oid
,
boolean
true if the extension is critical, false otherwise.
isCritical
,
ASN1Encodable
the ASN.1 structure that forms the extension's value.
value
)

Replace the extension field for the passed in extension's extension ID with a new version.

public X509v2CRLBuilder

Returns:

this builder object.
replaceExtension
(Extension
the full extension value.
extension
)

Replace the extension field for the passed in extension's extension ID with a new version.

public X509v2CRLBuilder

Returns:

this builder object.
replaceExtension
(ASN1ObjectIdentifier
the OID defining the extension type.
oid
,
boolean
true if the extension is critical, false otherwise.
isCritical
,
byte[]
a byte array representing the encoding of the extension value.
encodedValue
)

Replace a given extension field for the standard extensions tag (tag 3) with the passed in byte encoded extension value.

public X509v2CRLBuilder

Returns:

the current builder.
setNextUpdate
(Date
date of next CRL update.
date
)

Set the date by which the next CRL will become available.

public X509v2CRLBuilder

Returns:

the current builder.
setNextUpdate
(Date
date of next CRL update.
date
,
Locale
locale to be used for date interpretation.
dateLocale
)

Set the date by which the next CRL will become available.

public X509v2CRLBuilder

Returns:

the current builder.
setNextUpdate
(Time
date of next CRL update.
date
)

Set the date by which the next CRL will become available.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

extGeneratorback to summary
private ExtensionsGenerator extGenerator
tbsGenback to summary
private V2TBSCertListGenerator tbsGen

Constructor Detail

X509v2CRLBuilderback to summary
public X509v2CRLBuilder(X500Name issuer, Date thisUpdate)

Basic constructor.

Parameters
issuer:X500Name

the issuer this CRL is associated with.

thisUpdate:Date

the date of this update.

X509v2CRLBuilderback to summary
public X509v2CRLBuilder(X500Name issuer, Date thisUpdate, Locale dateLocale)

Basic constructor with Locale. You may need to use this constructor if the default locale doesn't use a Gregorian calender so that the Time produced is compatible with other ASN.1 implementations.

Parameters
issuer:X500Name

the issuer this CRL is associated with.

thisUpdate:Date

the date of this update.

dateLocale:Locale

locale to be used for date interpretation.

X509v2CRLBuilderback to summary
public X509v2CRLBuilder(X500Name issuer, Time thisUpdate)

Basic constructor.

Parameters
issuer:X500Name

the issuer this CRL is associated with.

thisUpdate:Time

the Time of this update.

X509v2CRLBuilderback to summary
public X509v2CRLBuilder(X509CRLHolder template)

Create a builder for a version 2 CRL, initialised with another CRL.

Parameters
template:X509CRLHolder

template CRL to base the new one on.

Method Detail

addCRLback to summary
public X509v2CRLBuilder addCRL(X509CRLHolder other)

Add the CRLEntry objects contained in a previous CRL.

Parameters
other:X509CRLHolder

the X509CRLHolder to source the other entries from.

Returns:X509v2CRLBuilder

the current builder.

addCRLEntryback to summary
public X509v2CRLBuilder addCRLEntry(BigInteger userCertificateSerial, Date revocationDate, int reason)

Add a CRL entry with the just reasonCode extension.

Parameters
userCertificateSerial:BigInteger

serial number of revoked certificate.

revocationDate:Date

date of certificate revocation.

reason:int

the reason code, as indicated in CRLReason, i.e CRLReason.keyCompromise, or 0 if not to be used.

Returns:X509v2CRLBuilder

the current builder.

addCRLEntryback to summary
public X509v2CRLBuilder addCRLEntry(BigInteger userCertificateSerial, Date revocationDate, int reason, Date invalidityDate)

Add a CRL entry with an invalidityDate extension as well as a reasonCode extension. This is used where the date of revocation might be after issues with the certificate may have occurred.

Parameters
userCertificateSerial:BigInteger

serial number of revoked certificate.

revocationDate:Date

date of certificate revocation.

reason:int

the reason code, as indicated in CRLReason, i.e CRLReason.keyCompromise, or 0 if not to be used.

invalidityDate:Date

the date on which the private key for the certificate became compromised or the certificate otherwise became invalid.

Returns:X509v2CRLBuilder

the current builder.

addCRLEntryback to summary
public X509v2CRLBuilder addCRLEntry(BigInteger userCertificateSerial, Date revocationDate, Extensions extensions)

Add a CRL entry with extensions.

Parameters
userCertificateSerial:BigInteger

serial number of revoked certificate.

revocationDate:Date

date of certificate revocation.

extensions:Extensions

extension set to be associated with this CRLEntry.

Returns:X509v2CRLBuilder

the current builder.

addExtensionback to summary
public X509v2CRLBuilder addExtension(ASN1ObjectIdentifier oid, boolean isCritical, ASN1Encodable value) throws CertIOException

Add a given extension field for the standard extensions tag (tag 3)

Parameters
oid:ASN1ObjectIdentifier

the OID defining the extension type.

isCritical:boolean

true if the extension is critical, false otherwise.

value:ASN1Encodable

the ASN.1 structure that forms the extension's value.

Returns:X509v2CRLBuilder

this builder object.

addExtensionback to summary
public X509v2CRLBuilder addExtension(ASN1ObjectIdentifier oid, boolean isCritical, byte[] encodedValue) throws CertIOException

Add a given extension field for the standard extensions tag (tag 3) using a byte encoding of the extension value.

Parameters
oid:ASN1ObjectIdentifier

the OID defining the extension type.

isCritical:boolean

true if the extension is critical, false otherwise.

encodedValue:byte[]

a byte array representing the encoding of the extension value.

Returns:X509v2CRLBuilder

this builder object.

addExtensionback to summary
public X509v2CRLBuilder addExtension(Extension extension) throws CertIOException

Add a given extension field for the standard extensions tag (tag 3).

Parameters
extension:Extension

the full extension value.

Returns:X509v2CRLBuilder

this builder object.

buildback to summary
public X509CRLHolder build(ContentSigner signer)

Generate an X.509 CRL, based on the current issuer and subject using the passed in signer.

Parameters
signer:ContentSigner

the content signer to be used to generate the signature validating the certificate.

Returns:X509CRLHolder

a holder containing the resulting signed certificate.

buildback to summary
public X509CRLHolder build(ContentSigner signer, boolean isCritical, ContentSigner altSigner)

Generate an X.509 CRL, based on the current issuer using the passed in signer and containing altSignatureAlgorithm and altSignatureValue extensions based on the passed altSigner.

Parameters
signer:ContentSigner

the content signer to be used to generate the signature validating the CRL.

altSigner:ContentSigner

the content signer used to create the altSignatureAlgorithm and altSignatureValue extension.

Returns:X509CRLHolder

a holder containing the resulting signed CRL.

doGetExtensionback to summary
private Extension doGetExtension(ASN1ObjectIdentifier oid)
generateCRLStructureback to summary
private static CertificateList generateCRLStructure(TBSCertList tbsCertList, AlgorithmIdentifier sigAlgId, byte[] signature)
generateFullCRLback to summary
private static X509CRLHolder generateFullCRL(ContentSigner signer, TBSCertList tbsCertList)
generateSigback to summary
private static byte[] generateSig(ContentSigner signer, ASN1Object tbsObj) throws IOException
getExtensionback to summary
public Extension getExtension(ASN1ObjectIdentifier oid)

Return the current value of the extension for OID.

Parameters
oid:ASN1ObjectIdentifier

the OID for the extension we want to fetch.

Returns:Extension

true if a matching extension is present, false otherwise.

hasExtensionback to summary
public boolean hasExtension(ASN1ObjectIdentifier oid)

Return if the extension indicated by OID is present.

Parameters
oid:ASN1ObjectIdentifier

the OID for the extension of interest.

Returns:boolean

the Extension, or null if it is not present.

removeExtensionback to summary
public X509v2CRLBuilder removeExtension(ASN1ObjectIdentifier oid)

Remove the extension indicated by OID.

Parameters
oid:ASN1ObjectIdentifier

the OID of the extension to be removed.

Returns:X509v2CRLBuilder

this builder object.

Exceptions
IllegalArgumentException:
if the extension to be removed is not present.
replaceExtensionback to summary
public X509v2CRLBuilder replaceExtension(ASN1ObjectIdentifier oid, boolean isCritical, ASN1Encodable value) throws CertIOException

Replace the extension field for the passed in extension's extension ID with a new version.

Parameters
oid:ASN1ObjectIdentifier

the OID defining the extension type.

isCritical:boolean

true if the extension is critical, false otherwise.

value:ASN1Encodable

the ASN.1 structure that forms the extension's value.

Returns:X509v2CRLBuilder

this builder object.

Exceptions
CertIOException:
if there is an issue with the new extension value.
IllegalArgumentException:
if the extension to be replaced is not present.
replaceExtensionback to summary
public X509v2CRLBuilder replaceExtension(Extension extension) throws CertIOException

Replace the extension field for the passed in extension's extension ID with a new version.

Parameters
extension:Extension

the full extension value.

Returns:X509v2CRLBuilder

this builder object.

Exceptions
CertIOException:
if there is an issue with the new extension value.
IllegalArgumentException:
if the extension to be replaced is not present.
replaceExtensionback to summary
public X509v2CRLBuilder replaceExtension(ASN1ObjectIdentifier oid, boolean isCritical, byte[] encodedValue) throws CertIOException

Replace a given extension field for the standard extensions tag (tag 3) with the passed in byte encoded extension value.

Parameters
oid:ASN1ObjectIdentifier

the OID defining the extension type.

isCritical:boolean

true if the extension is critical, false otherwise.

encodedValue:byte[]

a byte array representing the encoding of the extension value.

Returns:X509v2CRLBuilder

this builder object.

Exceptions
CertIOException:
if there is an issue with the new extension value.
IllegalArgumentException:
if the extension to be replaced is not present.
setNextUpdateback to summary
public X509v2CRLBuilder setNextUpdate(Date date)

Set the date by which the next CRL will become available.

Parameters
date:Date

date of next CRL update.

Returns:X509v2CRLBuilder

the current builder.

setNextUpdateback to summary
public X509v2CRLBuilder setNextUpdate(Date date, Locale dateLocale)

Set the date by which the next CRL will become available.

Parameters
date:Date

date of next CRL update.

dateLocale:Locale

locale to be used for date interpretation.

Returns:X509v2CRLBuilder

the current builder.

setNextUpdateback to summary
public X509v2CRLBuilder setNextUpdate(Time date)

Set the date by which the next CRL will become available.

Parameters
date:Time

date of next CRL update.

Returns:X509v2CRLBuilder

the current builder.