|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.rsa.certj.cert.X501Attributes
This class builds and holds X.501 attributes. It holds the collection
of attributes. The X501Attribute
class
stores, encodes, and decodes the data.
Attributes ::= SET OF Attribute Attribute ::= SEQUENCE { attrID OBJECT IDENTIFIER value SET OF { specificValue } } |
See Also
Constructor Summary |
|
X501Attributes()
Constructs an empty |
|
X501Attributes(byte[] attributesBER,
int offset,
int special)
Constructs an |
Method Summary |
|
int |
addAttribute(X501Attribute attribute)
Adds a new X.501-defined attribute. |
clone()
Overrides the default |
|
boolean |
equals(Object obj)
Returns |
getAttributeByIndex(int index)
Gets the attribute at the specified index in the list. |
|
getAttributeByOID(byte[] oid)
Gets the attribute that is of the given oid. |
|
getAttributeByType(int attributeType)
Gets the attribute of the given type, attributeType. |
|
int |
getAttributeCount()
Gets the number of attributes in this object. |
int |
getDEREncoding(byte[] encoding,
int offset,
int special)
Places the DER encoding of the X.501 attributes into encoding, beginning at offset, and returns the number of bytes placed into the encoding array. |
int |
getDERLen(int special)
Returns the number of bytes of the DER encoding of these X.501 attributes. |
static int |
getNextBEROffset(byte[] attributesBER,
int offset)
Finds the index of the next element in the encoded data, given attributesBER, the BER encoding of X.501 attributes beginning at offset. |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public X501Attributes()
X501Attributes
object.public X501Attributes(byte[] attributesBER, int offset, int special) throws AttributeException
X501Attributes
object
and initializes it with
the collection of attributes represented by attributesBER.
The ASN.1 definition (previously defined in this class)
means the tag will be 0x31
.
However, an X.501 attributes object
can be part of a certificate request (or some other construct), and it
might have a different tag, caused by IMPLICIT
or
EXPLICIT
. For example,
PKCS #10 defines CertRequestInfo
with Attributes
,
but the
Attributes
portion itself is defined as follows:
attributes [0] IMPLICIT Attributes |
0x31
to 0xa0
.
To indicate that the DER encoding of the Attributes
object should follow any special circumstances, use the special
argument.
For instance, to indicate the following:
attributes [0] IMPLICIT Attributes |
special = (ASN1.CONTEXT_IMPLICIT | 0); |
special = 0 |
APP_IMPLICIT
, APP_EXPLICIT
,
PRIVATE_IMPLICIT
, PRIVATE_EXPLICIT
,
OPTIONAL
, DEFAULT
,
CONTEXT_IMPLICIT
,
or CONTEXT_EXPLICIT
.Parameters
attributesBER | A | ||
offset | The offset into attributesBER where the encoding begins. | ||
special | The special BER circumstances of the encoding, if there are any. |
Throws
AttributeException
- If the BER encoding is invalid.Method Detail |
public static int getNextBEROffset(byte[] attributesBER, int offset) throws AttributeException
attributesBER[120]
is
the first byte in the encoding of the attributes,
attributesBER[1938]
is the last byte in the encoding of the attributes, and the next
element begins at index 1939.Parameters
attributesBER | The BER encoding of X.501 attributes. | ||
offset | The offset into attributesBER, where the encoding begins. |
Returns
int
that contains the index to the next
element in the BER encoding.
Throws
AttributeException
- If the method cannot read the BER
encoding.public int getDERLen(int special)
IMPLICIT
or
EXPLICIT
. For example,
PKCS #10 defines CertRequestInfo
with Attributes
, but the
Attributes
portion itself is defined as follows:
attributes [0] IMPLICIT Attributes |
Attributes
should follow any special circumstances, use
the special argument.
For example, to indicate the following:
attributes [0] IMPLICIT Attributes |
special = (ASN1.CONTEXT_IMPLICIT | 0); |
special = 0 |
APP_IMPLICIT
, APP_EXPLICIT
,
PRIVATE_IMPLICIT
, PRIVATE_EXPLICIT
,
OPTIONAL
, DEFAULT
,
CONTEXT_IMPLICIT
,
or CONTEXT_EXPLICIT
.Parameters
special | The special circumstances of the DER encoding, if there are any. |
Returns
public int getDEREncoding(byte[] encoding, int offset, int special) throws AttributeException
0x31
.
However, an X.501 attributes object
can be part of a certificate request (or some other construct), and it may
have a different tag, caused by IMPLICIT
or
EXPLICIT
. For example,
PKCS #10 defines CertRequestInfo
with Attributes
, but the
Attributes
portion itself is defined as follows:
attributes [0] IMPLICIT Attributes |
Attributes
should follow any special circumstances, use
the special argument. Set special
to any special circumstances
of the BER encoding; for example, to indicate the following:
attributes [0] IMPLICIT Attributes |
special = (ASN1.CONTEXT_IMPLICIT | 0); |
special = 0 |
APP_IMPLICIT
, APP_EXPLICIT
,
PRIVATE_IMPLICIT
, PRIVATE_EXPLICIT
,
OPTIONAL
, DEFAULT
,
CONTEXT_IMPLICIT
,
or CONTEXT_EXPLICIT
.Parameters
encoding | The | ||
offset | The offset into encoding where writing begine. | ||
special | The special circumstances of the DER encoding, if there are any. |
Returns
byte
array that contains the DER encoding of
the X.501 attributes.
Throws
AttributeException
- If the DER cannot be encoded.public int addAttribute(X501Attribute attribute)
null
, then this method
returns -1
.Parameters
attribute | An object that contains the attribute type and value
or values. See the |
Returns
public int getAttributeCount()
Returns
int
that contains the number of attributes
in this object.public X501Attribute getAttributeByIndex(int index)
null
.Parameters
index | The index into the list of the attribute to be retrieved. |
Returns
X501Attribute
object that contains the data.public X501Attribute getAttributeByType(int attributeType)
X501Attribute
class.
If this object does not contain an attribute
of the given type, then this method returns null
.Parameters
attributeType | The flag indicating
which attribute type to get. See the
|
Returns
X501Attribute
object
that contains the data.public X501Attribute getAttributeByOID(byte[] oid)
null
.Parameters
oid | The |
Returns
X501Attribute
object that contains the data.public Object clone() throws CloneNotSupportedException
clone
method to get a deeper clone.
Returns
X501Attributes
object,
a copy of this object.
Throws
CloneNotSupportedException
- If the cloning operation
is not successful.public boolean equals(Object obj)
true
if this object and obj contain
the same X501Attributes
object,
returns false
otherwise.Overrides
equals
in class Object
Parameters
obj | The instance of an |
Returns
boolean
indicating whether
these objects are equal.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |