Extension
Stay organized with collections
Save and categorize content based on your preferences.
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
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 X509Extension
which is more suitable
for accessing a set of extensions.
Public Method Summary
abstract
void
|
encode( OutputStream out)
Generates the extension's DER encoding and writes it to the output
stream.
|
abstract
String
|
getId()
Gets the extensions's object identifier.
|
abstract
byte[]
|
getValue()
Gets the extensions's DER-encoded value.
|
abstract
boolean
|
isCritical()
Gets the extension's criticality setting.
|
Public Methods
public
abstract
void
encode
(OutputStream out)
Generates the extension's DER encoding and writes it to the output
stream.
public
abstract
String
getId
()
Gets the extensions's object identifier.
Returns
- the object identifier as a String
public
abstract
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
- a copy of the extension's value, or
null
if no
extension value is present.
public
abstract
boolean
isCritical
()
Gets the extension's criticality setting.
Returns
- true if this is a critical extension.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eExtension\u003c/code\u003e interface represents an X.509 extension, allowing for the addition of attributes to users or public keys and managing certification hierarchies.\u003c/p\u003e\n"],["\u003cp\u003eExtensions are defined by an object identifier, a criticality setting, and a DER-encoded value, providing a structured way to include custom information.\u003c/p\u003e\n"],["\u003cp\u003eThis interface focuses on access to single extensions, differing from \u003ccode\u003eX509Extension\u003c/code\u003e which handles sets of extensions.\u003c/p\u003e\n"],["\u003cp\u003eThe interface includes methods to encode the extension to an output stream, retrieve its identifier, value, and criticality setting.\u003c/p\u003e\n"]]],["The `Extension` interface represents an X.509 extension, providing a way to associate attributes with users or keys. Each extension has an object identifier, a criticality setting (critical or non-critical), and a DER-encoded value. Key actions include: `encode(OutputStream out)` which generates the DER encoding; `getId()` retrieves the object identifier; `getValue()` gets the DER-encoded value as a byte array; and `isCritical()` determines if the extension is critical. The extension's format is defined using ASN.1.\n"],null,["public interface **Extension** \nThis interface represents an X.509 extension.\n\n\nExtensions provide a means of associating additional attributes with users\nor public keys and for managing a certification hierarchy. The extension\nformat also allows communities to define private extensions to carry\ninformation unique to those communities.\n\n\nEach extension contains an object identifier, a criticality setting\nindicating whether it is a critical or a non-critical extension, and\nand an ASN.1 DER-encoded value. Its ASN.1 definition is:\n\n```\n\n Extension ::= SEQUENCE {\n extnId OBJECT IDENTIFIER,\n critical BOOLEAN DEFAULT FALSE,\n extnValue OCTET STRING\n -- contains a DER encoding of a value\n -- of the type registered for use with\n -- the extnId object identifier value\n }\n\n \n```\n\n\nThis interface is designed to provide access to a single extension,\nunlike [X509Extension](../../../../reference/java/security/cert/X509Extension.html) which is more suitable\nfor accessing a set of extensions. \n\nPublic Method Summary\n\n|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [encode](../../../../reference/java/security/cert/Extension.html#encode(java.io.OutputStream))([OutputStream](../../../../reference/java/io/OutputStream.html) out) Generates the extension's DER encoding and writes it to the output stream. |\n| abstract [String](../../../../reference/java/lang/String.html) | [getId](../../../../reference/java/security/cert/Extension.html#getId())() Gets the extensions's object identifier. |\n| abstract byte\\[\\] | [getValue](../../../../reference/java/security/cert/Extension.html#getValue())() Gets the extensions's DER-encoded value. |\n| abstract boolean | [isCritical](../../../../reference/java/security/cert/Extension.html#isCritical())() Gets the extension's criticality setting. |\n\nPublic Methods \n\npublic abstract void\n**encode**\n([OutputStream](../../../../reference/java/io/OutputStream.html) out) \nGenerates the extension's DER encoding and writes it to the output\nstream. \n\nParameters\n\n| out | the output stream |\n|-----|-------------------|\n\nThrows\n\n| [IOException](../../../../reference/java/io/IOException.html) | on encoding or output error. |\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if `out` is `null`. |\n|-----------------------------------------------------------------------------------|------------------------------|\n\npublic abstract [String](../../../../reference/java/lang/String.html)\n**getId**\n() \nGets the extensions's object identifier. \n\nReturns\n\n- the object identifier as a String \n\npublic abstract byte\\[\\]\n**getValue**\n() \nGets the extensions's DER-encoded value. Note, this is the bytes\nthat are encoded as an OCTET STRING. It does not include the OCTET\nSTRING tag and length. \n\nReturns\n\n- a copy of the extension's value, or `null` if no extension value is present. \n\npublic abstract boolean\n**isCritical**\n() \nGets the extension's criticality setting. \n\nReturns\n\n- true if this is a critical extension."]]