public final class PKCS12Attribute extends Object implements KeyStore.Entry.Attribute
| 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. | 
| Modifier and Type | Method | Description | 
|---|---|---|
| boolean | equals(Object obj) | Compares this  PKCS12Attributeand 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. | 
public PKCS12Attribute(String name, String value)
Arrays.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.
name - the attribute's identifiervalue - the attribute's valueNullPointerException - if name or value
     is nullIllegalArgumentException - if name or
     value is incorrectly formattedpublic PKCS12Attribute(byte[] encoded)
 Attribute ::= SEQUENCE {
     type   AttributeType,
     values SET OF AttributeValue
 }
 AttributeType ::= OBJECT IDENTIFIER
 AttributeValue ::= ANY defined by type
 encoded - the attribute's ASN.1 DER encoding. It is cloned
     to prevent subsequent modificaion.NullPointerException - if encoded is
     nullIllegalArgumentException - if encoded is
     incorrectly formattedpublic String getName()
getName in interface KeyStore.Entry.Attributepublic String getValue()
String formats:
 Arrays.toString(java.lang.Object[]).getValue in interface KeyStore.Entry.Attributepublic byte[] getEncoded()
public boolean equals(Object obj)
PKCS12Attribute and a specified object for
 equality.equals in class Objectobj - the comparison objectobj is a PKCS12Attribute and
 their DER encodings are equal.Object.hashCode(), 
HashMappublic int hashCode()
PKCS12Attribute.
 The hash code is computed from its DER encoding.hashCode in class ObjectObject.equals(java.lang.Object), 
System.identityHashCode(java.lang.Object) Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2025, Oracle and/or its affiliates.  All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.