Skip to content

Most visited

Recently visited

navigation

PKCS12Attribute

public final class PKCS12Attribute
extends Object implements KeyStore.Entry.Attribute

java.lang.Object
   ↳ java.security.PKCS12Attribute


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.

Summary

Public constructors

PKCS12Attribute(String name, String value)

Constructs a PKCS12 attribute from its name and value.

PKCS12Attribute(byte[] encoded)

Constructs a PKCS12 attribute from its ASN.1 DER encoding.

Public methods

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.

Inherited methods

From class java.lang.Object
From interface java.security.KeyStore.Entry.Attribute

Public constructors

PKCS12Attribute

added in API level 26
PKCS12Attribute (String name, 
                String 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 toString(java.lang.Object[]).

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 String: the attribute's identifier

value String: the attribute's value

Throws
NullPointerException if name or value is null
IllegalArgumentException if name or value is incorrectly formatted

PKCS12Attribute

added in API level 26
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 byte: the attribute's ASN.1 DER encoding. It is cloned to prevent subsequent modificaion.

Throws
NullPointerException if encoded is null
IllegalArgumentException if encoded is incorrectly formatted

Public methods

equals

added in API level 26
boolean equals (Object obj)

Compares this PKCS12Attribute and a specified object for equality.

Parameters
obj Object: the comparison object

Returns
boolean true if obj is a PKCS12Attribute and their DER encodings are equal.

getEncoded

added in API level 26
byte[] getEncoded ()

Returns the attribute's ASN.1 DER encoding.

Returns
byte[] a clone of the attribute's DER encoding

getName

added in API level 26
String getName ()

Returns the attribute's ASN.1 Object Identifier represented as a list of dot-separated integers.

Returns
String the attribute's identifier

getValue

added in API level 26
String 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 toString(java.lang.Object[]).

Returns
String the attribute value's string encoding

hashCode

added in API level 26
int hashCode ()

Returns the hashcode for this PKCS12Attribute. The hash code is computed from its DER encoding.

Returns
int the hash code

toString

added in API level 26
String toString ()

Returns a string representation of this PKCS12Attribute.

Returns
String a name/value pair separated by an 'equals' symbol

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)