Package netscape.security.x509
Class Attribute
- java.lang.Object
-
- netscape.security.x509.Attribute
-
- All Implemented Interfaces:
java.io.Serializable
,DerEncoder
public final class Attribute extends java.lang.Object implements java.io.Serializable, DerEncoder
An attribute, as identified by some attribute ID, has some particular values. Values are as a rule ASN.1 printable strings. A conventional set of type IDs is recognized when parsing. The following shows the syntax:Attribute ::= SEQUENCE { type AttributeType, value SET OF AttributeValue -- at least one value is required --} AttributeType ::= OBJECT IDENTIFIER AttributeValue ::= ANY
Refer to draft-ietf-pkix-ipki-part1-11 for the support attributes listed on page 96 of the internet draft. The are listed here for easy reference: name, common name, surname, given name, initials, generation qualifier, dn qualifier, country name, locality name, state or province name, organization name, organization unit name, title, pkcs9 email. Not all the attributes are supported. Please check the X500NameAttrMap for defined attributes.- Author:
- Christine Ho
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected X500NameAttrMap
attrMap
-
Constructor Summary
Constructors Constructor Description Attribute(java.lang.String attr, java.util.Vector<java.lang.String> values)
Construct an attribute from attribute type and attribute valuesAttribute(DerValue val)
Construct an attribute from a der encoded object.Attribute(ObjectIdentifier oid, java.lang.String value)
Construct an attribute from attribute type and attribute valueAttribute(ObjectIdentifier oid, java.util.Vector<java.lang.String> values)
Construct an attribute from attribute type and attribute values
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
derEncode(java.io.OutputStream out)
DER encode this object onto an output stream.void
encode(DerOutputStream out)
Encodes the Attribute to a Der output stream.ObjectIdentifier
getOid()
Returns the OID in the Attribute.java.util.Enumeration<java.lang.String>
getValues()
Returns enumeration of values in this attribute.java.lang.String
toString()
Prints a string version of this extension.
-
-
-
Field Detail
-
attrMap
protected transient X500NameAttrMap attrMap
-
-
Constructor Detail
-
Attribute
public Attribute(ObjectIdentifier oid, java.lang.String value) throws java.io.IOException
Construct an attribute from attribute type and attribute value- Parameters:
oid
- the object identifier of the attribute typevalue
- the value string- Throws:
java.io.IOException
-
Attribute
public Attribute(ObjectIdentifier oid, java.util.Vector<java.lang.String> values) throws java.io.IOException
Construct an attribute from attribute type and attribute values- Parameters:
oid
- the object identifier of the attribute typevalues
- String value vector- Throws:
java.io.IOException
-
Attribute
public Attribute(java.lang.String attr, java.util.Vector<java.lang.String> values) throws java.io.IOException
Construct an attribute from attribute type and attribute values- Parameters:
oid
- attribute type string CN,OU,O,C,L,TITLE,ST,STREET,UID,MAIL,E,DCvalues
- String value vector- Throws:
java.io.IOException
-
Attribute
public Attribute(DerValue val) throws java.io.IOException
Construct an attribute from a der encoded object. This der der encoded value should represent the attribute object.- Parameters:
value
- the attribute object in der encode form.- Throws:
java.io.IOException
-
-
Method Detail
-
getOid
public ObjectIdentifier getOid()
Returns the OID in the Attribute.- Returns:
- the ObjectIdentifier in this Attribute.
-
getValues
public java.util.Enumeration<java.lang.String> getValues()
Returns enumeration of values in this attribute.- Returns:
- Enumeration of values of this Attribute.
-
encode
public void encode(DerOutputStream out) throws java.io.IOException
Encodes the Attribute to a Der output stream. Attribute are encoded as a SEQUENCE of two elements.- Parameters:
out
- The Der output stream.- Throws:
java.io.IOException
-
derEncode
public void derEncode(java.io.OutputStream out) throws java.io.IOException
DER encode this object onto an output stream. Implements theDerEncoder
interface.- Specified by:
derEncode
in interfaceDerEncoder
- Parameters:
out
- the output stream on which to write the DER encoding.- Throws:
java.io.IOException
- on encoding error.
-
toString
public java.lang.String toString()
Prints a string version of this extension.- Overrides:
toString
in classjava.lang.Object
-
-