com.rsa.certj.cert.extensions

Class ORName

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

public class ORName
extends Object
implements Cloneable, Serializable

This class implements several types in the ORAddress object; the ORAddress is used in the GeneralName object.

The ASN.1 definition is as follows:

 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)) }

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

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

 PostalCode ::= CHOICE {
   numeric-code NumericString (SIZE (1..ub-postal-code-length)),
   printable-code PrintableString (SIZE (1..ub-postal-code-length)) }

 ub-country-name-alpha-length INTEGER ::= 2
 ub-country-name-numeric-length INTEGER ::= 3
 ub-domain-name-length INTEGER ::= 16
 ub-postal-code-length INTEGER ::= 16

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

See Also

Serialized Form

Field Summary

static int

ADMIN_DOMAIN_NAME

Specifies the ADMIN_DOMAIN_NAME type of ORName.

static int

COUNTRY_NAME

Specifies the COUNTRY_NAME type of ORName.

static int

PHYSICAL_DELIVERY_COUNTRY_NAME

Specifies the PHYSICAL_DELIVERY_COUNTRY_NAME type of ORName.

static int

POSTAL_CODE

Specifies the POSTAL_CODE type of ORName.

static int

PRIVATE_DOMAIN_NAME

Specifies the PRIVATE_DOMAIN_NAME type of ORName.

 

Constructor Summary

ORName(int flag)

Constructs an empty ORName object of the specified type.

ORName(int flag, byte[] valueBER, int offset, int special)

Constructs an ORName 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 ORName; otherwise, false.

 int

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

Places the DER encoding of the ORName 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 ORName object.

 int

getNameType()

Gets the name type, one of the fields defined above.

static int

getNextBEROffset(byte[] nameBER, int offset)

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

 String

getNumericValue()

Gets the numeric value of an ORName object.

 String

getPrintableValue()

Gets the printable value of an ORName object.

 void

setNumericValue(String number)

Sets the numeric value of the ORName object.

 void

setPrintableValue(String print)

Sets the printable value of the ORName object.

 String

toString()

Returns a String that describes this ORName object.

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

Field Detail

COUNTRY_NAME

public static final int COUNTRY_NAME
Specifies the COUNTRY_NAME type of ORName.

ADMIN_DOMAIN_NAME

public static final int ADMIN_DOMAIN_NAME
Specifies the ADMIN_DOMAIN_NAME type of ORName.

PRIVATE_DOMAIN_NAME

public static final int PRIVATE_DOMAIN_NAME
Specifies the PRIVATE_DOMAIN_NAME type of ORName.

POSTAL_CODE

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

PHYSICAL_DELIVERY_COUNTRY_NAME

public static final int PHYSICAL_DELIVERY_COUNTRY_NAME
Specifies the PHYSICAL_DELIVERY_COUNTRY_NAME type of ORName.
Constructor Detail

ORName

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

Parameters

         flag  

A flag that specifies the ORName name type to use. It should be one of the static fields previously defined in this class.

         valueBER  

A byte array that contains the BER encoding of ORName.

         offset  

The offset into valueBER where the encoding begins.

         special  

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

ORName

public ORName(int flag)
Constructs an empty ORName object of the specified type.

Parameters

         flag  

A flag that specifies the ORName name type to use. It should be one of the static fields previously defined in this class.

Method Detail

getNameType

public int getNameType()
Gets the name type, one of the fields defined above.

Returns

The ORName type.

setNumericValue

public void setNumericValue(String number)
Sets the numeric value of the ORName object.

Parameters

         number  

A String that specifies the numeric value.


setPrintableValue

public void setPrintableValue(String print)
Sets the printable value of the ORName object.

Parameters

         print  

A String that specifies the printable value.


getNumericValue

public String getNumericValue()
Gets the numeric value of an ORName object.

Returns

A String that specifies the numeric value.

getPrintableValue

public String getPrintableValue()
Gets the printable value of an ORName object.

Returns

A String that specifies the printable value.

toString

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

Overrides

toString in class Object

Returns

A String that describes this ORName object.

getNextBEROffset

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

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

Parameters

         nameBER  

The BER encoding of an ORName object.

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

Parameters

         special  

The special DER circumstances of the 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 in the DER encoding of this object.

getDEREncoding

public int getDEREncoding(byte[] encoding,
                          int offset,
                          int special)
                   throws NameException
Places the DER encoding of the ORName 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.CONTEXT_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. 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 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 ORName; otherwise, false.

Overrides

equals in class Object

Parameters

         obj  

An instance of the ORName object.

Returns

A boolean that indicates whether these objects are equal.

clone

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

Returns

A new ORName 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