|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.rsa.certj.cert.RDN
This class builds and holds a relative distinguished name. The ASN.1 definition is as follows:
RelativeDistinguishedName ::= SET SIZE (1..MAX) OF AttributeTypeAndValue AttributeTypeAndValue ::= SEQUENCE type ATTRIBUTE.&id ({SupportedAttributes}), value ({ATTRIBUTE.&Type ({SupportedAttributes}{@type})} |
AttributeValueAssertion
class):
See Also
Constructor Summary |
|
RDN()
Constructs an empty |
|
RDN(byte[] rdnBER,
int offset,
int special)
Creates an RDN object and initializes it with the collection of attributes represented by rdnBER. |
Method Summary |
|
void |
addNameAVA(AttributeValueAssertion ava)
Adds the attribute value assertion
to this |
clone()
Overrides the default |
|
boolean |
equals(Object obj)
Returns |
getAttribute(int attributeType)
Gets the attribute of type attributeType from the
|
|
getAttributeByIndex(int attributeIndex)
Gets the attribute at the specified index in the list. |
|
int |
getAttributeCount()
Gets the number of attributes in this |
int |
getDEREncoding(byte[] encoding,
int offset,
int special)
Places the DER encoding of the |
int |
getDERLen(int special)
Returns the number of bytes of the DER encoding of this RDN. |
static int |
getNextBEROffset(byte[] rdnBER,
int offset)
Given rdnBER, the BER of a relative distinguished name beginning at offset, finds the index to the next element in the encoding. |
void |
removeAVA(int index)
Deletes the |
void |
setAVA(AttributeValueAssertion name,
int index)
Sets the new |
toString()
Returns a |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public RDN(byte[] rdnBER, int offset, int special) throws NameException
Parameters
rdnBER | A | ||
offset | The offset into rdnBER where the encoding begins. | ||
special | The special circumstances of the BER
encoding, if there are
any. If there are no special circumstances, pass in
|
Throws
NameException
- If the encoding is invalid.public RDN()
RDN
object.
After this constructor is called, use the
addNameAVA
method
to set the attributes for the RDN
object.Method Detail |
public Object clone() throws CloneNotSupportedException
clone
method to get a deeper clone.
Returns
RDN
object,
a copy of this object.
Throws
CloneNotSupportedException
- If the cloning operation
is not successful.public String toString()
String
that describes this RDN.
Overrides
toString
in class Object
Returns
String
that describes this RDN.public int getAttributeCount()
RDN
object.
Returns
public AttributeValueAssertion getAttributeByIndex(int attributeIndex) throws NameException
null
.Parameters
attributeIndex | The index into the list of attributes where the requested attribute is located. |
Returns
Throws
NameException
- If the index is invalid.public void removeAVA(int index) throws NameException
AttributeValueAssertion
object at the
specified index.Parameters
index | The index to the specified
|
Throws
NameException
- If index is invalid.public void setAVA(AttributeValueAssertion name, int index) throws NameException
AttributeValueAssertion
object at the
specified index.Parameters
name | A new | ||
index | The index to the specified
|
Throws
NameException
- If index is invalid.public AttributeValueAssertion getAttribute(int attributeType)
RDN
object.
The attributeType will be one of the fields specified
in the AttributeValueAssertion
class, such as COUNTRY_NAME
or COMMON_NAME
.
If the RDN
object does not
possess an attribute of type attributeType,
the return value is null
.Parameters
attributeType | The flag indicating which attribute type is requested. |
Returns
public static int getNextBEROffset(byte[] rdnBER, int offset) throws NameException
rdnBER[120]
is the first
byte in the encoding of the RDN
,
rdnBER>[1938]
is the last byte in
the encoding of the RDN, and the
next element begins at index 1939.Parameters
rdnBER | The BER encoding of a RDN. | ||
offset | The offset into rdnBER where the encoding begins. |
Returns
int
that contains the index to the next
element in the BER encoding.
Throws
NameException
- If the method cannot read the BER encoding.public int getDERLen(int special)
Parameters
special | The special circumstances of the DER encoding, if there are any. |
Returns
public int getDEREncoding(byte[] encoding, int offset, int special) throws NameException
RDN
object into
encoding, beginning at offset.
To determine the
length of the encoding, call getDERLen
.
If this
object is not yet set with a value,
then this method places nothing
into the array and returns zero.
The ASN.1 definition of an RDN (previously
defined in this class)
means the tag will be 0x31
. However,
a RDN
object can be
part of an X500Name
(or some
other construct), and it might
have a different tag caused by IMPLICIT
or
EXPLICIT
.
For example, suppose the definition
is as follows:
name [1] IMPLICIT RDN |
0x31
to 0xa1
.
To indicate
that the DER encoding of the
RDN
object should follow
any special circumstances,
use the special argument.
For example, to indicate the following:
name [1] IMPLICIT RDN |
special = (ASN1.CONTEXT_IMPLICIT | 1); |
special = 0 |
APP_IMPLICIT
, APP_EXPLICIT
,
PRIVATE_IMPLICIT
, PRIVATE_EXPLICIT
,
OPTIONAL
, DEFAULT
,
CONTEXT_IMPLICIT
,
or CONTEXT_EXPLICIT
.Parameters
encoding | A | ||
offset | The offset into encoding where the encoding begins. | ||
special | The special circumstances of the DER encoding, if
there are any, such as |
Returns
Throws
NameException
- If unable to encode the RDN.public void addNameAVA(AttributeValueAssertion ava)
RDN
object.Parameters
ava | The AVA object to add to this |
public boolean equals(Object obj)
true
if this object and obj contain the
same RDN,
returns false
otherwise.Overrides
equals
in class Object
Parameters
obj | The instance of the RDN object. |
Returns
boolean
indicating whether
these objects are equal.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |