com.rsa.certj.cert.extensions

Class ExtensionAttribute

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

public class ExtensionAttribute
extends Object
implements Cloneable, Serializable

This class holds and builds an ExtensionAttribute object that is used in the GeneralName class.

The ASN.1 definition is as follows:

 ExtensionAttribute ::=  SEQUENCE {
   extension-attribute-type [0] INTEGER (0..ub-extension-attributes),
   extension-attribute-value [1]
            ANY DEFINED BY extension-attribute-type }

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

See Also

Serialized Form

Field Summary

static int

COMMON_NAME

Specifies the COMMON_NAME type of the ExtensionAttribute.

static int

EXTENDED_NETWORK_ADDRESS

Specifies the EXTENDED_NETWORK_ADDRESS type of the ExtensionAttribute.

static int

EXTENSION_OR_ADDRESS_COMPONENTS

Specifies the EXTENSION_OR_ADDRESS_COMPONENTS type of the ExtensionAttribute.

static int

EXTENSION_PHYSICAL_DELIVERY_ADDRESS_COMPONENTS

Specifies the EXTENSION_PHYSICAL_DELIVERY_ADDRESS_COMPONENTS type of the ExtensionAttribute.

static int

LOCAL_POSTAL_ATTRIBUTES

Specifies the LOCAL_POSTAL_ATTRIBUTES type of the ExtensionAttribute.

static int

PDS_NAME

Specifies the PDS_NAME type of the ExtensionAttribute.

static int

PHYSICAL_DELIVERY_COUNTRY_NAME

Specifies the PHYSICAL_DELIVERY_COUNTRY_NAME type of the ExtensionAttribute.

static int

PHYSICAL_DELIVERY_OFFICE_NAME

Specifies the PHYSICAL_DELIVERY_OFFICE_NAME type of the ExtensionAttribute.

static int

PHYSICAL_DELIVERY_OFFICE_NUMBER

Specifies the PHYSICAL_DELIVERY_OFFICE_NUMBER type of the ExtensionAttribute.

static int

PHYSICAL_DELIVERY_ORGANIZATION_NAME

Specifies the PHYSICAL_DELIVERY_ORGANIZATION_NAME type of the ExtensionAttribute.

static int

PHYSICAL_DELIVERY_PERSONAL_NAME

Specifies the PHYSICAL_DELIVERY_PERSONAL_NAME type of the ExtensionAttribute.

static int

POST_OFFICE_BOX_ADDRESS

Specifies the POST_OFFICE_BOX_ADDRESS type of the ExtensionAttribute.

static int

POSTAL_CODE

Specifies the POSTAL_CODE type of the ExtensionAttribute.

static int

POSTE_RESTANTE_ADDRESS

Specifies the POSTE_RESTANTE_ADDRESS type of the ExtensionAttribute.

static int

STREET_ADDRESS

Specifies the STREET_ADDRESS \ type of the ExtensionAttribute.

static int

TELETEX_COMMON_NAME

Specifies the TELETEX_COMMON_NAME type of the ExtensionAttribute.

static int

TELETEX_DOMAIN_DEFINED_ATTRIBUTES

Specifies the TELETEX_DOMAIN_DEFINED_ATTRIBUTES type of the ExtensionAttribute.

static int

TELETEX_ORGANIZATION_NAME

Specifies the TELETEX_ORGANIZATION_NAME type of the ExtensionAttribute.

static int

TELETEX_ORGANIZATIONAL_UNIT_NAMES

Specifies the TELETEX_ORGANIZATIONAL_UNIT_NAMES type of the ExtensionAttribute.

static int

TELETEX_PERSONAL_NAME

Specifies the ELETEX_PERSONAL_NAME type of the ExtensionAttribute.

static int

TERMINAL_TYPE

Specifies the TERMINAL_TYPE type of the ExtensionAttribute.

static int

UNFORMATTED_POSTAL_ADDRESS

Specifies the UNFORMATTED_POSTAL_ADDRESS type of the ExtensionAttribute.

static int

