public class ExtendedKeyUsageExtension extends Extension implements CertAttrSet<java.lang.String>
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.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
IDENT
Identifier for this attribute, to be used with the
get, set, delete methods of Certificate, x509 type.
|
static java.lang.String |
NAME
Attribute names.
|
static java.lang.String |
USAGES |
critical, extensionId, extensionValue| Constructor and Description |
|---|
ExtendedKeyUsageExtension(java.lang.Boolean critical,
java.lang.Object value)
Create the extension from its DER encoded value and criticality.
|
ExtendedKeyUsageExtension(java.lang.Boolean critical,
java.util.Vector<ObjectIdentifier> keyUsages)
Create a ExtendedKeyUsageExtension object from
a Vector of KeyUsages with specified criticality.
|
ExtendedKeyUsageExtension(java.util.Vector<ObjectIdentifier> keyUsages)
Create a ExtendedKeyUsageExtension object from
a Vector of Key Usages; the criticality is set to false.
|
| Modifier and Type | Method and Description |
|---|---|
void |
delete(java.lang.String name)
Delete the attribute value.
|
void |
encode(java.io.OutputStream out)
Write the extension to the DerOutputStream.
|
java.lang.Object |
get(java.lang.String name)
Get the attribute value.
|
java.util.Enumeration<java.lang.String> |
getElements()
Return an enumeration of names of attributes existing within this
attribute.
|
java.util.List<java.lang.String> |
getExtendedKeyUsage() |
java.lang.String |
getName()
Return the name of this attribute.
|
void |
set(java.lang.String name,
java.lang.Object obj)
Set the attribute value.
|
java.lang.String |
toString()
Return the extension as user readable string.
|
encode, equals, getExtensionId, getExtensionValue, hashCode, isCriticalpublic static final java.lang.String IDENT
public static final java.lang.String NAME
public static final java.lang.String USAGES
public ExtendedKeyUsageExtension(java.util.Vector<ObjectIdentifier> keyUsages) throws java.io.IOException
keyUsages - the Vector of KeyUsages (ObjectIdentifiers)java.io.IOExceptionpublic ExtendedKeyUsageExtension(java.lang.Boolean critical,
java.util.Vector<ObjectIdentifier> keyUsages)
throws java.io.IOException
critical - true if the extension is to be treated as critical.keyUsages - the Vector of KeyUsages (ObjectIdentifiers)java.io.IOExceptionpublic ExtendedKeyUsageExtension(java.lang.Boolean critical,
java.lang.Object value)
throws java.io.IOException
critical - true if the extension is to be treated as critical.value - an array of DER encoded bytes of the actual value.java.lang.ClassCastException - if value is not an array of bytesjava.io.IOException - on error.public java.lang.String toString()
toString in interface CertAttrSet<java.lang.String>toString in class Extensionpublic void encode(java.io.OutputStream out)
throws java.io.IOException
encode in interface CertAttrSet<java.lang.String>out - the DerOutputStream to write the extension to.java.io.IOException - on encoding errors.public void set(java.lang.String name,
java.lang.Object obj)
throws java.io.IOException
set in interface CertAttrSet<java.lang.String>name - the name of the attribute (e.g. "x509.info.key")obj - the attribute object.java.io.IOException - on other errors.public java.lang.Object get(java.lang.String name)
throws java.io.IOException
get in interface CertAttrSet<java.lang.String>name - the name of the attribute to return.java.io.IOException - on other errors.public void delete(java.lang.String name)
throws java.io.IOException
delete in interface CertAttrSet<java.lang.String>name - the name of the attribute to delete.java.io.IOException - on other errors.public java.util.Enumeration<java.lang.String> getElements()
getElements in interface CertAttrSet<java.lang.String>public java.lang.String getName()
getName in interface CertAttrSet<java.lang.String>public java.util.List<java.lang.String> getExtendedKeyUsage()
Copyright © 2020. All Rights Reserved.