APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.pkcs

public Class PKCS9Attributes

extends Object
Class Inheritance
Imports
java.io.IOException, java.util.Hashtable, sun.security.util.DerEncoder, .DerValue, .DerInputStream, .DerOutputStream, .ObjectIdentifier

A set of attributes of class PKCS9Attribute.
Author
Douglas Hoover

Field Summary

Modifier and TypeField and Description
private final Hashtable<ObjectIdentifier, PKCS9Attribute>
attributes

Attributes in this set indexed by OID.

private final byte[]
derEncoding

The DER encoding of this attribute set.

private boolean
private final Hashtable<ObjectIdentifier, ObjectIdentifier>
permittedAttributes

The keys of this hashtable are the OIDs of permitted attributes.

Constructor Summary

AccessConstructor and Description
public
PKCS9Attributes(ObjectIdentifier[]
Array of attribute OIDs that will be accepted.
permittedAttributes
,
DerInputStream
the contents of the DER encoding of the attribute set.
in
)

Construct a set of PKCS9 Attributes from its DER encoding on a DerInputStream, accepting only attributes with OIDs on the given list.

public
PKCS9Attributes(DerInputStream
the contents of the DER encoding of the attribute set.
in
)

Construct a set of PKCS9 Attributes from the contents of its DER encoding on a DerInputStream.

public
PKCS9Attributes(DerInputStream
the contents of the DER encoding of the attribute set.
in
,
boolean
If true then any attributes not supported by the PKCS9Attribute class are ignored. Otherwise, unsupported attributes cause an exception to be thrown.
ignoreUnsupportedAttributes
)

Construct a set of PKCS9 Attributes from the contents of its DER encoding on a DerInputStream.

public
PKCS9Attributes(PKCS9Attribute[] attribs)

Construct a set of PKCS9 Attributes from the given array of PKCS9 attributes.

Method Summary

Modifier and TypeMethod and Description
private byte[]
decode(DerInputStream
the contents of the DER encoding of the attribute set.
in
)

Decode this set of PKCS9 attributes from the contents of its DER encoding.

public void
encode(byte
the implicit tag to use in the DER encoding.
tag
,
DerOutputStream
the output stream on which to put the DER encoding.
out
)

Put the DER encoding of this PKCS9 attribute set on an DerOutputStream, tagged with the given implicit tag.

private byte[]
public PKCS9Attribute
getAttribute(ObjectIdentifier oid)

Get an attribute from this set.

public PKCS9Attribute
getAttribute(String name)

Get an attribute from this set.

public Object
getAttributeValue(ObjectIdentifier oid)

Get an attribute value by OID.

public Object
getAttributeValue(String name)

Get an attribute value by type name.

public byte[]
getDerEncoding()

Return the DER encoding of this attribute set, tagged with DerValue.tag_SetOf.

public String
toString()

Overrides java.lang.Object.toString.

Returns the PKCS9 block in a printable string form.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

attributesback to summary
private final Hashtable<ObjectIdentifier, PKCS9Attribute> attributes

Attributes in this set indexed by OID.

derEncodingback to summary
private final byte[] derEncoding

The DER encoding of this attribute set. The tag byte must be DerValue.tag_SetOf.

ignoreUnsupportedAttributesback to summary
private boolean ignoreUnsupportedAttributes
permittedAttributesback to summary
private final Hashtable<ObjectIdentifier, ObjectIdentifier> permittedAttributes

The keys of this hashtable are the OIDs of permitted attributes.

Constructor Detail

PKCS9Attributesback to summary
public PKCS9Attributes(ObjectIdentifier[] permittedAttributes, DerInputStream in) throws IOException

Construct a set of PKCS9 Attributes from its DER encoding on a DerInputStream, accepting only attributes with OIDs on the given list. If the array is null, accept all attributes supported by class PKCS9Attribute.

Parameters
permittedAttributes:ObjectIdentifier[]

Array of attribute OIDs that will be accepted.

in:DerInputStream

the contents of the DER encoding of the attribute set.

Exceptions
IOException:
on i/o error, encoding syntax error, unacceptable or unsupported attribute, or duplicate attribute.
See Also
PKCS9Attribute
PKCS9Attributesback to summary
public PKCS9Attributes(DerInputStream in) throws IOException

Construct a set of PKCS9 Attributes from the contents of its DER encoding on a DerInputStream. Accept all attributes supported by class PKCS9Attribute and reject any unsupported attributes.

Parameters
in:DerInputStream

the contents of the DER encoding of the attribute set.

Exceptions
IOException:
on i/o error, encoding syntax error, or unsupported or duplicate attribute.
See Also
PKCS9Attribute
PKCS9Attributesback to summary
public PKCS9Attributes(DerInputStream in, boolean ignoreUnsupportedAttributes) throws IOException

Construct a set of PKCS9 Attributes from the contents of its DER encoding on a DerInputStream. Accept all attributes supported by class PKCS9Attribute and ignore any unsupported attributes, if directed.

Parameters
in:DerInputStream

the contents of the DER encoding of the attribute set.

ignoreUnsupportedAttributes:boolean

If true then any attributes not supported by the PKCS9Attribute class are ignored. Otherwise, unsupported attributes cause an exception to be thrown.

Exceptions
IOException:
on i/o error, encoding syntax error, or unsupported or duplicate attribute.
See Also
PKCS9Attribute
PKCS9Attributesback to summary
public PKCS9Attributes(PKCS9Attribute[] attribs) throws IllegalArgumentException

Construct a set of PKCS9 Attributes from the given array of PKCS9 attributes. DER encoding on a DerInputStream. All attributes in attribs must be supported by class PKCS9Attribute.

Exceptions
IOException:
on i/o error, encoding syntax error, or unsupported or duplicate attribute.
See Also
PKCS9Attribute

Method Detail

decodeback to summary
private byte[] decode(DerInputStream in) throws IOException

Decode this set of PKCS9 attributes from the contents of its DER encoding. Ignores unsupported attributes when directed.

Parameters
in:DerInputStream

the contents of the DER encoding of the attribute set.

Exceptions
IOException:
on i/o error, encoding syntax error, unacceptable or unsupported attribute, or duplicate attribute.
encodeback to summary
public void encode(byte tag, DerOutputStream out)

Put the DER encoding of this PKCS9 attribute set on an DerOutputStream, tagged with the given implicit tag.

Parameters
tag:byte

the implicit tag to use in the DER encoding.

out:DerOutputStream

the output stream on which to put the DER encoding.

generateDerEncodingback to summary
private byte[] generateDerEncoding()
getAttributeback to summary
public PKCS9Attribute getAttribute(ObjectIdentifier oid)

Get an attribute from this set.

getAttributeback to summary
public PKCS9Attribute getAttribute(String name)

Get an attribute from this set.

getAttributeValueback to summary
public Object getAttributeValue(ObjectIdentifier oid) throws IOException

Get an attribute value by OID.

getAttributeValueback to summary
public Object getAttributeValue(String name) throws IOException

Get an attribute value by type name.

getDerEncodingback to summary
public byte[] getDerEncoding()

Return the DER encoding of this attribute set, tagged with DerValue.tag_SetOf.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns the PKCS9 block in a printable string form.

Annotations
@Override