UNIQUE_POSTAL_NAME

Specifies the UNIQUE_POSTAL_NAME type of the ExtensionAttribute.

 

Constructor Summary

ExtensionAttribute()

The default constructor for this class.

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

Constructs an ExtensionAttribute object and initializes it with the given values.

 

Method Summary

 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 ExtensionAttribute, returns false otherwise.

 Object

getAttribute()

Gets the attribute value.

 int

getAttributeType()

Gets the attribute type.

 int

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

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

 int

getDERLen(int special)

Returns the number of bytes that will be used by the DER encoding of this ExtensionAttribute object.

static int

getNextBEROffset(byte[] nameBER, int offset)

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

 void

setAttribute(int type, Object value)

Sets the attribute's type and value.

 String

toString()

Returns a String that describes the ExtensionAttribute object.

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

Field Detail

COMMON_NAME

public static final int COMMON_NAME
Specifies the COMMON_NAME type of the ExtensionAttribute.

TELETEX_COMMON_NAME

public static final int TELETEX_COMMON_NAME
Specifies the TELETEX_COMMON_NAME type of the ExtensionAttribute.

TELETEX_ORGANIZATION_NAME

public static final int TELETEX_ORGANIZATION_NAME
Specifies the TELETEX_ORGANIZATION_NAME type of the ExtensionAttribute.

TELETEX_PERSONAL_NAME

public static final int TELETEX_PERSONAL_NAME
Specifies the ELETEX_PERSONAL_NAME type of the ExtensionAttribute.

TELETEX_ORGANIZATIONAL_UNIT_NAMES

public static final int TELETEX_ORGANIZATIONAL_UNIT_NAMES
Specifies the TELETEX_ORGANIZATIONAL_UNIT_NAMES type of the ExtensionAttribute.

TELETEX_DOMAIN_DEFINED_ATTRIBUTES

public static final int TELETEX_DOMAIN_DEFINED_ATTRIBUTES
Specifies the TELETEX_DOMAIN_DEFINED_ATTRIBUTES type of the ExtensionAttribute.

PDS_NAME

public static final int PDS_NAME
Specifies the PDS_NAME type of the ExtensionAttribute.

PHYSICAL_DELIVERY_COUNTRY_NAME

public static final int PHYSICAL_DELIVERY_COUNTRY_NAME
Specifies the PHYSICAL_DELIVERY_COUNTRY_NAME type of the ExtensionAttribute.

POSTAL_CODE

public static final int POSTAL_CODE
Specifies the POSTAL_CODE type of the ExtensionAttribute.

PHYSICAL_DELIVERY_OFFICE_NAME

public static final int PHYSICAL_DELIVERY_OFFICE_NAME
Specifies the PHYSICAL_DELIVERY_OFFICE_NAME type of the ExtensionAttribute.

PHYSICAL_DELIVERY_OFFICE_NUMBER

public static final int PHYSICAL_DELIVERY_OFFICE_NUMBER
Specifies the PHYSICAL_DELIVERY_OFFICE_NUMBER type of the ExtensionAttribute.

EXTENSION_OR_ADDRESS_COMPONENTS

public static final int EXTENSION_OR_ADDRESS_COMPONENTS
Specifies the EXTENSION_OR_ADDRESS_COMPONENTS type of the ExtensionAttribute.

PHYSICAL_DELIVERY_PERSONAL_NAME

public static final int PHYSICAL_DELIVERY_PERSONAL_NAME
Specifies the PHYSICAL_DELIVERY_PERSONAL_NAME type of the ExtensionAttribute.

PHYSICAL_DELIVERY_ORGANIZATION_NAME

public static final int PHYSICAL_DELIVERY_ORGANIZATION_NAME
Specifies the PHYSICAL_DELIVERY_ORGANIZATION_NAME type of the ExtensionAttribute.

EXTENSION_PHYSICAL_DELIVERY_ADDRESS_COMPONENTS

