com.rsa.certj.cert.extensions

Class BuiltInDomainDefinedAttributes

java.lang.Object
  |
  +--com.rsa.certj.cert.extensions.BuiltInDomainDefinedAttributes
All Implemented Interfaces:
Cloneable, Serializable

public class BuiltInDomainDefinedAttributes
extends Object
implements Cloneable, Serializable

This class is used in the GeneralName class.

The ASN.1 definition is as follows

 BuiltInDomainDefinedAttributes ::= SEQUENCE SIZE
                               (1..ub-domain-defined-attributes) OF
                               BuiltInDomainDefinedAttribute

 BuiltInDomainDefinedAttribute ::= SEQUENCE {
  type PrintableString (SIZE
                       (1..ub-domain-defined-attribute-type-length)),
  value PrintableString (SIZE
                       (1..ub-domain-defined-attribute-value-length))}

 ub-domain-defined-attributes INTEGER ::= 4
 ub-domain-defined-attribute-type-length INTEGER ::= 8
 ub-domain-defined-attribute-value-length INTEGER ::= 128

Copyright © RSA Security Inc., 1999-2001. All rights reserved.

See Also

Serialized Form

Constructor Summary

BuiltInDomainDefinedAttributes()

The default constructor for this class.

BuiltInDomainDefinedAttributes(byte[] valueBER, int offset, int special)

Constructs a BuiltInDomainDefinedAttributes object and initializes it with the given values.

 

Method Summary

 void

addAttribute(String type, String value)

Adds an Attribute with the specified type and value.

 Object

clone()

Overrides the default clone method to get a deeper clone.

 boolean

equals(Object obj)

Returns true if this object and obj contain the same BuiltInDomainDefinedAttributes; returns false otherwise.

 String[]

getAttribute(int Index)

Gets the attribute value for the index specified in Index.

 int

getAttributeCount()

Gets the number of attributes in this object.

 int

getDEREncoding(byte[] encoding, int offset, int special)

Places the DER encoding of the BuiltInDomainDefinedAttributes object into encoding, beginning at offset.

 int

getDERLen(int special)

Returns the length of the DER encoding of this attributes object.

static int

getNextBEROffset(byte[] nameBER, int offset)

Given nameBER, the BER of a BuiltInDomainDefinedAttributes object beginning at offset, finds the index to the next element in the encoding.

 String

toString()

Returns a String that describes this object.

 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BuiltInDomainDefinedAttributes

public BuiltInDomainDefinedAttributes()
The default constructor for this class.

BuiltInDomainDefinedAttributes

public BuiltInDomainDefinedAttributes(byte[] valueBER,
                                      int offset,
                                      int special)
                               throws NameException
Constructs a BuiltInDomainDefinedAttributes object and initializes it with the given values.

Parameters

         valueBER  

A byte array that contains the BER encoding of this object.

         offset  

The offset in the valueBER array where the encoding begins.

         special  

The special instructions of the BER encoding, if there are any. The following ASN.1 constants are possible values for special: APP_IMPLICIT, APP_EXPLICIT, PRIVATE_IMPLICIT, PRIVATE_EXPLICIT, OPTIONAL, DEFAULT, CONTEXT_IMPLICIT, or CONTEXT_EXPLICIT.

Throws

NameException - If the encoding is invalid.
Method Detail

addAttribute

public void addAttribute(String type,
                         String value)
                  throws NameException
Adds an Attribute with the specified type and value.

Parameters

         type  

A String that specifies the attribute type (no longer than 8 characters).

         value  

A String that specifies the attribute value (no longer than 128 characters).

Throws

NameException - If the specified values are too long.

getAttribute

public String[] getAttribute(int Index)
                      throws NameException
Gets the attribute value for the index specified in Index.

Parameters

         Index  

An int that specifies the attribute (from zero to 3) to retrieve.

Returns

The type and value of the specified attribute.

Throws

NameException - If the specified index is invalid.

getAttributeCount

public int getAttributeCount()
Gets the number of attributes in this object.

Returns

The number of attributes in this object.

toString

public String toString()
Returns a String that describes this object.

Overrides

toString in class Object

Returns

A String that describes this object.

getNextBEROffset

public static int getNextBEROffset(byte[] nameBER,
                                   int offset)
                            throws NameException
Given nameBER, the BER of a BuiltInDomainDefinedAttributes object beginning at offset, finds the index to the next element in the encoding. That is, this method gets the next offset after the specified BER.

For example, if the offset is 120 and the BER encoding is 1819 bytes, this method returns 1939, the index immediately following the attributes. That is, nameBER[120] is the first byte in the encoding of the attributes, nameBER[1938] is the last byte in the encoding of the attributes, and the next element begins at index 1939.

Parameters

         nameBER  

The BER encoding of a BuiltInDomainDefinedAttributes object.

         offset  

The offset into nameBER where the encoding begins.

Returns

An int that is the index to the next element in the BER encoding.

Throws

NameException - If the method cannot read the BER encoding.

getDERLen

public int getDERLen(int special)
              throws NameException
Returns the length of the DER encoding of this attributes object. If this object is not set with values, returns 0.

Parameters

         special  

The special DER circumstances of the encoding, if there are any.

Returns

The number of bytes that will be used by the DER encoding of this Attributes object.

Throws

NameException - If the method cannot get the length of the DER encoding.

getDEREncoding

public int getDEREncoding(byte[] encoding,
                          int offset,
                          int special)
                   throws NameException
Places the DER encoding of the BuiltInDomainDefinedAttributes object into encoding, beginning at offset. To determine the length of the encoding, call getDERLen. If this object is not yet set with values, then this method places nothing into the array and returns zero. Use the special argument if the DER encoding should follow any special instructions.

For example, to indicate the following:

      extension   [1] IMPLICIT Extension
 
pass in the following:

      special = (ASN1.IMPLICIT | 1);
 
If there are no special circumstances, pass in the following:

      special = 0
 
The following ASN.1 constants are possible values for special: APP_IMPLICIT, APP_EXPLICIT, PRIVATE_IMPLICIT, PRIVATE_EXPLICIT, OPTIONAL, DEFAULT, CONTEXT_IMPLICIT, or CONTEXT_EXPLICIT.

Parameters

         encoding  

The byte array into which the result will be placed.

         offset  

The offset into encoding where writing begins.

         special  

The special circumstances of the DER encoding, if there are any.

Returns

The number of bytes actually placed into encoding.

Throws

NameException - If the method cannot create the DER encoding.

equals

public boolean equals(Object obj)
Returns true if this object and obj contain the same BuiltInDomainDefinedAttributes; returns false otherwise.

Overrides

equals in class Object

Parameters

         obj  

An instance of the BuiltInDomainDefinedAttributes class.

Returns

A boolean indicating whether these objects are equal.

clone

public Object clone()
             throws CloneNotSupportedException
Overrides the default clone method to get a deeper clone.

Returns

A new BuiltInDomainDefinedAttribute object, a copy of this object.

Throws

CloneNotSupportedException - If the cloning operation is not successful.


RSA BSAFE ® Cert-J 2.1.1 001-047007-211-001-000