Top Description Fields Constructors Methods
org.bouncycastle.asn1.x509

public Class ExtensionsGenerator

extends Object
Class Inheritance
Imports
java.io.IOException, java.util.Collections, .Enumeration, .HashSet, .Hashtable, .Set, .Vector, org.bouncycastle.asn1.ASN1Encodable, .ASN1EncodableVector, .ASN1Encoding, .ASN1ObjectIdentifier, .ASN1ParsingException, .ASN1Sequence, .DEROctetString, .DERSequence, org.bouncycastle.util.Arrays

Generator for X.509 extensions

Field Summary

Modifier and TypeField and Description
private static final Set<E>
private Hashtable<K, V>
private Vector<E>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addExtension(ASN1ObjectIdentifier
OID for the extension.
oid
,
boolean
true if critical, false otherwise.
critical
,
ASN1Encodable
the ASN.1 object to be included in the extension.
value
)

Add an extension with the given oid and the passed in value to be included in the OCTET STRING associated with the extension.

public void
addExtension(ASN1ObjectIdentifier
OID for the extension.
oid
,
boolean
true if critical, false otherwise.
critical
,
byte[]
the byte array to be wrapped.
value
)

Add an extension with the given oid and the passed in byte array to be wrapped in the OCTET STRING associated with the extension.

public void
addExtension(Extension
the full extension value.
extension
)

Add a given extension.

public void
public Extensions

Returns:

an X09Extensions object.
generate
()

Generate an Extensions object based on the current state of the generator.

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 boolean

Returns:

true if empty, false otherwise
isEmpty
()

Return true if there are no extension present in this generator.

public void
removeExtension(ASN1ObjectIdentifier
OID for the extension to remove.
oid
)

Remove a given extension.

public void
replaceExtension(ASN1ObjectIdentifier
OID for the extension.
oid
,
boolean
true if critical, false otherwise.
critical
,
ASN1Encodable
the ASN.1 object to be included in the extension.
value
)

Replace an extension with the given oid and the passed in value to be included in the OCTET STRING associated with the extension.

public void
replaceExtension(ASN1ObjectIdentifier
OID for the extension.
oid
,
boolean
true if critical, false otherwise.
critical
,
byte[]
the byte array to be wrapped.
value
)

Replace an extension with the given oid and the passed in byte array to be wrapped in the OCTET STRING associated with the extension.

public void
replaceExtension(Extension
the full extension value.
extension
)

Replace a given extension.

public void
reset()

Reset the generator

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dupsAllowedback to summary
private static final Set<E> dupsAllowed
extensionsback to summary
private Hashtable<K, V> extensions
extOrderingback to summary
private Vector<E> extOrdering

Constructor Detail

ExtensionsGeneratorback to summary
public ExtensionsGenerator()

Method Detail

addExtensionback to summary
public void addExtension(ASN1ObjectIdentifier oid, boolean critical, ASN1Encodable value) throws IOException

Add an extension with the given oid and the passed in value to be included in the OCTET STRING associated with the extension.

Parameters
oid:ASN1ObjectIdentifier

OID for the extension.

critical:boolean

true if critical, false otherwise.

value:ASN1Encodable

the ASN.1 object to be included in the extension.

addExtensionback to summary
public void addExtension(ASN1ObjectIdentifier oid, boolean critical, byte[] value)

Add an extension with the given oid and the passed in byte array to be wrapped in the OCTET STRING associated with the extension.

Parameters
oid:ASN1ObjectIdentifier

OID for the extension.

critical:boolean

true if critical, false otherwise.

value:byte[]

the byte array to be wrapped.

addExtensionback to summary
public void addExtension(Extension extension)

Add a given extension.

Parameters
extension:Extension

the full extension value.

addExtensionback to summary
public void addExtension(Extensions extensions)
generateback to summary
public Extensions generate()

Generate an Extensions object based on the current state of the generator.

Returns:Extensions

an X09Extensions object.

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.

isEmptyback to summary
public boolean isEmpty()

Return true if there are no extension present in this generator.

Returns:boolean

true if empty, false otherwise

removeExtensionback to summary
public void removeExtension(ASN1ObjectIdentifier oid)

Remove a given extension.

Parameters
oid:ASN1ObjectIdentifier

OID for the extension to remove.

replaceExtensionback to summary
public void replaceExtension(ASN1ObjectIdentifier oid, boolean critical, ASN1Encodable value) throws IOException

Replace an extension with the given oid and the passed in value to be included in the OCTET STRING associated with the extension.

Parameters
oid:ASN1ObjectIdentifier

OID for the extension.

critical:boolean

true if critical, false otherwise.

value:ASN1Encodable

the ASN.1 object to be included in the extension.

replaceExtensionback to summary
public void replaceExtension(ASN1ObjectIdentifier oid, boolean critical, byte[] value)

Replace an extension with the given oid and the passed in byte array to be wrapped in the OCTET STRING associated with the extension.

Parameters
oid:ASN1ObjectIdentifier

OID for the extension.

critical:boolean

true if critical, false otherwise.

value:byte[]

the byte array to be wrapped.

replaceExtensionback to summary
public void replaceExtension(Extension extension)

Replace a given extension.

Parameters
extension:Extension

the full extension value.

resetback to summary
public void reset()

Reset the generator