|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.rsa.certj.cert.X509V3Extensions
This class builds and holds the collection of X.509 version 3 extensions.
The X509V3Extension
class,
the superclass of all the individual extension type classes, is
where the data is stored, encoded, and decoded. For example, for a
KEY_USAGE
extension, use the KeyUsageExtension
class, which
is a subclass of X509V3Extension
.
Extensions ::= SEQUENCE OF Extension Extension ::= SEQUENCE { extnID OBJECT IDENTIFIER critical BOOLEAN DEFAULT FALSE extnValue OCTET STRING } |
See Also
Field Summary |
|
static int |
X509_EXT_TYPE_CERT
Specifies the |
static int |
X509_EXT_TYPE_CRL
Specifies the |
static int |
X509_EXT_TYPE_CRL_ENTRY
Specifies the |
static int |
X509_EXT_TYPE_OCSP_REQUEST
Specifies the |
static int |
X509_EXT_TYPE_OCSP_SINGLE
Specifies the |
Constructor Summary |
|
X509V3Extensions(byte[] extensionsBER,
int offset,
int special,
int extType)
Constructs a signed |
|
X509V3Extensions(int extType)
Constructs an empty |
Method Summary |
|
int |
addV3Extension(X509V3Extension extension)
Adds a new X.509 v3 defined extension. |
clone()
Overrides the default |
|
int |
getDEREncoding(byte[] encoding,
int offset,
int special)
Places the DER encoding of the X.509 extensions in this object into encoding, beginning at offset. |
int |
getDERLen(int special)
Returns the number of bytes of the DER encoding of these X.509 extensions. |
getExtensionByIndex(int index)
Gets the extension at specified index in the list. |
|
getExtensionByType(int extensionType)
Gets the extension of the given extensionType. |
|
int |
getExtensionCount()
Gets the number of extensions in this object. |
int |
getExtensionsType()
Gets the extensions type. |
static int |
getNextBEROffset(byte[] extensionsBER,
int offset)
Given extensionsBER, the BER encoding of the X.509 extensions, beginning at offset, finds the index to the next element in the encoding. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int X509_EXT_TYPE_CERT
CertExtensions
type.public static final int X509_EXT_TYPE_CRL
CRLExtensions
type.public static final int X509_EXT_TYPE_CRL_ENTRY
CRLEntryExtensions
type.public static final int X509_EXT_TYPE_OCSP_SINGLE
OCSPSingleExtensions
type.public static final int X509_EXT_TYPE_OCSP_REQUEST
OCSPRequestExtensions
type.Constructor Detail |
public X509V3Extensions(int extType) throws CertificateException
X509V3Extensions
object.Parameters
extType | An |
Throws
CertificateException
- If the specified type is invalid.public X509V3Extensions(byte[] extensionsBER, int offset, int special, int extType) throws CertificateException
X509V3Extensions
object and initializes
it with the value given by extensionsBER, beginning at
offset, the BER encoding of X.509 v3 extensions.
The ASN.1 definition, previously defined in this class,
means the tag will be 0x30
.
However, an X.509 extensions
object
can be part of a certificate (or some other construct), and it might
have a different tag, caused by IMPLICIT
or
EXPLICIT
. For example, suppose
the definition is as follows:
extensions [3] EXPLICIT Extensions OPTIONAL |
X509Extensions
object should follow any special circumstances, use the special
argument.
Set special to any special circumstances of the DER
encoding. For example, to indicate the following:
extensions [3] EXPLICIT Extensions OPTIONAL |
special = (ASN1.CONTEXT_EXPLICIT | 3 | ASN1.OPTIONAL); |
special = 0 |
APP_IMPLICIT
, APP_EXPLICIT
,
PRIVATE_IMPLICIT
, PRIVATE_EXPLICIT
,
OPTIONAL
, DEFAULT
,
CONTEXT_IMPLICIT
,
or CONTEXT_EXPLICIT
.Parameters
extensionsBER | The BER encoding of an X.509 v3 extension. | ||
offset | The offset into | ||
special | The special BER circumstances of the encoding, if there are any. | ||
extType | The type of these extensions. It must be one of the
|
Throws
CertificateException
- If the BER is not a valid
X.509AExtensions
certificate or if
the specified extensions type is invalid.Method Detail |
public static int getNextBEROffset(byte[] extensionsBER, int offset) throws CertificateException
extensionsBER[120]
is
the first byte in the encoding of the extensions,
extensionsBER[1938]
is the last byte in the encoding of the extensions, and the next
element begins at index 1939.Parameters
extensionsBER | The BER encoding of the X.509 extensions. | ||
offset | The offset into |
Returns
int
that contains the index to the next element
in the BER encoding.
Throws
CertificateException
- If the method cannot read the BER
encoding.public int getDERLen(int special)
IMPLICIT
or EXPLICIT
. This can affect the
length. For example, suppose the definition is as follows:
extensions [3] EXPLICIT Extensions OPTIONAL |
X509V3Extentions
object
should follow any special circumstances, use the special
argument. Set special to any special
circumstances of the DER encoding. For example, to indicate the following:
extensions [3] EXPLICIT Extensions OPTIONAL |
special = (ASN1.CONTEXT_EXPLICIT | 3 | ASN1.OPTIONAL); |
special = 0 |
APP_IMPLICIT
, APP_EXPLICIT
,
PRIVATE_IMPLICIT
, PRIVATE_EXPLICIT
,
OPTIONAL
, DEFAULT
,
CONTEXT_IMPLICIT
,
or CONTEXT_EXPLICIT
.Parameters
special | The special DER circumstances of the encoding, if there are any. |
Returns
public int getDEREncoding(byte[] encoding, int offset, int special)
getDERLen
. If this object is
not yet set with X.509 extensions, then this method places nothing
into the array and returns zero.
The ASN.1 definition, previously defined in this class, means the tag will
be 0x30. However, an extensions object
can be part of a certificate (or some other construct), and it might
have a different tag caused by IMPLICIT
or
EXPLICIT
. For example, suppose
the X.509 definition is as follows:
extensions [3] EXPLICIT Extensions OPTIONAL |
X509V3Esxtensions
object
should follow any special circumstances, use the special
argument.
Set special to any special circumstances
of the DER encoding. For example, to indicate the following:
extensions [3] EXPLICIT Extensions OPTIONAL |
special = (ASN1.CONTEXT_EXPLICIT | 3 | ASN1.OPTIONAL); |
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 begins. | ||
special | The special DER circumstances of the encoding, if there are any. |
Returns
public int addV3Extension(X509V3Extension extension) throws CertificateException
Parameters
extension | An object that contains the extension value. See each
|
Returns
Throws
CertificateException
- If the extension is of the wrong type
or null
.public int getExtensionCount()
Returns
int
that contains the number of extensions.public int getExtensionsType()
Certificate
, CRL
, or CRLEntry.
Returns
X509_EXT_TYPE_CERT
for Certificate extensions,
X509_EXT_TYPE_CRL
for CRL extensions, and
X509_EXT_TYPE_CRL_ENTRY
for CRLEntry extensions.public X509V3Extension getExtensionByIndex(int index) throws CertificateException
null
.Parameters
index | The index into the list of the X.509 extension to retrieve. |
Returns
X509V3Extension
object that contains the data.
Throws
CertificateException
- If index is invalid.public X509V3Extension getExtensionByType(int extensionType) throws CertificateException
X509V3Extension
class. If this object contains no extension
of the desired type, this method returns null
.Parameters
extensionType | The flag indicating the extension type. See the
|
Returns
X509V3Extension
object that contains the data.
If there is no extension of specified type, this method returns
NULL
.
Throws
CertificateException
- If there are no extensions.public Object clone() throws CloneNotSupportedException
clone
method to get a deeper clone.
Returns
X509V3Extensions
object,
a copy of this object.
Throws
CloneNotSupportedException
- If the cloning operation
is not successful.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |