com.rsa.certj.cert.extensions

Class BuiltInStandardAttributes

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

public class BuiltInStandardAttributes
extends Object
implements Cloneable, Serializable

This class builds and holds a BuiltInStandardAttributes object, that is used in the GeneralName object.

The ASN.1 definition is as follows:

 BuiltInStandardAttributes ::= SEQUENCE {
  country-name CountryName OPTIONAL,
  administration-domain-name AdministrationDomainName OPTIONAL,
  network-address      [0] NetworkAddress OPTIONAL,
  terminal-identifier  [1] TerminalIdentifier OPTIONAL,
  private-domain-name  [2] PrivateDomainName OPTIONAL,
  organization-name    [3] OrganizationName OPTIONAL,
  numeric-user-identifier      [4] NumericUserIdentifier OPTIONAL,
  personal-name        [5] PersonalName OPTIONAL,
  organizational-unit-names    [6] OrganizationalUnitNames OPTIONAL
 }

 CountryName ::= [APPLICATION 1] CHOICE {
  x121-dcc-code NumericString
               (SIZE (ub-country-name-numeric-length)),
  iso-3166-alpha2-code PrintableString
               (SIZE (ub-country-name-alpha-length)) }

 AdministrationDomainName ::= [APPLICATION 2] CHOICE {
   numeric NumericString (SIZE (0..ub-domain-name-length)),
   printable PrintableString (SIZE (0..ub-domain-name-length)) }

 NetworkAddress ::= X121Address 
 X121Address ::= NumericString (SIZE (1..ub-x121-address-length))
 
 TerminalIdentifier ::= PrintableString (SIZE (1..ub-terminal-id-length))

 PrivateDomainName ::= CHOICE {
   numeric NumericString (SIZE (1..ub-domain-name-length)),
   printable PrintableString (SIZE (1..ub-domain-name-length)) }

 OrganizationName ::= PrintableString
                         (SIZE (1..ub-organization-name-length))

 NumericUserIdentifier ::= NumericString
                         (SIZE (1..ub-numeric-user-id-length))

 PersonalName ::= SET {
   surname [0] PrintableString (SIZE (1..ub-surname-length)),
   given-name [1] PrintableString
                       (SIZE (1..ub-given-name-length)) OPTIONAL,
  initials [2] PrintableString (SIZE (1..ub-initials-length)) OPTIONAL,
  generation-qualifier [3] PrintableString
               (SIZE (1..ub-generation-qualifier-length)) OPTIONAL }

 OrganizationalUnitNames ::= SEQUENCE SIZE (1..ub-organizational-units)
                                       OF OrganizationalUnitName

 OrganizationalUnitName ::= PrintableString (SIZE
                     (1..ub-organizational-unit-name-length))

 ub-terminal-id-length INTEGER ::= 24
 ub-x121-address-length INTEGER ::= 16
 ub-country-name-alpha-length INTEGER ::= 2
 ub-country-name-numeric-length INTEGER ::= 3
 ub-organization-name-length INTEGER ::= 64
 ub-organizational-unit-name-length INTEGER ::= 32
 ub-organizational-units INTEGER ::= 4
 ub-initials-length INTEGER ::= 5
 ub-generation-qualifier-length INTEGER ::= 3
 ub-given-name-length INTEGER ::= 16
 ub-surname-length INTEGER ::= 40
 ub-numeric-user-id-length INTEGER ::= 32
 ub-domain-name-length INTEGER ::= 16

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

See Also

Serialized Form

Constructor Summary

BuiltInStandardAttributes()

The default constructor for this class.

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

Constructs a BuiltInStandardAttributes object, and initializes it with the collection of strings represented by valueBER.

 

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 BuiltInStandardAttributes; returns false otherwise.

 ORName

getAdminDomainName()

Gets the Administration Domain Name attribute.

 ORName

getCountryName()

Gets the Country Name attribute.

 int

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

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

 int

getDERLen(int special)

Returns the number of bytes that will be used by the DER encoding of BuiltInStandardAttributes.

 String

getNetworkAddress()

Gets the Network Address attribute.

static int

getNextBEROffset(byte[] nameBER, int offset)

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

 String

getNumericUserIdentifier()

Gets the Numeric User Identifier attribute.

 String[]

getOrganizationalUnitNames()

Gets the Organizational Unit Names attribute.

 String

getOrganizationName()

Gets the Organization Name attribute.

 PersonalName

getPersonalName()

Gets the Personal Name attribute.

 ORName

getPrivateDomainName()

Gets the Private Domain Name attribute.

 String

getTerminalIdentifier()

Gets the Terminal Identifier attribute.

 void

setAdminDomainName(ORName name)

Sets the Administration Domain Name attribute.

 void

setCountryName(ORName name)

Sets the Country Name attribute.

 void

setNetworkAddress(String name)

Sets the Network Address attribute.

 void

setNumericUserIdentifier(String name)

Sets the Numeric User Identifier attribute.

 void

setOrganizationalUnitNames(String name)

Sets the Organizational Unit Names attribute.

 void

setOrganizationName(String name)

Sets the Organization Name attribute.

 void

setPersonalName(PersonalName name)

Sets the Personal Name attribute.

 void

setPrivateDomainName(ORName name)

Sets the Private Domain Name attribute.

 void

setTerminalIdentifier(String name)

Sets the Terminal Identifier attribute.

 String

toString()

Returns a String that describes this Name.

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

Constructor Detail

BuiltInStandardAttributes

public BuiltInStandardAttributes(byte[] valueBER,
                                 int offset,
                                 int special)
                          throws NameException
Constructs a BuiltInStandardAttributes object, and initializes it with the collection of strings represented by valueBER.

Parameters

         valueBER  

A byte array containing the BER encoding of a BuiltInStandardAttributes object.

         offset  

The offset into valueBER where the encoding begins.

         special  

Holds the special BER or DER circumstances, 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.

BuiltInStandardAttributes

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

setCountryName

public void setCountryName(ORName name)
                    throws NameException
Sets the Country Name attribute.

Parameters

         name  

An ORName specifying the Country Name attribute.

Throws

NameException - If specified name is of a wrong type.

setAdminDomainName

public void setAdminDomainName(ORName name)
                        throws NameException
Sets the Administration Domain Name attribute.

Parameters

         name  

An ORName specifing the Administration Domain Name attribute.

Throws

NameException - If specified name is of a wrong type.

setNetworkAddress

public void setNetworkAddress(String name)
                       throws NameException
Sets the Network Address attribute.

Parameters

         name  

A String specifying the Network Address attribute. The address cannot be longer than 16 characters and can contain only numbers or spaces.

Throws

NameException - If the specified address is too long.

setTerminalIdentifier

public void setTerminalIdentifier(String name)
                           throws NameException
Sets the Terminal Identifier attribute.

Parameters

         name  

A String specifying the Terminal Identifier attribute. The terminal identifier cannot be longer than 24 characters.

Throws

NameException - If specified identifier is too long.

setPrivateDomainName

public void setPrivateDomainName(ORName name)
                          throws NameException
Sets the Private Domain Name attribute.

Parameters

         name  

an ORName specifying the Private Domain Name attribute.

Throws

NameException - If the specified name is of a wrong type.

setOrganizationName

public void setOrganizationName(String name)
                         throws NameException
Sets the Organization Name attribute.

Parameters

         name  

A String specifying the Organization Name attribute. The name cannot be longer than 64 characters.

Throws

NameException - If the specified name is too long.

setNumericUserIdentifier

public void setNumericUserIdentifier(String name)
                              throws NameException
Sets the Numeric User Identifier attribute.

Parameters

         name  

A String specifying the Numeric User Identifier attribute. The identifier cannot be longer than 32 characters and can contain only numbers or spaces.

Throws

NameException - If the identifier is too long.

setPersonalName

public void setPersonalName(PersonalName name)
Sets the Personal Name attribute.

Parameters

         name  

A PersonalName specifying the Personal Name attribute.


setOrganizationalUnitNames

public void setOrganizationalUnitNames(String name)
                                throws NameException
Sets the Organizational Unit Names attribute.

Parameters

         name  

A String specifying the Organizational Unit Names attribute. The name cannot be longer than 32 characters. Only 4 names can be added.

Throws

NameException - If the specified name is too long.

getCountryName

public ORName getCountryName()
Gets the Country Name attribute.

Returns

An ORName specifying the Country Name attribute.

getAdminDomainName

public ORName getAdminDomainName()
Gets the Administration Domain Name attribute.

Returns

ORName specifying the Administration Domain Name attribute.

getNetworkAddress

public String getNetworkAddress()
Gets the Network Address attribute.

Returns

A String specifying the Network Address attribute.

getTerminalIdentifier

public String getTerminalIdentifier()
Gets the Terminal Identifier attribute.

Returns

A String specifying the Terminal Identifier attribute.

getPrivateDomainName

public ORName getPrivateDomainName()
Gets the Private Domain Name attribute.

Returns

An ORName specifying the Private Domain Name attribute.

getOrganizationName

public String getOrganizationName()
Gets the Organization Name attribute.

Returns

A String specifying the Organization Name attribute.

getNumericUserIdentifier

public String getNumericUserIdentifier()
Gets the Numeric User Identifier attribute.

Returns

A String specifying the Numeric User Identifier attribute.

getPersonalName

public PersonalName getPersonalName()
Gets the Personal Name attribute.

Returns

A PersonalName specifying the Personal Name attribute.

getOrganizationalUnitNames

public String[] getOrganizationalUnitNames()
Gets the Organizational Unit Names attribute.

Returns

A String array specifying the Organizational Unit Names attribute.

toString

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

Overrides

toString in class Object

Returns

A String describing this Name.

getNextBEROffset

public static int getNextBEROffset(byte[] nameBER,
                                   int offset)
                            throws NameException
Given nameBER, the BER of a BuiltInStandardAttributes object beginning at offset, finds the index to the next element in the encoding. In other words, gets the next offset after the attributes.

For example, if the offset is 120 and the attributes' 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 BuiltInStandardAttributes object.

         offset  

The offset into nameBER where the encoding begins.

Returns

An int, 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 BuiltInStandardAttributes. 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 BuiltInStandardAttributes.

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 BuiltInStandardAttributes object into encoding, beginning at offset. To determine how long the encoding will be, call getDERLen. If this object is not yet set with values, this method places nothing into the array and returns 0. 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  

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 BuiltInStandardAttributes; returns false otherwise.

Overrides

equals in class Object

Parameters

         obj  

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