PKCS12Attribute (Java SE 9 & JDK 9 ) (original) (raw)
- java.security.PKCS12Attribute
All Implemented Interfaces:
[KeyStore.Entry.Attribute](../../java/security/KeyStore.Entry.Attribute.html "interface in java.security")
public final class PKCS12Attribute
extends Object
implements KeyStore.Entry.Attribute
An attribute associated with a PKCS12 keystore entry. The attribute name is an ASN.1 Object Identifier and the attribute value is a set of ASN.1 types.
Since:
1.8
Constructor Summary
Constructors
Constructor Description PKCS12Attribute(byte[] encoded) Constructs a PKCS12 attribute from its ASN.1 DER encoding. PKCS12Attribute(String name,String value) Constructs a PKCS12 attribute from its name and value. Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type Method Description boolean equals(Object obj) Compares this PKCS12Attribute and a specified object for equality. byte[] getEncoded() Returns the attribute's ASN.1 DER encoding. String getName() Returns the attribute's ASN.1 Object Identifier represented as a list of dot-separated integers. String getValue() Returns the attribute's ASN.1 DER-encoded value as a string. int hashCode() Returns the hashcode for this PKCS12Attribute. String toString() Returns a string representation of this PKCS12Attribute. * ### Methods inherited from class java.lang.[Object](../../java/lang/Object.html "class in java.lang") `[clone](../../java/lang/Object.html#clone--), [finalize](../../java/lang/Object.html#finalize--), [getClass](../../java/lang/Object.html#getClass--), [notify](../../java/lang/Object.html#notify--), [notifyAll](../../java/lang/Object.html#notifyAll--), [wait](../../java/lang/Object.html#wait--), [wait](../../java/lang/Object.html#wait-long-), [wait](../../java/lang/Object.html#wait-long-int-)`
Constructor Detail
* #### PKCS12Attribute public PKCS12Attribute([String](../../java/lang/String.html "class in java.lang") name, [String](../../java/lang/String.html "class in java.lang") value) Constructs a PKCS12 attribute from its name and value. The name is an ASN.1 Object Identifier represented as a list of dot-separated integers. A string value is represented as the string itself. A binary value is represented as a string of colon-separated pairs of hexadecimal digits. Multi-valued attributes are represented as a comma-separated list of values, enclosed in square brackets. See[Arrays.toString(java.lang.Object\[\])](../../java/util/Arrays.html#toString-java.lang.Object:A-). A string value will be DER-encoded as an ASN.1 UTF8String and a binary value will be DER-encoded as an ASN.1 Octet String. Parameters: `name` \- the attribute's identifier `value` \- the attribute's value Throws: `[NullPointerException](../../java/lang/NullPointerException.html "class in java.lang")` \- if `name` or `value` is `null` `[IllegalArgumentException](../../java/lang/IllegalArgumentException.html "class in java.lang")` \- if `name` or`value` is incorrectly formatted * #### PKCS12Attribute public PKCS12Attribute(byte[] encoded) Constructs a PKCS12 attribute from its ASN.1 DER encoding. The DER encoding is specified by the following ASN.1 definition: Attribute ::= SEQUENCE { type AttributeType, values SET OF AttributeValue } AttributeType ::= OBJECT IDENTIFIER AttributeValue ::= ANY defined by type Parameters: `encoded` \- the attribute's ASN.1 DER encoding. It is cloned to prevent subsequent modificaion. Throws: `[NullPointerException](../../java/lang/NullPointerException.html "class in java.lang")` \- if `encoded` is`null` `[IllegalArgumentException](../../java/lang/IllegalArgumentException.html "class in java.lang")` \- if `encoded` is incorrectly formatted
Method Detail
* #### getName public [String](../../java/lang/String.html "class in java.lang") getName() Returns the attribute's ASN.1 Object Identifier represented as a list of dot-separated integers. Specified by: `[getName](../../java/security/KeyStore.Entry.Attribute.html#getName--)` in interface `[KeyStore.Entry.Attribute](../../java/security/KeyStore.Entry.Attribute.html "interface in java.security")` Returns: the attribute's identifier * #### getValue public [String](../../java/lang/String.html "class in java.lang") getValue() Returns the attribute's ASN.1 DER-encoded value as a string. An ASN.1 DER-encoded value is returned in one of the following`String` formats: * the DER encoding of a basic ASN.1 type that has a natural string representation is returned as the string itself. Such types are currently limited to BOOLEAN, INTEGER, OBJECT IDENTIFIER, UTCTime, GeneralizedTime and the following six ASN.1 string types: UTF8String, PrintableString, T61String, IA5String, BMPString and GeneralString. * the DER encoding of any other ASN.1 type is not decoded but returned as a binary string of colon-separated pairs of hexadecimal digits. Multi-valued attributes are represented as a comma-separated list of values, enclosed in square brackets. See[Arrays.toString(java.lang.Object\[\])](../../java/util/Arrays.html#toString-java.lang.Object:A-). Specified by: `[getValue](../../java/security/KeyStore.Entry.Attribute.html#getValue--)` in interface `[KeyStore.Entry.Attribute](../../java/security/KeyStore.Entry.Attribute.html "interface in java.security")` Returns: the attribute value's string encoding * #### getEncoded public byte[] getEncoded() Returns the attribute's ASN.1 DER encoding. Returns: a clone of the attribute's DER encoding * #### equals public boolean equals([Object](../../java/lang/Object.html "class in java.lang") obj) Compares this `PKCS12Attribute` and a specified object for equality. Overrides: `[equals](../../java/lang/Object.html#equals-java.lang.Object-)` in class `[Object](../../java/lang/Object.html "class in java.lang")` Parameters: `obj` \- the comparison object Returns: true if `obj` is a `PKCS12Attribute` and their DER encodings are equal. See Also: [Object.hashCode()](../../java/lang/Object.html#hashCode--), [HashMap](../../java/util/HashMap.html "class in java.util") * #### hashCode public int hashCode() Returns the hashcode for this `PKCS12Attribute`. The hash code is computed from its DER encoding. Overrides: `[hashCode](../../java/lang/Object.html#hashCode--)` in class `[Object](../../java/lang/Object.html "class in java.lang")` Returns: the hash code See Also: [Object.equals(java.lang.Object)](../../java/lang/Object.html#equals-java.lang.Object-), [System.identityHashCode(java.lang.Object)](../../java/lang/System.html#identityHashCode-java.lang.Object-) * #### toString public [String](../../java/lang/String.html "class in java.lang") toString() Returns a string representation of this `PKCS12Attribute`. Overrides: `[toString](../../java/lang/Object.html#toString--)` in class `[Object](../../java/lang/Object.html "class in java.lang")` Returns: a name/value pair separated by an 'equals' symbol
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2017, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.