|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iaik.asn1.structures.Attributes
An container class for X.509 Attributes.
This class may be used as a container for adding, inserting, removing, encoding
X.509 Attributes
. When encoding the attributes
included in the container, they may be BER encoded either as ASN.1 SET OF
or as ASN.1 SEQUENCE OF
Attributes.
Field Summary | |
protected Vector |
attributes_
The Attribute repository (order may be of interest). |
Constructor Summary | |
Attributes()
Empty constructor. |
|
Attributes(ASN1Object attributes)
Creates an Attribute container from a SET OF or SEQUENCE OF attributes. |
|
Attributes(Attribute[] attributes)
Creates an Attribute container from the given list of attributes. |
|
Attributes(byte[] encodedAttributes)
Creates an Attribute container from a BER encoded SET OF or SEQUENCE OF attributes. |
|
Attributes(InputStream is)
Creates an Attribute container from a BER encoded SET OF or SEQUENCE OF attributes. |
Method Summary | |
void |
addAttribute(Attribute attribute)
Adds the given attribute. |
void |
addAttribute(Attribute attribute,
boolean replace)
Adds the given attribute. |
void |
addAttributes(Attribute[] attributes)
Adds the given attributes. |
void |
clearAll()
Clears all attributes included in the container. |
Attribute |
getAttribute(ObjectID type)
Returns the first attribute with the given type. |
Enumeration |
getAttributes()
Returns all attributes included in the container. |
Attribute[] |
getAttributes(ObjectID type)
Returns all attributes with the given type. |
void |
insertAttributeAt(Attribute attribute,
int index)
Inserts the given attribute. |
boolean |
removeAttribute(Attribute attribute)
Removes the first representative of the given attribute. |
Attribute |
removeAttribute(ObjectID type)
Removes the first attribute with the given type from the container |
boolean |
removeAttributes(Attribute attribute)
Removes all representatives of the given attribute from the container. |
Attribute[] |
removeAttributes(ObjectID type)
Removes all attributes with the given type from the container |
Attribute[] |
toArray()
Returns an array containing all the attributes included in this container. |
SEQUENCE |
toAsn1SEQUENCE()
Returns the attributes included in this container as ASN.1 SEQUENCE. |
SET |
toAsn1SET()
Returns the attributes included in this container as ASN.1 SET. |
SET |
toAsn1SET(boolean sorted)
Returns the attributes included in this container as ASN.1 SET. |
String |
toString()
Returns a string that lists all the Attributes hold in this container. |
void |
writeToAsn1SEQUENCE(OutputStream os)
Builds an ASN.1 SEQUENCE of the attributes included in this container and writes it encoded to the given output stream. |
void |
writeToAsn1SET(OutputStream os)
Builds an ASN.1 SET of the attributes included in this container and writes it encoded to the given output stream. |
void |
writeToAsn1SET(OutputStream os,
boolean sorted)
Builds an ASN.1 SET of the attributes included in this container and writes it encoded to the given output stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Vector attributes_
Constructor Detail |
public Attributes()
public Attributes(Attribute[] attributes)
attributes
- the attributes to be added to the containerpublic Attributes(ASN1Object attributes) throws CodingException
attributes
- the ASN.1 SET OF or SEQUENCE OF attributes to be parsedCodingException
- if an error occurs while parsing the attributespublic Attributes(InputStream is) throws CodingException, IOException
is
- the inputstream supplying the encoded ASN.1 SET OF or SEQUENCE OF attributes to be parsedCodingException
- if an error occurs while parsing the attributespublic Attributes(byte[] encodedAttributes) throws CodingException
encodedAttributes
- the byte array supplying the encoded ASN.1 SET OF or SEQUENCE OF attributes to be parsedCodingException
- if an error occurs while parsing the attributesMethod Detail |
public void addAttribute(Attribute attribute)
attribute
- the attribute to be added.public void addAttribute(Attribute attribute, boolean replace)
attribute
- the attribute to be added.replace
- whether to replace any already existing attribute with the given typepublic void addAttributes(Attribute[] attributes)
attributes
- the attributes to be added.public void insertAttributeAt(Attribute attribute, int index)
attribute
- the attribute to be inserted.index
- the position at which to insert the attributepublic Enumeration getAttributes()
public Attribute getAttribute(ObjectID type)
null
otherwisepublic Attribute[] getAttributes(ObjectID type)
public Attribute[] toArray()
public void clearAll()
public boolean removeAttribute(Attribute attribute)
attribute
- the attribute to be removedtrue
if the attribute has been removed, false
if no
such attribute was presentpublic Attribute removeAttribute(ObjectID type)
type
- the type of the attribute to be removednull
if no
attribute with this type was presentpublic boolean removeAttributes(Attribute attribute)
attribute
- the attribute to be removedtrue
if the attributes have been removed, false
if no
such attribute was presentpublic Attribute[] removeAttributes(ObjectID type)
type
- the type of the attributes to be removedpublic SET toAsn1SET() throws CodingException
CodingException
- if an error occurs while building the SETpublic SET toAsn1SET(boolean sorted) throws CodingException
sorted
- whether to sort the elements of the SET when encoding itCodingException
- if an error occurs while building the SETpublic SEQUENCE toAsn1SEQUENCE() throws CodingException
CodingException
- if an error occurs while building the SEQUENCEpublic void writeToAsn1SET(OutputStream os) throws IOException
os
- the output stream to which to write the encoded SET of attributesIOException
- if an error occurs while building/encoding the SET or
writing it to the streampublic void writeToAsn1SET(OutputStream os, boolean sorted) throws IOException
os
- the output stream to which to write the encoded SET of attributessorted
- whether to sort the elements of the SET when encoding itIOException
- if an error occurs while building/encoding the SET or
writing it to the streampublic void writeToAsn1SEQUENCE(OutputStream os) throws IOException
os
- the output stream to which to write the encoded SEQUENCE of attributesIOException
- if an error occurs while building/encoding the SEQUENCE or
writing it to the streampublic String toString()
toString
in class Object
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |