|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iaik.x509.V3Extension | +--iaik.x509.extensions.SubjectDirectoryAttributes
This class implements the SubjectDirectoryAttributes
Extension.
The SubjectDirectoryAttributes
extension is a non critical
standard X509v3 extension.
Each extension is associated with a specific certificateExtension
object identifier, derived from:
certificateExtension OBJECT IDENTIFIER ::= {joint-iso-ccitt(2) ds(5) 29} id-ce OBJECT IDENTIFIER ::= certificateExtension
The object identifier for the SubjectDirectoryAttributes
extension
is defined as:
id-ce-SubjectDirectoryAttributes OBJECT IDENTIFIER ::= { id-ce 9 }
which corresponds to the OID string "2.5.29.9".
The X.509 Certificate and CRL profile presented in RFC 2459 specifies the
SubjectDirectoryAttributes extension as not essential extension which may
be used in local environments. The PKIX Qualified Certificate Profile
suggests the SubjectDirectoryAttributes for including additional attributes
describing the subject of a certificate (given in the subject field and the subject
alternative name extension).
ASN.1 definition:
SubjectDirectoryAttributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
More information can be found in RFC 2459, section 4.2.1.9 "Subject Directory Attributes".
An SubjectDirectoryAttributes
object may be created by either using the empty default
constructor, or by directly supplying the attributes to be added as instances
of Attribute
, e.g.:
Attribute[] attributes = new Attribute[2]; // Gender: PrintableString gender = new PrintableString("M"); attributes[0] = new Attribute(ObjectID.gender, new ASN1Object[] {gender}); // Postal Address: SEQUENCE postalAddress = new SEQUENCE(); postalAddress.addComponent(new UTF8String("A-8010 Graz, Austria")); postalAddress.addComponent(new UTF8String("Inffeldgasse 16A")); attributes[1] = new Attribute(ObjectID.postalAddress, new ASN1Object[] {postalAddress}); // create a SubjectDirectoryAttributes extension object: SubjectDirectoryAttributes sda = new SubjectDirectoryAttributes(attributes);
For adding a SubjectDirectoryAttributes
extension object to a X509Certificate, use
the addExtension
method of the X509Certificate
class:
X505Certificate cert = new X509Certificate(); ... cert.addExtension(sda);
Attribute
,
ObjectID
,
V3Extension
,
X509Extensions
,
X509Certificate
Field Summary | |
static ObjectID |
oid
The object identifier of this SubjectDirectoryAttributes extension. |
Fields inherited from class iaik.x509.V3Extension |
critical |
Constructor Summary | |
SubjectDirectoryAttributes()
Default constructor. |
|
SubjectDirectoryAttributes(Attribute[] attributes)
Creates an SubjectDirectoryAttributes object and adds a the
the given attributes.
|
Method Summary | |
Attribute |
getAttribute(ObjectID oid)
Returns the first attribute matching to the given ObjectID, if included in this SubjectDirectoryAttributes object. |
Attribute[] |
getAttributes()
Returns the attributes included in this SubjectDirectoryAttributes extension. |
ObjectID |
getObjectID()
Returns the object ID of this SubjectDirectoryAttributes extension |
int |
hashCode()
Returns a hashcode for this identity. |
void |
init(ASN1Object obj)
Inits this SubjectDirectoryAttributes implementation with an ASN1object
representing the value of this extension.
|
void |
setAttributes(Attribute[] attributes)
Sets the attributes of this SubjectDirectoryAttributes extension. |
ASN1Object |
toASN1Object()
Returns an ASN1Object representing the value of this SubjectDirectoryAttributes
extension object.
|
String |
toString()
Returns a string that represents the contents of this SubjectDirectoryAttributes extension. |
Methods inherited from class iaik.x509.V3Extension |
getName, isCritical, setCritical |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final ObjectID oid
Constructor Detail |
public SubjectDirectoryAttributes()
SubjectDirectoryAttributes
object.
For supplying the attributes (as instances of class iaik.asn1.structures.Attribute
to be included
call method setAttributes
, e.g.:
Attribute[] attributes = new Attribute[2]; // Gender: PrintableString gender = new PrintableString("M"); attributes[0] = new Attribute(ObjectID.gender, new ASN1Object[] {gender}); // Postal Address: SEQUENCE postalAddress = new SEQUENCE(); postalAddress.addComponent(new UTF8String("A-8010 Graz, Austria")); postalAddress.addComponent(new UTF8String("Inffeldgasse 16A")); attributes[1] = new Attribute(ObjectID.postalAddress, new ASN1Object[] {postalAddress}); // create a SubjectDirectoryAttributes extension object: SubjectDirectoryAttributes sda = new SubjectDirectoryAttributes(); // set the attributes: sda.setAttributes(attributes); // add the extension to a certificate: cert.addExtension(sda);
public SubjectDirectoryAttributes(Attribute[] attributes)
SubjectDirectoryAttributes
object and adds a the
the given attributes.
The following example creates a SubjectDirectoryAttributes extension for a Gender
and a PostalAddress attribute. The attributes are represented as instances of
class iaik.asn1.structures.Attribute
, e.g.:
Attribute[] attributes = new Attribute[2]; // Gender: PrintableString gender = new PrintableString("M"); attributes[0] = new Attribute(ObjectID.gender, new ASN1Object[] {gender}); // Postal Address: SEQUENCE postalAddress = new SEQUENCE(); postalAddress.addComponent(new UTF8String("A-8010 Graz, Austria")); postalAddress.addComponent(new UTF8String("Inffeldgasse 16A")); attributes[1] = new Attribute(ObjectID.postalAddress, new ASN1Object[] {postalAddress}); // create a SubjectDirectoryAttributes extension object: SubjectDirectoryAttributes sda = new SubjectDirectoryAttributes(attributes); // add the extension to a certificate: cert.addExtension(sda);
attributes
- a set of attributes to be included into this
SubjectDirectoryAttributes extensionMethod Detail |
public ObjectID getObjectID()
SubjectDirectoryAttributes
extensiongetObjectID
in class V3Extension
public void setAttributes(Attribute[] attributes)
The following example creates a SubjectDirectoryAttributes extension for a Gender
and a PostalAddress attribute. The attributes are represented as instances of
class iaik.asn1.structures.Attribute
, e.g.:
Attribute[] attributes = new Attribute[2]; // Gender: PrintableString gender = new PrintableString("M"); attributes[0] = new Attribute(ObjectID.gender, new ASN1Object[] {gender}); // Postal Address: SEQUENCE postalAddress = new SEQUENCE(); postalAddress.addComponent(new UTF8String("A-8010 Graz, Austria")); postalAddress.addComponent(new UTF8String("Inffeldgasse 16A")); attributes[1] = new Attribute(ObjectID.postalAddress, new ASN1Object[] {postalAddress}); // create a SubjectDirectoryAttributes extension object: SubjectDirectoryAttributes sda = new SubjectDirectoryAttributes(); // set the attributes: sda.setAttributes(attributes); // add the extension to a certificate: cert.addExtension(sda);
attributes
- a set of attributes to be included into this
SubjectDirectoryAttributes extensionpublic Attribute[] getAttributes()
public Attribute getAttribute(ObjectID oid)
null
if there is no attribute for the given OIDpublic void init(ASN1Object obj) throws X509ExtensionException
SubjectDirectoryAttributes
implementation with an ASN1object
representing the value of this extension.
The given ASN1Object consits of a Sequence of attributes
included in the SubjectDirectoryAttributes
object.
The given ASN1Object is the one created by toASN1Object()
.
This method is used by the X509Extensions
class when parsing the ASN.1 representation
of a certificate for properly initializing an included
SubjectDirectoryAttributes extension. This method initializes the
extension only with its value, but not with its critical
specification. For that reason, this method shall not be
explicitly called by an application.
init
in class V3Extension
obj
- the SubjectDirectoryAttributes as ASN1ObjectX509ExtensionException
- if the extension could not be parsedpublic ASN1Object toASN1Object() throws X509ExtensionException
SubjectDirectoryAttributes
extension object.
The ASN1Object is an ASN.1 Sequence including any attribute that has been
added to this SubjectDirectoryAttributes
object.
SubjectDirectoryAttributesSyntax ::= SEQUENCE SIZE (1..MAX) OF Attribute
toASN1Object
in class V3Extension
SubjectDirectoryAttributes
as ASN1Objectpublic int hashCode()
hashCode
in class V3Extension
public String toString()
SubjectDirectoryAttributes
extension.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 |