com.rsa.certj.cert.extensions

Class PresentationAddress

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

public class PresentationAddress
extends Object
implements Cloneable, Serializable

This class is used in the GeneralNames object.

The ASN.1 definition is as follows:

 PresentationAddress ::= SEQUENCE {
    pSelector   [0] EXPLICIT OCTET STRING OPTIONAL,
    sSelector   [1] EXPLICIT OCTET STRING OPTIONAL,
    tSelector   [2] EXPLICIT OCTET STRING OPTIONAL,
    nAddresses  [3] EXPLICIT SET SIZE (1..MAX) OF OCTET STRING }
 

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

See Also

Serialized Form

Constructor Summary

PresentationAddress()

Constructs an empty PresentationAddress object.

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

Constructs a PresentationAddress 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 PresentationAddress, returns false otherwise.

 int

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

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

 byte[][]

getNAddresses()

Gets the value of the nAddresses field.

static int

getNextBEROffset(byte[] nameBER, int offset)

Gets the next offset after the name: Given nameBER, the BER encoding of an PresentationAddress object, beginning at offset, finds the index to the next element in the encoding.

 byte[]

getPSelector()

Gets the value of PSelector in this object.

 byte[]

getSSelector()

Gets the value of SSelector in this object.

 byte[]

getTSelector()

Gets the value of TSelector in this object.

 void

setNAddress(byte[] data, int offset, int len)

Adds the value of nAddress into this object.

 void

setPSelector(byte[] data, int offset, int len)

Sets the value of PSelector in this object.

 void

setSSelector(byte[] data, int offset, int len)

Sets the value of SSelector in this object.

 void

setTSelector(byte[] data, int offset, int len)

Sets the value of TSelector in this object.

 String

toString()

Returns a String that describes this PresentationAddress object.

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

Constructor Detail

PresentationAddress

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

Parameters

         nameBER  

A byte array that contains the BER encoding of a PresentationAddress object.

         offset  

The offset into nameBER 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.

PresentationAddress

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

setPSelector

public void setPSelector(byte[] data,
                         int offset,
                         int len)
                  throws NameException
Sets the value of PSelector in this object.

Parameters

         data  

The PSelector value.

         offset  

The offset into data where the value begins.

         len  

The length of the data in the data array.

Throws

NameException - If data is null or if len is 0.

setSSelector

public void setSSelector(byte[] data,
                         int offset,
                         int len)
                  throws NameException
Sets the value of SSelector in this object.

Parameters

         data  

The SSelector value.

         offset  

The offset into data where the value begins.

         len  

The length of the data in the data array.

Throws

NameException - If data is null or if len is 0.

setTSelector

public void setTSelector(byte[] data,
                         int offset,
                         int len)
                  throws NameException
Sets the value of TSelector in this object.

Parameters

         data  

The TSelector value.

         offset  

The offset into data where the value begins.

         len  

The length of the data in the data array.

Throws

NameException - If data is null or if len is 0.

setNAddress

public void setNAddress(byte[] data,
                        int offset,
                        int len)
                 throws NameException
Adds the value of nAddress into this object.

Parameters

         data  

The nAddress value.

         offset  

The offset into data where the value begins.

         len  

The length of the data in the data array.

Throws

NameException - If data is null or if len is 0.

getPSelector

public byte[] getPSelector()
Gets the value of PSelector in this object.

Returns

A new byte array that contains the PSelector data.

getSSelector

public byte[] getSSelector()
Gets the value of SSelector in this object.

Returns

A new byte array that contains the SSelector data.

getTSelector

public byte[] getTSelector()
Gets the value of TSelector in this object.

Returns

A new byte array that contains the TSelector data.

getNAddresses

public byte[][] getNAddresses()
Gets the value of the nAddresses field.

Returns

A new array of byte arrays that contain the nAddresses value.

toString

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

Overrides

toString in class Object

Returns

A String that describes this PresentationAddress object.

getNextBEROffset

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

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

Parameters

         nameBER  

The BER encoding of a PresentationAddress 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 PresentationAddress 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 PresentationAddress 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 to begin writing.

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

Overrides

equals in class Object

Parameters

         obj  

An instance of the PresentationAddress class.

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