com.rsa.certj.cert.extensions

Class ExtendedNetworkAddress

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

public class ExtendedNetworkAddress
extends Object
implements Cloneable, Serializable

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

The ASN.1 definition is as follows:

 ExtendedNetworkAddress ::= CHOICE {
  e163-4-address SEQUENCE {
       number [0] NumericString (SIZE (1..ub-e163-4-number-length)),
       sub-address [1] NumericString
               (SIZE (1..ub-e163-4-sub-address-length)) OPTIONAL },
  psap-address [0] PresentationAddress }

 ub-e163-4-number-length INTEGER ::= 15
 ub-e163-4-sub-address-length INTEGER ::= 40

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

See Also

Serialized Form

Constructor Summary

ExtendedNetworkAddress()

The default constructor for this class.

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

Constructs an ExtendedNetworkAddress object, and initializes it with the collection of attributes 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 ExtendedNetworkAddress, returns false otherwise.

 int

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

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

static int

getNextBEROffset(byte[] nameBER, int offset)

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

 String

getNumber()

Gets the number value of the e163-4-address.

 PresentationAddress

getPsapAddress()

Gets the psap-address value.

 String

getSubAddress()

Gets the sub-address value of the e163-4-address.

 void

setNumber(String number)

Sets the number value of the e163-4-address.

 void

setPsapAddress(PresentationAddress psapAddress)

Sets the psap-address value.

 void

setSubAddress(String subAddress)

Sets the Sub-Address value of the e163-4-address.

 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

ExtendedNetworkAddress

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

Parameters

         valueBER  

A byte array that contains the BER encoding of ExtendedNetworkAddress.

         offset  

The offset into valueBER where the encoding begins.

         special  

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

ExtendedNetworkAddress

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

setNumber

public void setNumber(String number)
               throws NameException
Sets the number value of the e163-4-address.

Parameters

         number  

A String that specifies the number value. The maximum length is 15 characters. Only numbers and spaces are allowed.

Throws

NameException - If the specified value is too long, or if a null value is passed.

setSubAddress

public void setSubAddress(String subAddress)
                   throws NameException
Sets the Sub-Address value of the e163-4-address.

Parameters

         subAddress  

A String that specifies the sub-address value. The maximum length is 40 characters. Only numbers and spaces are allowed.

Throws

NameException - If the specified value is too long, or if a null value is passed.

setPsapAddress

public void setPsapAddress(PresentationAddress psapAddress)
                    throws NameException
Sets the psap-address value.

Parameters

         psapAddress  

The psap-address value.

Throws

NameException - If the specified value is null.

getNumber

public String getNumber()
Gets the number value of the e163-4-address.

Returns

A String that specifies the number value.

getSubAddress

public String getSubAddress()
Gets the sub-address value of the e163-4-address.

Returns

The psap-address value.

getPsapAddress

public PresentationAddress getPsapAddress()
Gets the psap-address value.

Returns

The psap-address value.

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 encoding of an ExtendedNetworkAddress 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 ExtendedNetworkAddress object.

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

Parameters

         nameBER  

The BER encoding of an ExtendedNetworkAddress.

         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)
Returns the number of bytes that will be used by the DER encoding of this ExtendedNetworkAddress 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.

getDEREncoding

public int getDEREncoding(byte[] encoding,
                          int offset,
                          int special)
                   throws NameException
Places the DER encoding of the ExtendedNetworkAddress 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  

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

Overrides

equals in class Object

Parameters

         obj  

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