APIdia Launch Partner
Top Description Methods
java.security.cert

public Interface Extension

Known Direct Implementers
sun.security.x509.Extension
Imports
java.io.IOException, .OutputStream

This interface represents an X.509 extension.

Extensions provide a means of associating additional attributes with users or public keys and for managing a certification hierarchy. The extension format also allows communities to define private extensions to carry information unique to those communities.

Each extension contains an object identifier, a criticality setting indicating whether it is a critical or a non-critical extension, and an ASN.1 DER-encoded value. Its ASN.1 definition is:


    Extension ::= SEQUENCE {
        extnId        OBJECT IDENTIFIER,
        critical      BOOLEAN DEFAULT FALSE,
        extnValue     OCTET STRING
                -- contains a DER encoding of a value
                -- of the type registered for use with
                -- the extnId object identifier value
    }

This interface is designed to provide access to a single extension, unlike java.security.cert.X509Extension which is more suitable for accessing a set of extensions.

Since
1.7

Method Summary

Modifier and TypeMethod and Description
public void
encode(OutputStream
the output stream
out
)

Generates the extension's DER encoding and writes it to the output stream.

public String

Returns:

the object identifier as a String
getId
()

Gets the extensions's object identifier.

public byte[]

Returns:

a copy of the extension's value, or null if no extension value is present.
getValue
()

Gets the extensions's DER-encoded value.

public boolean

Returns:

true if this is a critical extension.
isCritical
()

Gets the extension's criticality setting.

Method Detail

encodeback to summary
public void encode(OutputStream out) throws IOException

Generates the extension's DER encoding and writes it to the output stream.

Parameters
out:OutputStream

the output stream

Exceptions
IOException:
on encoding or output error.
NullPointerException:
if out is null.
getIdback to summary
public String getId()

Gets the extensions's object identifier.

Returns:String

the object identifier as a String

getValueback to summary
public byte[] getValue()

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.

Returns:byte[]

a copy of the extension's value, or null if no extension value is present.

isCriticalback to summary
public boolean isCritical()

Gets the extension's criticality setting.

Returns:boolean

true if this is a critical extension.