public static final int EXTENSION_PHYSICAL_DELIVERY_ADDRESS_COMPONENTS
Specifies the EXTENSION_PHYSICAL_DELIVERY_ADDRESS_COMPONENTS type of the ExtensionAttribute.

UNFORMATTED_POSTAL_ADDRESS

public static final int UNFORMATTED_POSTAL_ADDRESS
Specifies the UNFORMATTED_POSTAL_ADDRESS type of the ExtensionAttribute.

STREET_ADDRESS

public static final int STREET_ADDRESS
Specifies the STREET_ADDRESS \ type of the ExtensionAttribute.

POST_OFFICE_BOX_ADDRESS

public static final int POST_OFFICE_BOX_ADDRESS
Specifies the POST_OFFICE_BOX_ADDRESS type of the ExtensionAttribute.

POSTE_RESTANTE_ADDRESS

public static final int POSTE_RESTANTE_ADDRESS
Specifies the POSTE_RESTANTE_ADDRESS type of the ExtensionAttribute.

UNIQUE_POSTAL_NAME

public static final int UNIQUE_POSTAL_NAME
Specifies the UNIQUE_POSTAL_NAME type of the ExtensionAttribute.

LOCAL_POSTAL_ATTRIBUTES

public static final int LOCAL_POSTAL_ATTRIBUTES
Specifies the LOCAL_POSTAL_ATTRIBUTES type of the ExtensionAttribute.

EXTENDED_NETWORK_ADDRESS

public static final int EXTENDED_NETWORK_ADDRESS
Specifies the EXTENDED_NETWORK_ADDRESS type of the ExtensionAttribute.

TERMINAL_TYPE

public static final int TERMINAL_TYPE
Specifies the TERMINAL_TYPE type of the ExtensionAttribute.
Constructor Detail

ExtensionAttribute

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

Parameters

         valueBER  

A byte array containing the BER encoding of the ExtensionAttribute object.

         offset  

The offset into valueBER where the encoding begins.

         special  

The special circumstances of the BER or DER encoding. 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.

ExtensionAttribute

public ExtensionAttribute()
The default constructor for this class.
Method Detail

setAttribute

public void setAttribute(int type,
                         Object value)
                  throws NameException
Sets the attribute's type and value.

Parameters

         type  

An int that specifies the attribute's type.

         value  

An object that specifies the attribute's value. It should be set to one of the fields previously defined in this class.

  • For TeletexOrganizationalUnitNames, value should be represented as a Vector of Strings.
  • For TerminalType, value should be represented as an int.

Throws

NameException - If specified type or value has wrong data.

getAttributeType

public int getAttributeType()
Gets the attribute type.

Returns

The attribute type.

getAttribute

public Object getAttribute()
Gets the attribute value.

Returns

An object that specifies the attribute's value. (Be sure to cast the returned value to the correct type.)

toString

public String toString()
Returns a String that describes the ExtensionAttribute 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 encoding of an ExtensionAttribute object, beginning at offset, finds the index to the next element in the encoding. In other words, this method gets the next offset after the ExtensionAttribute object.

For example, if the offset is 120 and the ExtensionAttribute object's BER encoding is 1819 bytes, then this method will return 1939, the index immediately following the ExtensionAttribute object. That is, nameBER[120] is the first byte in the encoding of the ExtensionAttribute object, nameBER[1938] is the last byte in the encoding of the ExtensionAttribute object, and the next element begins at index 1939.

Parameters

         nameBER  

The BER encoding of an ExtensionAttribute.

         offset  

The offset into nameBER where the encoding begins.

Returns

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 number of bytes that will be used by the DER encoding of this ExtensionAttribute object. If this object is not yet set with values, then this method returns zero.

Parameters

         special  

The special circumstances of the DER 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.

Returns

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

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 ExtensionAttribute 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. To indicate that the DER encoding should follow any special instructions, use the special argument.

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  

A 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. 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.

Returns

The number of bytes 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 ExtensionAttribute, returns false otherwise.

Overrides

equals in class Object

Parameters

         obj  

An instance of the ExtensionAttribute 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 ExtensionAttribute 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