Package org.bouncycastle.asn1.x509
Class ExtensionsGenerator
java.lang.Object
org.bouncycastle.asn1.x509.ExtensionsGenerator
Generator for X.509 extensions
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.void
addExtension
(ASN1ObjectIdentifier oid, boolean critical, ASN1Encodable value) Add an extension with the given oid and the passed in value to be included in the OCTET STRING associated with the extension.void
addExtension
(Extension extension) Add a given extension.void
addExtension
(Extensions extensions) generate()
Generate an Extensions object based on the current state of the generator.Return the current value of the extension for OID.boolean
Return if the extension indicated by OID is present.boolean
isEmpty()
Return true if there are no extension present in this generator.void
Remove a given extension.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.void
replaceExtension
(ASN1ObjectIdentifier oid, boolean critical, ASN1Encodable value) Replace an extension with the given oid and the passed in value to be included in the OCTET STRING associated with the extension.void
replaceExtension
(Extension extension) Replace a given extension.void
reset()
Reset the generator
-
Constructor Details
-
ExtensionsGenerator
public ExtensionsGenerator()
-
-
Method Details
-
reset
public void reset()Reset the generator -
addExtension
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
- OID for the extension.critical
- true if critical, false otherwise.value
- the ASN.1 object to be included in the extension.- Throws:
IOException
-
addExtension
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
- OID for the extension.critical
- true if critical, false otherwise.value
- the byte array to be wrapped.
-
addExtension
Add a given extension.- Parameters:
extension
- the full extension value.
-
replaceExtension
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
- OID for the extension.critical
- true if critical, false otherwise.value
- the ASN.1 object to be included in the extension.- Throws:
IOException
-
replaceExtension
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
- OID for the extension.critical
- true if critical, false otherwise.value
- the byte array to be wrapped.
-
replaceExtension
Replace a given extension.- Parameters:
extension
- the full extension value.
-
removeExtension
Remove a given extension.- Parameters:
oid
- OID for the extension to remove.
-
hasExtension
Return if the extension indicated by OID is present.- Parameters:
oid
- the OID for the extension of interest.- Returns:
- the Extension, or null if it is not present.
-
getExtension
Return the current value of the extension for OID.- Parameters:
oid
- the OID for the extension we want to fetch.- Returns:
- true if a matching extension is present, false otherwise.
-
isEmpty
public boolean isEmpty()Return true if there are no extension present in this generator.- Returns:
- true if empty, false otherwise
-
generate
Generate an Extensions object based on the current state of the generator.- Returns:
- an X09Extensions object.
-
addExtension
-