Extensions are additional attributes which can be inserted in a X509 v3 certificate. For example a "Driving License Certificate" could have the driving license number as an extension.
Extensions are represented as a sequence of the extension identifier (Object Identifier), a boolean flag stating whether the extension is to be treated as being critical and the extension value itself (this is again a DER encoding of the extension value).
ASN.1 definition of Extension:
Extension ::= SEQUENCE {
ExtensionId OBJECT IDENTIFIER,
critical BOOLEAN DEFAULT FALSE,
extensionValue OCTET STRING
}
All subclasses need to implement a constructor of the form
<subclass> (Boolean, Object)
where the Object is typically an array of DER encoded bytes.
| Modifier and Type | Field and Description |
|---|---|
| protected boolean | |
| protected ObjectIdentifier | |
| protected byte[] | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | Extension(ObjectIdentifier
the ObjectIdentifier of the extension extensionId, boolean the boolean indicating if the extension is critical critical, byte[] the DER encoded octet string of the value. extensionValue)Constructs an Extension from individual components of ObjectIdentifier, criticality and the DER encoded OctetString. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final void | encode(OutputStream
the output stream out)Implements java. Implementing |
| public void | encode(DerOutputStream
the DerOutputStream to write the extension to. out)Implements sun. Write the extension to the DerOutputStream. |
| public boolean | Returns: true iff the other object is of type Extension, and the criticality flag, object identifier and encoded extension value of the two Extensions match, false otherwise.the object to test for equality with this Extension. other)Overrides java. Compares this Extension for equality with the specified object. |
| public ObjectIdentifier | |
| public byte[] | |
| public String | |
| public String | |
| public byte[] | getValue()
Implements java. Gets the extensions's DER-encoded value. |
| public int | Returns: a hashcode value for this ExtensionOverrides java. Returns a hashcode value for this Extension. |
| public boolean | isCritical()
Implements java. Returns true if extension is critical. |
| public static Extension | newExtension(ObjectIdentifier
the ObjectIdentifier of the extension extensionId, boolean the boolean indicating if the extension is critical critical, byte[] the raw DER-encoded extension value (this
is not the encoded OctetString). rawExtensionValue)Constructs an Extension from individual components of ObjectIdentifier, criticality and the raw encoded extension value. |
| public String |
| critical | back to summary |
|---|---|
| protected boolean critical | |
| extensionId | back to summary |
|---|---|
| protected ObjectIdentifier extensionId | |
| extensionValue | back to summary |
|---|---|
| protected byte[] extensionValue | |
| hashMagic | back to summary |
|---|---|
| private static final int hashMagic | |
| Extension | back to summary |
|---|---|
| public Extension() Default constructor. Used only by subclasses. | |
| Extension | back to summary |
|---|---|
| public Extension(DerValue derVal) throws IOException Constructs an extension from a DER encoded array of bytes. | |
| Extension | back to summary |
|---|---|
| public Extension(ObjectIdentifier extensionId, boolean critical, byte[] extensionValue) throws IOException Constructs an Extension from individual components of ObjectIdentifier, criticality and the DER encoded OctetString.
| |
| Extension | back to summary |
|---|---|
| public Extension(Extension ext) Constructs an Extension from another extension. To be used for creating decoded subclasses.
| |
| encode | back to summary |
|---|---|
| public final void encode(OutputStream out) throws IOException Implements java. Implementing
| |
| encode | back to summary |
|---|---|
| public void encode(DerOutputStream out) Implements sun. Write the extension to the DerOutputStream.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Compares this Extension for equality with the specified
object. If the | |
| getExtensionId | back to summary |
|---|---|
| public ObjectIdentifier getExtensionId() Returns the ObjectIdentifier of the extension. | |
| getExtensionValue | back to summary |
|---|---|
| public byte[] getExtensionValue() Returns the extension value as a byte array for further processing. Note, this is the raw DER value of the extension, not the DER encoded octet string which is in the certificate. This method does not return a clone; it is the responsibility of the caller to clone the array if necessary. | |
| getId | back to summary |
|---|---|
| public String getId() Implements java. Doc from java. Gets the extensions's object identifier. | |
| getName | back to summary |
|---|---|
| public String getName() Returns the extension name. The default implementation returns the string form of the extensionId. Known extensions should override this method to return a human readable name. | |
| getValue | back to summary |
|---|---|
| public byte[] getValue() Implements java. Doc from java. Gets the extensions's DER-encoded value. Note, this is the bytes that are encoded as an OCTET STRING. It does not include the OCTET STRING tag and length. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns a hashcode value for this Extension.
| |
| isCritical | back to summary |
|---|---|
| public boolean isCritical() Implements java. Returns true if extension is critical. | |
| newExtension | back to summary |
|---|---|
| public static Extension newExtension(ObjectIdentifier extensionId, boolean critical, byte[] rawExtensionValue) throws IOException Constructs an Extension from individual components of ObjectIdentifier, criticality and the raw encoded extension value.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns the Extension in user readable form. | |