APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.x509

public Class ExtendedKeyUsageExtension

extends Extension
Class Inheritance
Imports
java.io.IOException, java.util.ArrayList, .List, .Vector, sun.security.util.DerOutputStream, .DerValue, .KnownOIDs, .ObjectIdentifier

This class defines the Extended Key Usage Extension, which indicates one or more purposes for which the certified public key may be used, in addition to or in place of the basic purposes indicated in the key usage extension field. This field is defined as follows:

id-ce-extKeyUsage OBJECT IDENTIFIER ::= {id-ce 37}

ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId

KeyPurposeId ::= OBJECT IDENTIFIER

Key purposes may be defined by any organization with a need. Object identifiers used to identify key purposes shall be assigned in accordance with IANA or ITU-T Rec. X.660 | ISO/IEC/ITU 9834-1.

This extension may, at the option of the certificate issuer, be either critical or non-critical.

If the extension is flagged critical, then the certificate MUST be used only for one of the purposes indicated.

If the extension is flagged non-critical, then it indicates the intended purpose or purposes of the key, and may be used in finding the correct key/certificate of an entity that has multiple keys/certificates. It is an advisory field and does not imply that usage of the key is restricted by the certification authority to the purpose indicated. Certificate using applications may nevertheless require that a particular purpose be indicated in order for the certificate to be acceptable to that application.

If a certificate contains both a critical key usage field and a critical extended key usage field, then both fields MUST be processed independently and the certificate MUST only be used for a purpose consistent with both fields. If there is no purpose consistent with both fields, then the certificate MUST NOT be used for any purpose.

Since
1.4

Field Summary

Modifier and TypeField and Description
private Vector<ObjectIdentifier>
keyUsages

Vector of KeyUsages for this object.

public static final String
Inherited from sun.security.x509.Extension:
criticalextensionIdextensionValue

Constructor Summary

AccessConstructor and Description
public
ExtendedKeyUsageExtension(Vector<ObjectIdentifier>
the Vector of KeyUsages (ObjectIdentifiers)
keyUsages
)

Create a ExtendedKeyUsageExtension object from a Vector of Key Usages; the criticality is set to false.

public
ExtendedKeyUsageExtension(Boolean
true if the extension is to be treated as critical.
critical
,
Vector<ObjectIdentifier>
the Vector of KeyUsages (ObjectIdentifiers), cannot be null or empty.
keyUsages
)

Create a ExtendedKeyUsageExtension object from a Vector of KeyUsages with specified criticality.

public
ExtendedKeyUsageExtension(Boolean
true if the extension is to be treated as critical.
critical
,
Object
an array of DER encoded bytes of the actual value.
value
)

Create the extension from its DER encoded value and criticality.

Method Summary

Modifier and TypeMethod and Description
public void
encode(DerOutputStream
the DerOutputStream to write the extension to.
out
)

Overrides sun.security.x509.Extension.encode.

Implements sun.security.util.DerEncoder.encode.

Write the extension to the DerOutputStream.

private void
public List<String>
public String
getName()

Overrides sun.security.x509.Extension.getName.

Return the name of this extension.

public Vector<ObjectIdentifier>
getUsages()

Get the keyUsages value.

public String
toString()

Overrides sun.security.x509.Extension.toString.

Return the extension as user readable string.

Inherited from sun.security.x509.Extension:
encodeequalsgetExtensionIdgetExtensionValuegetIdgetValuehashCodeisCriticalnewExtension

Field Detail

keyUsagesback to summary
private Vector<ObjectIdentifier> keyUsages

Vector of KeyUsages for this object.

NAMEback to summary
public static final String NAME

Constructor Detail

ExtendedKeyUsageExtensionback to summary
public ExtendedKeyUsageExtension(Vector<ObjectIdentifier> keyUsages)

Create a ExtendedKeyUsageExtension object from a Vector of Key Usages; the criticality is set to false.

Parameters
keyUsages:Vector<ObjectIdentifier>

the Vector of KeyUsages (ObjectIdentifiers)

ExtendedKeyUsageExtensionback to summary
public ExtendedKeyUsageExtension(Boolean critical, Vector<ObjectIdentifier> keyUsages)

Create a ExtendedKeyUsageExtension object from a Vector of KeyUsages with specified criticality.

Parameters
critical:Boolean

true if the extension is to be treated as critical.

keyUsages:Vector<ObjectIdentifier>

the Vector of KeyUsages (ObjectIdentifiers), cannot be null or empty.

ExtendedKeyUsageExtensionback to summary
public ExtendedKeyUsageExtension(Boolean critical, Object value) throws IOException

Create the extension from its DER encoded value and criticality.

Parameters
critical:Boolean

true if the extension is to be treated as critical.

value:Object

an array of DER encoded bytes of the actual value.

Exceptions
IOException:
on error.
ClassCastException:
if value is not an array of bytes

Method Detail

encodeback to summary
public void encode(DerOutputStream out)

Overrides sun.security.x509.Extension.encode.

Implements sun.security.util.DerEncoder.encode.

Write the extension to the DerOutputStream.

Parameters
out:DerOutputStream

the DerOutputStream to write the extension to.

Annotations
@Override
encodeThisback to summary
private void encodeThis()
getExtendedKeyUsageback to summary
public List<String> getExtendedKeyUsage()
getNameback to summary
public String getName()

Overrides sun.security.x509.Extension.getName.

Return the name of this extension.

Annotations
@Override
getUsagesback to summary
public Vector<ObjectIdentifier> getUsages()

Get the keyUsages value.

toStringback to summary
public String toString()

Overrides sun.security.x509.Extension.toString.

Return the extension as user readable string.