public class

PKCS9Attribute

extends Object
implements DerEncoder
java.lang.Object
   ↳ sun.security.pkcs.PKCS9Attribute

Class Overview

Class supporting any PKCS9 attributes. Supports DER decoding and access to attribute values, but not DER encoding or setting of values.

Type/Class Table

The following table shows the correspondence between PKCS9 attribute types and value component classes.

Object Identifier Attribute Name Type Value Class
1.2.840.113549.1.9.1 EmailAddress Multi-valued String[]
1.2.840.113549.1.9.2 UnstructuredName Multi-valued String[]
1.2.840.113549.1.9.3 ContentType Single-valued ObjectIdentifier
1.2.840.113549.1.9.4 MessageDigest Single-valued byte[]
1.2.840.113549.1.9.5 SigningTime Single-valued Date
1.2.840.113549.1.9.6 Countersignature Multi-valued SignerInfo[]
1.2.840.113549.1.9.7 ChallengePassword Single-valued String
1.2.840.113549.1.9.8 UnstructuredAddress Single-valued String
1.2.840.113549.1.9.9 ExtendedCertificateAttributes Multi-valued (not supported)
1.2.840.113549.1.9.10 IssuerAndSerialNumber Single-valued (not supported)
1.2.840.113549.1.9.{11,12} RSA DSI proprietary Single-valued (not supported)
1.2.840.113549.1.9.13 S/MIME unused assignment Single-valued (not supported)
1.2.840.113549.1.9.14 ExtensionRequest Single-valued CertificateExtensions
1.2.840.113549.1.9.15 SMIMECapability Single-valued (not supported)
1.2.840.113549.1.9.16.2.12 SigningCertificate Single-valued SigningCertificateInfo
1.2.840.113549.1.9.16.2.14 SignatureTimestampToken Single-valued byte[]

Summary

Constants
String CHALLENGE_PASSWORD_STR
String CONTENT_TYPE_STR
String COUNTERSIGNATURE_STR
String EMAIL_ADDRESS_STR
String EXTENDED_CERTIFICATE_ATTRIBUTES_STR
String EXTENSION_REQUEST_STR
String ISSUER_SERIALNUMBER_STR
String MESSAGE_DIGEST_STR
String SIGNATURE_TIMESTAMP_TOKEN_STR
String SIGNING_CERTIFICATE_STR
String SIGNING_TIME_STR
String SMIME_CAPABILITY_STR
String UNSTRUCTURED_ADDRESS_STR
String UNSTRUCTURED_NAME_STR
Fields
public static final ObjectIdentifier CHALLENGE_PASSWORD_OID
public static final ObjectIdentifier CONTENT_TYPE_OID
public static final ObjectIdentifier COUNTERSIGNATURE_OID
public static final ObjectIdentifier EMAIL_ADDRESS_OID
public static final ObjectIdentifier EXTENDED_CERTIFICATE_ATTRIBUTES_OID
public static final ObjectIdentifier EXTENSION_REQUEST_OID
public static final ObjectIdentifier ISSUER_SERIALNUMBER_OID
public static final ObjectIdentifier MESSAGE_DIGEST_OID
public static final ObjectIdentifier SIGNATURE_TIMESTAMP_TOKEN_OID
public static final ObjectIdentifier SIGNING_CERTIFICATE_OID
public static final ObjectIdentifier SIGNING_TIME_OID
public static final ObjectIdentifier SMIME_CAPABILITY_OID
public static final ObjectIdentifier UNSTRUCTURED_ADDRESS_OID
public static final ObjectIdentifier UNSTRUCTURED_NAME_OID
Public Constructors
PKCS9Attribute(ObjectIdentifier oid, Object value)
Construct an attribute object from the attribute's OID and value.
PKCS9Attribute(String name, Object value)
Construct an attribute object from the attribute's name and value.
PKCS9Attribute(DerValue derVal)
Construct a PKCS9Attribute from its encoding on an input stream.
Public Methods
void derEncode(OutputStream out)
Write the DER encoding of this attribute to an output stream.
String getName()
Return the name of this attribute.
static String getName(ObjectIdentifier oid)
Return the attribute name for a given OID or null if we don't recognize the oid.
static ObjectIdentifier getOID(String name)
Return the OID for a given attribute name or null if we don't recognize the name.
ObjectIdentifier getOID()
Return the OID of this attribute.
Object getValue()
Get the value of this attribute.
boolean isSingleValued()
Show whether this attribute is single-valued.
String toString()
Returns a string representation of this attribute.
[Expand]
Inherited Methods
From class java.lang.Object
From interface sun.security.util.DerEncoder

