Top Description Fields Constructors Methods
org.bouncycastle.cert

public Class X509v2AttributeCertificateBuilder

extends Object
Class Inheritance
Imports
java.io.IOException, java.math.BigInteger, java.util.Date, .Enumeration, .Locale, org.bouncycastle.asn1.ASN1Encodable, .ASN1Encoding, .ASN1GeneralizedTime, .ASN1Integer, .ASN1ObjectIdentifier, .DERSet, org.bouncycastle.asn1.x509.AttCertIssuer, .Attribute, .Extension, .Extensions, .ExtensionsGenerator, .V2AttributeCertificateInfoGenerator, org.bouncycastle.operator.ContentSigner

class to produce an X.509 Version 2 AttributeCertificate.

Field Summary

Modifier and TypeField and Description
private V2AttributeCertificateInfoGenerator
private ExtensionsGenerator

Constructor Summary

AccessConstructor and Description
public
X509v2AttributeCertificateBuilder(AttributeCertificateHolder
holder certificate details
holder
,
AttributeCertificateIssuer
issuer of this attribute certificate.
issuer
,
BigInteger
serial number of this attribute certificate.
serialNumber
,
Date
the date before which the certificate is not valid.
notBefore
,
Date
the date after which the certificate is not valid.
notAfter
)

Base constructor.

public
X509v2AttributeCertificateBuilder(AttributeCertificateHolder
holder certificate details
holder
,
AttributeCertificateIssuer
issuer of this attribute certificate.
issuer
,
BigInteger
serial number of this attribute certificate.
serialNumber
,
Date
the date before which the certificate is not valid.
notBefore
,
Date
the date after which the certificate is not valid.
notAfter
,
Locale
locale to be used for date interpretation.
dateLocale
)

Base constructor with locale for interpreting dates.

public
X509v2AttributeCertificateBuilder(X509AttributeCertificateHolder
template certificate to base the new one on.
template
)

Create a builder for a version 2 attribute certificate, initialised with another certificate.

Method Summary

Modifier and TypeMethod and Description
public X509v2AttributeCertificateBuilder

Returns:

this builder object.
addAttribute
(ASN1ObjectIdentifier
the OID giving the type of the attribute.
attrType
,
ASN1Encodable
the ASN.1 structure that forms the value of the attribute.
attrValue
)

Add an attribute to the certification request we are building.

public X509v2AttributeCertificateBuilder

Returns:

this builder object.
addAttribute
(ASN1ObjectIdentifier
the OID giving the type of the attribute.
attrType
,
ASN1Encodable[]
an array of ASN.1 structures that form the value of the attribute.
attrValues
)

Add an attribute with multiple values to the certification request we are building.

public X509v2AttributeCertificateBuilder

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 made up of the passed in parameters.

public X509v2AttributeCertificateBuilder

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 using a byte encoding of the extension value.

public X509v2AttributeCertificateBuilder

Returns:

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

Add a given extension field for the standard extensions.

public X509AttributeCertificateHolder

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 X509 certificate, based on the current issuer and subject using the passed in signer.

private Extension
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 X509v2AttributeCertificateBuilder

Returns:

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

Remove the extension indicated by OID.

public X509v2AttributeCertificateBuilder

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 X509v2AttributeCertificateBuilder

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 X509v2AttributeCertificateBuilder

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 void
setIssuerUniqueId(boolean[] iui)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

acInfoGenback to summary
private V2AttributeCertificateInfoGenerator acInfoGen
extGeneratorback to summary
private ExtensionsGenerator extGenerator

Constructor Detail

X509v2AttributeCertificateBuilderback to summary
public X509v2AttributeCertificateBuilder(AttributeCertificateHolder holder, AttributeCertificateIssuer issuer, BigInteger serialNumber, Date notBefore, Date notAfter)

Base constructor.

Parameters
holder:AttributeCertificateHolder

holder certificate details

issuer:AttributeCertificateIssuer

issuer of this attribute certificate.

serialNumber:BigInteger

serial number of this attribute certificate.

notBefore:Date

the date before which the certificate is not valid.

notAfter:Date

the date after which the certificate is not valid.

X509v2AttributeCertificateBuilderback to summary
public X509v2AttributeCertificateBuilder(AttributeCertificateHolder holder, AttributeCertificateIssuer issuer, BigInteger serialNumber, Date notBefore, Date notAfter, Locale dateLocale)

Base constructor with locale for interpreting dates. You may need to use this constructor if the default locale doesn't use a Gregorian calender so that the GeneralizedTime produced is compatible with other ASN.1 implementations.

Parameters
holder:AttributeCertificateHolder

holder certificate details

issuer:AttributeCertificateIssuer

issuer of this attribute certificate.

serialNumber:BigInteger

serial number of this attribute certificate.

notBefore:Date

the date before which the certificate is not valid.

notAfter:Date

the date after which the certificate is not valid.

dateLocale:Locale

locale to be used for date interpretation.

X509v2AttributeCertificateBuilderback to summary
public X509v2AttributeCertificateBuilder(X509AttributeCertificateHolder template)

Create a builder for a version 2 attribute certificate, initialised with another certificate.

Parameters
template:X509AttributeCertificateHolder

template certificate to base the new one on.

Method Detail

addAttributeback to summary
public X509v2AttributeCertificateBuilder addAttribute(ASN1ObjectIdentifier attrType, ASN1Encodable attrValue)

Add an attribute to the certification request we are building.

Parameters
attrType:ASN1ObjectIdentifier

the OID giving the type of the attribute.

attrValue:ASN1Encodable

the ASN.1 structure that forms the value of the attribute.

Returns:X509v2AttributeCertificateBuilder

this builder object.

addAttributeback to summary
public X509v2AttributeCertificateBuilder addAttribute(ASN1ObjectIdentifier attrType, ASN1Encodable[] attrValues)

Add an attribute with multiple values to the certification request we are building.

Parameters
attrType:ASN1ObjectIdentifier

the OID giving the type of the attribute.

attrValues:ASN1Encodable[]

an array of ASN.1 structures that form the value of the attribute.

Returns:X509v2AttributeCertificateBuilder

this builder object.

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

Add a given extension field for the standard extensions tag made up of the passed in parameters.

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:X509v2AttributeCertificateBuilder

this builder object.

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

Add a given extension field for the standard extensions 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:X509v2AttributeCertificateBuilder

this builder object.

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

Add a given extension field for the standard extensions.

Parameters
extension:Extension

the full extension value.

Returns:X509v2AttributeCertificateBuilder

this builder object.

buildback to summary
public X509AttributeCertificateHolder build(ContentSigner signer)

Generate an X509 certificate, 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:X509AttributeCertificateHolder

a holder containing the resulting signed certificate.

doGetExtensionback to summary
private Extension doGetExtension(ASN1ObjectIdentifier oid)
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 X509v2AttributeCertificateBuilder removeExtension(ASN1ObjectIdentifier oid)

Remove the extension indicated by OID.

Parameters
oid:ASN1ObjectIdentifier

the OID of the extension to be removed.

Returns:X509v2AttributeCertificateBuilder

this builder object.

Exceptions
IllegalArgumentException:
if the extension to be removed is not present.
replaceExtensionback to summary
public X509v2AttributeCertificateBuilder 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:X509v2AttributeCertificateBuilder

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 X509v2AttributeCertificateBuilder 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:X509v2AttributeCertificateBuilder

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 X509v2AttributeCertificateBuilder 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:X509v2AttributeCertificateBuilder

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.
setIssuerUniqueIdback to summary
public void setIssuerUniqueId(boolean[] iui)