com.rsa.certj.cert.extensions

Class EDIPartyName

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

public class EDIPartyName
extends Object
implements Cloneable, Serializable

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

The ASN.1 definition is as follows:

 
 This class is defined as follows:

 EDIPartyName ::= SEQUENCE {
	nameAssigner		[0]	DirectoryString {ub-name} OPTIONAL,
	partyName		[1]	DirectoryString {ub-name} }

 ub-name INTEGER ::=     32768
 
 DirectoryString ::= CHOICE {
        teletexString           TeletexString (SIZE (1..MAX)),
        printableString         PrintableString (SIZE (1..MAX)),
        universalString         UniversalString (SIZE (1..MAX)),
        utf8String              UTF8String (SIZE (1.. MAX)),
        bmpString               BMPString (SIZE (1..MAX)) }

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

See Also

Serialized Form

Constructor Summary

EDIPartyName()

Constructs an empty EDIPartyName object.

EDIPartyName(byte[] nameBER, int offset, int special)

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

 

Method Summary

 void

addNameAssigner(String value, int type)

Adds the assigner name.

 void

addPartyName(String value, int type)

Adds the party name.

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

 int

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

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

 String

getNameAssigner()

Returns the name assigner string.

static int

getNextBEROffset(byte[] nameBER, int offset)

Given nameBER, the BER encoding of an EDI party name, beginning at offset, finds the index to the next element in the encoding.

 String

getPartyName()

Returns the party name string.

 String

toString()

Gets a string representation of the EDI party name.

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

Constructor Detail

EDIPartyName

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

Parameters

         nameBER  

A byte array containing the BER encoding of this object.

         offset  

The offset into the nameBER array.

         special  

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


EDIPartyName

public EDIPartyName()
Constructs an empty EDIPartyName object.
Method Detail

addNameAssigner

public void addNameAssigner(String value,
                            int type)
Adds the assigner name.

Parameters

         value  

A String indicating the assigner name.

         type  

An int indicating the ASN1 String type. If 0, the default value is ASN1.UniversalString.


addPartyName

public void addPartyName(String value,
                         int type)
Adds the party name.

Parameters

         value  

A String that contains the party name.

         type  

The ASN1 String type. If 0, the default value is UniversalString. See the class ASN1 for more information on UniversalString.


getNameAssigner

public String getNameAssigner()
Returns the name assigner string.

Returns

The name assigner value of the EDIPartyName object.

getPartyName

public String getPartyName()
Returns the party name string.

Returns

The party name string.

toString

public String toString()
Gets a string representation of the EDI party name.

Overrides

toString in class Object

Returns

A String that describes this EDI party name.

getNextBEROffset

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

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

Parameters

         nameBER  

The BER encoding of an EDI party name.

         offset  

The offset into nameBER where the encoding begins.

Returns

An int that contains 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 EDIPartyName object. If this object is not set with values, this method returns 0.

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 by the DER encoding of this 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 this object into encoding, beginning at offset. To determine the length of the encoding, call getDERLen. If this object is not yet set with values, 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:
      value   [1] IMPLICIT OCTET STRING
 
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  

A byte array into which the result will be placed.

         offset  

The offset into encoding where the writing begins.

         special  

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

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

Overrides

equals in class Object

Parameters

         obj  

The instance of the EDIPartyName object.

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 EDIPartyName 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