Constants

public static final String CHALLENGE_PASSWORD_STR

Constant Value: "ChallengePassword"

public static final String CONTENT_TYPE_STR

Constant Value: "ContentType"

public static final String COUNTERSIGNATURE_STR

Constant Value: "Countersignature"

public static final String EMAIL_ADDRESS_STR

Constant Value: "EmailAddress"

public static final String EXTENDED_CERTIFICATE_ATTRIBUTES_STR

Constant Value: "ExtendedCertificateAttributes"

public static final String EXTENSION_REQUEST_STR

Constant Value: "ExtensionRequest"

public static final String ISSUER_SERIALNUMBER_STR

Constant Value: "IssuerAndSerialNumber"

public static final String MESSAGE_DIGEST_STR

Constant Value: "MessageDigest"

public static final String SIGNATURE_TIMESTAMP_TOKEN_STR

Constant Value: "SignatureTimestampToken"

public static final String SIGNING_CERTIFICATE_STR

Constant Value: "SigningCertificate"

public static final String SIGNING_TIME_STR

Constant Value: "SigningTime"

public static final String SMIME_CAPABILITY_STR

Constant Value: "SMIMECapability"

public static final String UNSTRUCTURED_ADDRESS_STR

Constant Value: "UnstructuredAddress"

public static final String UNSTRUCTURED_NAME_STR

Constant Value: "UnstructuredName"

Fields

public static final ObjectIdentifier CHALLENGE_PASSWORD_OID

public static final ObjectIdentifier CONTENT_TYPE_OID

public static final ObjectIdentifier COUNTERSIGNATURE_OID

public static final ObjectIdentifier EMAIL_ADDRESS_OID

public static final ObjectIdentifier EXTENDED_CERTIFICATE_ATTRIBUTES_OID

public static final ObjectIdentifier EXTENSION_REQUEST_OID

public static final ObjectIdentifier ISSUER_SERIALNUMBER_OID

public static final ObjectIdentifier MESSAGE_DIGEST_OID

public static final ObjectIdentifier SIGNATURE_TIMESTAMP_TOKEN_OID

public static final ObjectIdentifier SIGNING_CERTIFICATE_OID

public static final ObjectIdentifier SIGNING_TIME_OID

public static final ObjectIdentifier SMIME_CAPABILITY_OID

public static final ObjectIdentifier UNSTRUCTURED_ADDRESS_OID

public static final ObjectIdentifier UNSTRUCTURED_NAME_OID

Public Constructors

public PKCS9Attribute (ObjectIdentifier oid, Object value)

Construct an attribute object from the attribute's OID and value. If the attribute is single-valued, provide only one value. If the attribute is multi-valued, provide an array containing all the values. Arrays of length zero are accepted, though probably useless.

The table gives the class that value must have for a given attribute.

public PKCS9Attribute (String name, Object value)

Construct an attribute object from the attribute's name and value. If the attribute is single-valued, provide only one value. If the attribute is multi-valued, provide an array containing all the values. Arrays of length zero are accepted, though probably useless.

The table gives the class that value must have for a given attribute. Reasonable variants of these attributes are accepted; in particular, case does not matter.

Throws
IllegalArgumentException if the name is not recognized of the value has the wrong type.

public PKCS9Attribute (DerValue derVal)

Construct a PKCS9Attribute from its encoding on an input stream.

Throws
IOException on parsing error.

Public Methods

public void derEncode (OutputStream out)

Write the DER encoding of this attribute to an output stream.

N.B.: This method always encodes values of ChallengePassword and UnstructuredAddress attributes as ASN.1 PrintableStrings, without checking whether they should be encoded as T61Strings.

Parameters
out the stream on which the DER encoding is written.
Throws
IOException

public String getName ()

Return the name of this attribute.

public static String getName (ObjectIdentifier oid)

Return the attribute name for a given OID or null if we don't recognize the oid.

public static ObjectIdentifier getOID (String name)

Return the OID for a given attribute name or null if we don't recognize the name.

public ObjectIdentifier getOID ()

Return the OID of this attribute.

public Object getValue ()

Get the value of this attribute. If the attribute is single-valued, return just the one value. If the attribute is multi-valued, return an array containing all the values. It is possible for this array to be of length 0.

The table gives the class of the value returned, depending on the type of this attribute.

public boolean isSingleValued ()

Show whether this attribute is single-valued.

public String toString ()

Returns a string representation of this attribute.

Returns
  • a string representation of the object.