com.rsa.certj.cert.extensions

Class X509V3Extension

java.lang.Object
  |
  +--com.rsa.certj.cert.extensions.X509V3Extension
All Implemented Interfaces:
Cloneable, Serializable
Direct Known Subclasses:
ArchiveCutoff, AuthorityInfoAccess, AuthorityKeyID, BasicConstraints, BiometricInfo, CertificateIssuer, CertPolicies, CRLDistributionPoints, CRLNumber, CRLReference, DeltaCRLIndicator, ExtendedKeyUsage, HoldInstructionCode, InhibitAnyPolicy, InvalidityDate, IssuerAltName, IssuingDistributionPoint, KeyUsage, NameConstraints, NetscapeBaseURL, NetscapeCAPolicyURL, NetscapeCARevocationURL, NetscapeCertRenewalURL, NetscapeCertType, NetscapeComment, NetscapeRevocationURL, NetscapeSSLServerName, NonStandardExtension, OCSPAcceptableResponses, OCSPNoCheck, OCSPNonce, OCSPServiceLocator, PolicyConstraints, PolicyMappings, PrivateKeyUsagePeriod, QCStatements, ReasonCode, SubjectAltName, SubjectDirectoryAttributes, SubjectKeyID, VeriSignCZAG, VeriSignFidelityUniqueID, VeriSignJurisdictionHash, VeriSignNetscapeInBoxV1, VeriSignNetscapeInBoxV2, VeriSignNonVerifiedElements, VeriSignSerialNumberRollover, VeriSignTokenType

public abstract class X509V3Extension
extends Object
implements Cloneable, Serializable

This class is the superclass of all X.509 V3 extension objects. X.509 V3 extensions are extensions that are used with X.509 version 3 certificatea and CRLs. The ASN.1 definition is defined as follows:

 Extension ::= SEQUENCE {
   extnId        EXTENSION.&id ({ExtensionSet}),
   critical      BOOLEAN DEFAULT FALSE,
   extnValue     OCTET STRING
     -- contains a DER encoding of a value of type &ExtnType
     -- for the extension object identified by extnId -- }
 

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

See Also

Serialized Form

Field Summary

static int

ARCHIVE_CUTOFF

Indicates the archive cutoff extension.

static byte[]

ARCHIVE_CUTOFF_OID

The archive cutoff OID.

static int

AUTHORITY_INFO_ACCESS

Indicates the authority info access extension.

static byte[]

AUTHORITY_INFO_OID

The authority info access OID.

static int

AUTHORITY_KEY_ID

The last byte in the authority key ID OID that identifies the authority key ID extension.

static int

BASIC_CONSTRAINTS

The last byte in the basic constraints OID that identifies the basic constraints extension.

static int

BIO_INFO

Indicates the Biometric Info extension.

static byte[]

BIO_INFO_OID

The Biometric Info OID.

static int

CERT_POLICIES

The last byte in the cert policies OID that identifies the cert policies extension.

static int

CERTIFICATE_ISSUER

The last byte in the certificate issuer OID that identifies the certificate issuer extension.

static int

CRL_DISTRIBUTION_POINTS

The last byte in the CRL distribution points OID that identifies the CRL distribution points extension.

static int

CRL_NUMBER

The last byte in the CRL number OID that identifies the CRL number extension.

static int

CRL_REFERENCE

Indicates the CRL reference extension.

static byte[]

CRL_REFERENCE_OID

The CRL reference OID.

static int

DELTA_CRL_INDICATOR

The last byte in the delta CRL indicator OID that identifies the delta CRL indicator extension.

static int

EXTENDED_KEY_USAGE

The last byte in the extended key usage OID that identifies the extended key usage extension.

static int

HOLD_INSTRUCTION_CODE

The last byte in the hold instruction code OID that identifies the hold instruction code extension.

static int

INHIBIT_ANY_POLICY

The last byte in the Inhibit Any-Policy OID that identifies the Inhibit Any-Policy OID extension.

static int

INVALIDITY_DATE

The last byte in the invalidity date OID that identifies the invalidity date extension.

static int

ISSUER_ALT_NAME

The last byte in the issuer alt name OID that identifies the issuer alt name extension.

static int

ISSUING_DISTRIBUTION_POINT

The last byte in the issuing distribution point OID, that identifies the issuing distribution point extension.

static int

KEY_USAGE

The last byte in the key usage OID that identifies the key usage extension.

static int

NAME_CONSTRAINTS

The last byte in the name constraints OID that identifies the name constraints extension.

static int

NETSCAPE_BASE_URL

Indicates the Netscape base URL extension.

static byte[]

NETSCAPE_BASE_URL_OID

The Netscape base URL OID.

static int

NETSCAPE_CA_POLICY_URL

Indicates the Netscape CA policy URL extension.

static byte[]

NETSCAPE_CA_POLICY_URL_OID

The Netscape CA policy URL OID.

static int

NETSCAPE_CA_REVOCATION_URL

Indicates the Netscape CA revocation URL extension.

static byte[]

NETSCAPE_CA_REVOCATION_URL_OID

The Netscape CA revocation URL OID.

static int

NETSCAPE_CERT_RENEWAL_URL

Indicates the Netscape cert renewal URL extension.

static byte[]

NETSCAPE_CERT_RENEWAL_URL_OID

The Netscape cert renewal URL OID.

static int

NETSCAPE_CERT_TYPE

Indicates the Netscape cert type extension.

static byte[]

NETSCAPE_CERT_TYPE_OID

The Netscape cert type OID.

static int

NETSCAPE_COMMENT

Indicates the Netscape comment extension.

static byte[]

NETSCAPE_COMMENT_OID

The Netscape comment OID.

static int

NETSCAPE_REVOCATION_URL

Indicates the Netscape revocation URL extension.

static byte[]

NETSCAPE_REVOCATION_URL_OID

The Netscape revocation URL OID.

static int

NETSCAPE_SSL_SERVER_NAME

Indicates the Netscape SSL server name extension.

static byte[]

NETSCAPE_SSL_SERVER_NAME_OID

The Netscape SSL server name OID.

static int

NON_STANDARD_EXTENSION

Use this flag to get an extension by type, or to determine what kind of extension an unknown object contains.

static int

OCSP_ACCEPTABLE_RESPONSES

Indicates the OCSP acceptable responses extension.

static byte[]

OCSP_ACCEPTABLE_RESPONSES_OID

The OCSP acceptable responses OID.

static int

OCSP_NOCHECK

Indicates the OCSP no check extension.

static byte[]

OCSP_NOCHECK_OID

The OCSP no check OID.

static int

OCSP_NONCE

Indicates the OCSP nonce extension.

static byte[]

OCSP_NONCE_OID

The OCSP nonce OID.

static int

OCSP_SERVICE_LOCATOR

Indicates the OCSP service locator extension.

static byte[]

OCSP_SERVICE_LOCATOR_OID

The OCSP service locator OID.

static int

POLICY_CONSTRAINTS

The last byte in the policy constraint OID that identifies the policy constraint extension.

static int

POLICY_MAPPINGS

The last byte in the policy mapping OID that identifies the policy mapping extension.

static int

PRIVATE_KEY_USAGE_PERIOD

The last byte in the private key usage period OID that identifies the private key usage period extension.

static int

QC_STATEMENTS

Indicates the QCStatements extension.

static byte[]

QC_STATEMENTS_OID

The QCStatements OID.

static int

REASON_CODE

The last byte in the reason code OID that identifies the reason code extension.

static int

SUBJECT_ALT_NAME

The last byte in the subject alt name OID that identifies the subject alt name extension.

static int

SUBJECT_DIRECTORY_ATTRIBUTES

The last byte in the subject directory attributes OID that identifies the subject directory attributes extension.

static int

SUBJECT_KEY_ID

The last byte in the subject key ID OID that identifies the subject key ID extension.

static int

VERISIGN_CZAG

Indicates the VeriSign CZAG extension.

static byte[]

VERISIGN_CZAG_OID

The VeriSign CZAG OID.

static int

VERISIGN_FIDELITY_ID

Indicates the VeriSign Fidelity unique ID extension.

static byte[]

VERISIGN_FIDELITY_ID_OID

The VeriSign Fidelity unique ID OID.

static int

VERISIGN_JURISDICTION_HASH

Indicates the VeriSign jurisdiction hash extension.

static byte[]

VERISIGN_JURISDICTION_HASH_OID

The VeriSign jurisdiction hash OID.

static int

VERISIGN_NETSCAPE_INBOX_V1

Indicates the VeriSign Netscape Inbox V1 extension.

static byte[]

VERISIGN_NETSCAPE_INBOX_V1_OID

The VeriSign Netscape Inbox V1 OID.

static int

VERISIGN_NETSCAPE_INBOX_V2

Indicates the VeriSign Netscape Inbox V2 extension.

static byte[]

VERISIGN_NETSCAPE_INBOX_V2_OID

The VeriSign Netscape Inbox V2 OID.

static int

VERISIGN_NON_VERIFIED

Indicates the VeriSign non-verified elements extension.

static byte[]

VERISIGN_NON_VERIFIED_OID

The VeriSign non-verified elements OID.

static int

VERISIGN_SERIAL_NUMBER

Indicates the VeriSign serial number rollover extension.

static byte[]

VERISIGN_SERIAL_NUMBER_OID

The VeriSign serial number rollover OID.

static int

VERISIGN_TOKEN_TYPE

Indicates the VeriSign token type extension.

static byte[]

VERISIGN_TOKEN_TYPE_OID

The VeriSign token type OID.

 

Constructor Summary

X509V3Extension()

 

 

Method Summary

abstract  Object

clone()

Overrides the default clone method to get a deeper clone.

abstract  void

decodeValue(byte[] valueBER, int offset)

Decode the value.

abstract  int

derEncodeValue(byte[] encoding, int offset)

Place the encoding of the value into encoding, beginning at offset.

abstract  int

derEncodeValueInit()

Initialize for encoding the value.

static void

extend(byte[] oid, X509V3Extension extension)

Extends this class to accept a new extension type.

 boolean

getCriticality()

Gets the criticality.

 int

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

Places the DER encoding of the extension in this object into encoding, beginning at offset.

 int

getDERLen(int special)

Returns the number of bytes of the DER encoding of this extension.

 int

getExtensionType()

Gets the flag that describes the extension type.

 String

getExtensionTypeString()

Gets the name of the extension type.

static X509V3Extension

getInstance(byte[] extensionBER, int offset)

Given extensionBER, the BER of an extension beginning at offset, this method determines which extension it is and then instantiates the appropriate subclass.

static int

getNextBEROffset(byte[] extensionBER, int offset)

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

 boolean

isExtensionType(int type)

Checks to see if this object is a extension type represented by the given type, which should be one of the extension type fields previously defined in this class.

 void

setCriticality(boolean proposedCriticality)

Sets the criticality.

 void

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

Sets the encoding of the value.

 void

setSpecialOID(byte[] extOID)

Set the OID to be the special one.

 void

setStandardOID(int lastByte)

Set the OID to be the standard one.

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

Field Detail

SUBJECT_KEY_ID

public static final int SUBJECT_KEY_ID
The last byte in the subject key ID OID that identifies the subject key ID extension.

AUTHORITY_KEY_ID

public static final int AUTHORITY_KEY_ID
The last byte in the authority key ID OID that identifies the authority key ID extension.

KEY_USAGE

public static final int KEY_USAGE
The last byte in the key usage OID that identifies the key usage extension.

PRIVATE_KEY_USAGE_PERIOD

public static final int PRIVATE_KEY_USAGE_PERIOD
The last byte in the private key usage period OID that identifies the private key usage period extension.

SUBJECT_ALT_NAME

public static final int SUBJECT_ALT_NAME
The last byte in the subject alt name OID that identifies the subject alt name extension.

ISSUER_ALT_NAME

public static final int ISSUER_ALT_NAME
The last byte in the issuer alt name OID that identifies the issuer alt name extension.

BASIC_CONSTRAINTS

public static final int BASIC_CONSTRAINTS
The last byte in the basic constraints OID that identifies the basic constraints extension.

SUBJECT_DIRECTORY_ATTRIBUTES

public static final int SUBJECT_DIRECTORY_ATTRIBUTES
The last byte in the subject directory attributes OID that identifies the subject directory attributes extension.

NAME_CONSTRAINTS

public static final int NAME_CONSTRAINTS
The last byte in the name constraints OID that identifies the name constraints extension.

CERT_POLICIES

public static final int CERT_POLICIES
The last byte in the cert policies OID that identifies the cert policies extension.

POLICY_MAPPINGS

public static final int POLICY_MAPPINGS
The last byte in the policy mapping OID that identifies the policy mapping extension.

POLICY_CONSTRAINTS

public static final int POLICY_CONSTRAINTS
The last byte in the policy constraint OID that identifies the policy constraint extension.

EXTENDED_KEY_USAGE

public static final int EXTENDED_KEY_USAGE
The last byte in the extended key usage OID that identifies the extended key usage extension.

CRL_NUMBER

public static final int CRL_NUMBER
The last byte in the CRL number OID that identifies the CRL number extension.

REASON_CODE

public static final int REASON_CODE
The last byte in the reason code OID that identifies the reason code extension.

HOLD_INSTRUCTION_CODE

public static final int HOLD_INSTRUCTION_CODE
The last byte in the hold instruction code OID that identifies the hold instruction code extension.

INVALIDITY_DATE

public static final int INVALIDITY_DATE
The last byte in the invalidity date OID that identifies the invalidity date extension.

DELTA_CRL_INDICATOR

public static final int DELTA_CRL_INDICATOR
The last byte in the delta CRL indicator OID that identifies the delta CRL indicator extension.

ISSUING_DISTRIBUTION_POINT

public static final int ISSUING_DISTRIBUTION_POINT
The last byte in the issuing distribution point OID, that identifies the issuing distribution point extension.

CERTIFICATE_ISSUER

public static final int CERTIFICATE_ISSUER
The last byte in the certificate issuer OID that identifies the certificate issuer extension.

CRL_DISTRIBUTION_POINTS

public static final int CRL_DISTRIBUTION_POINTS
The last byte in the CRL distribution points OID that identifies the CRL distribution points extension.

INHIBIT_ANY_POLICY

public static final int INHIBIT_ANY_POLICY
The last byte in the Inhibit Any-Policy OID that identifies the Inhibit Any-Policy OID extension.

AUTHORITY_INFO_ACCESS

public static final int AUTHORITY_INFO_ACCESS
Indicates the authority info access extension.

AUTHORITY_INFO_OID

public static final byte[] AUTHORITY_INFO_OID
The authority info access OID. A PKIX-defined extension.

NETSCAPE_CERT_TYPE

public static final int NETSCAPE_CERT_TYPE
Indicates the Netscape cert type extension.

NETSCAPE_CERT_TYPE_OID

public static final byte[] NETSCAPE_CERT_TYPE_OID
The Netscape cert type OID. A Netscape-defined extension.

NETSCAPE_BASE_URL

public static final int NETSCAPE_BASE_URL
Indicates the Netscape base URL extension.

NETSCAPE_BASE_URL_OID

public static final byte[] NETSCAPE_BASE_URL_OID
The Netscape base URL OID. A Netscape-defined extension.

NETSCAPE_REVOCATION_URL

public static final int NETSCAPE_REVOCATION_URL
Indicates the Netscape revocation URL extension.

NETSCAPE_REVOCATION_URL_OID

public static final byte[] NETSCAPE_REVOCATION_URL_OID
The Netscape revocation URL OID. A Netscape-defined extension.

NETSCAPE_CA_REVOCATION_URL

public static final int NETSCAPE_CA_REVOCATION_URL
Indicates the Netscape CA revocation URL extension.

NETSCAPE_CA_REVOCATION_URL_OID

public static final byte[] NETSCAPE_CA_REVOCATION_URL_OID
The Netscape CA revocation URL OID. A Netscape-defined extension.

NETSCAPE_CERT_RENEWAL_URL

public static final int NETSCAPE_CERT_RENEWAL_URL
Indicates the Netscape cert renewal URL extension.

NETSCAPE_CERT_RENEWAL_URL_OID

public static final byte[] NETSCAPE_CERT_RENEWAL_URL_OID
The Netscape cert renewal URL OID. A Netscape-defined extension.

NETSCAPE_CA_POLICY_URL

public static final int NETSCAPE_CA_POLICY_URL
Indicates the Netscape CA policy URL extension.

NETSCAPE_CA_POLICY_URL_OID

public static final byte[] NETSCAPE_CA_POLICY_URL_OID
The Netscape CA policy URL OID. A Netscape-defined extension.

NETSCAPE_SSL_SERVER_NAME

public static final int NETSCAPE_SSL_SERVER_NAME
Indicates the Netscape SSL server name extension.

NETSCAPE_SSL_SERVER_NAME_OID

public static final byte[] NETSCAPE_SSL_SERVER_NAME_OID
The Netscape SSL server name OID. A Netscape-defined extension.

NETSCAPE_COMMENT

public static final int NETSCAPE_COMMENT
Indicates the Netscape comment extension.

NETSCAPE_COMMENT_OID

public static final byte[] NETSCAPE_COMMENT_OID
The Netscape comment OID. A Netscape-defined extension.

VERISIGN_CZAG

public static final int VERISIGN_CZAG
Indicates the VeriSign CZAG extension.

VERISIGN_CZAG_OID

public static final byte[] VERISIGN_CZAG_OID
The VeriSign CZAG OID. A VeriSign-defined extension.

VERISIGN_FIDELITY_ID

public static final int VERISIGN_FIDELITY_ID
Indicates the VeriSign Fidelity unique ID extension.

VERISIGN_FIDELITY_ID_OID

public static final byte[] VERISIGN_FIDELITY_ID_OID
The VeriSign Fidelity unique ID OID. A VeriSign-defined extension.

VERISIGN_NETSCAPE_INBOX_V1

public static final int VERISIGN_NETSCAPE_INBOX_V1
Indicates the VeriSign Netscape Inbox V1 extension.

VERISIGN_NETSCAPE_INBOX_V1_OID

public static final byte[] VERISIGN_NETSCAPE_INBOX_V1_OID
The VeriSign Netscape Inbox V1 OID. A VeriSign-defined extension.

VERISIGN_NETSCAPE_INBOX_V2

public static final int VERISIGN_NETSCAPE_INBOX_V2
Indicates the VeriSign Netscape Inbox V2 extension.

VERISIGN_NETSCAPE_INBOX_V2_OID

public static final byte[] VERISIGN_NETSCAPE_INBOX_V2_OID
The VeriSign Netscape Inbox V2 OID. A VeriSign-defined extension.

VERISIGN_JURISDICTION_HASH

public static final int VERISIGN_JURISDICTION_HASH
Indicates the VeriSign jurisdiction hash extension.

VERISIGN_JURISDICTION_HASH_OID

public static final byte[] VERISIGN_JURISDICTION_HASH_OID
The VeriSign jurisdiction hash OID. A VeriSign-defined extension.

VERISIGN_TOKEN_TYPE

public static final int VERISIGN_TOKEN_TYPE
Indicates the VeriSign token type extension.

VERISIGN_TOKEN_TYPE_OID

public static final byte[] VERISIGN_TOKEN_TYPE_OID
The VeriSign token type OID. A VeriSign-defined extension.

VERISIGN_SERIAL_NUMBER

public static final int VERISIGN_SERIAL_NUMBER
Indicates the VeriSign serial number rollover extension.

VERISIGN_SERIAL_NUMBER_OID

public static final byte[] VERISIGN_SERIAL_NUMBER_OID
The VeriSign serial number rollover OID. A VeriSign-defined extension.

VERISIGN_NON_VERIFIED

public static final int VERISIGN_NON_VERIFIED
Indicates the VeriSign non-verified elements extension.

VERISIGN_NON_VERIFIED_OID

public static final byte[] VERISIGN_NON_VERIFIED_OID
The VeriSign non-verified elements OID. A VeriSign-defined extension.

OCSP_NOCHECK

public static final int OCSP_NOCHECK
Indicates the OCSP no check extension.

OCSP_NOCHECK_OID

public static final byte[] OCSP_NOCHECK_OID
The OCSP no check OID.

ARCHIVE_CUTOFF

public static final int ARCHIVE_CUTOFF
Indicates the archive cutoff extension.

ARCHIVE_CUTOFF_OID

public static final byte[] ARCHIVE_CUTOFF_OID
The archive cutoff OID.

CRL_REFERENCE

public static final int CRL_REFERENCE
Indicates the CRL reference extension.

CRL_REFERENCE_OID

public static final byte[] CRL_REFERENCE_OID
The CRL reference OID.

OCSP_NONCE

public static final int OCSP_NONCE
Indicates the OCSP nonce extension.

OCSP_NONCE_OID

public static final byte[] OCSP_NONCE_OID
The OCSP nonce OID.

OCSP_ACCEPTABLE_RESPONSES

public static final int OCSP_ACCEPTABLE_RESPONSES
Indicates the OCSP acceptable responses extension.

OCSP_ACCEPTABLE_RESPONSES_OID

public static final byte[] OCSP_ACCEPTABLE_RESPONSES_OID
The OCSP acceptable responses OID.

OCSP_SERVICE_LOCATOR

public static final int OCSP_SERVICE_LOCATOR
Indicates the OCSP service locator extension.

OCSP_SERVICE_LOCATOR_OID

public static final byte[] OCSP_SERVICE_LOCATOR_OID
The OCSP service locator OID.

QC_STATEMENTS

public static final int QC_STATEMENTS
Indicates the QCStatements extension.

QC_STATEMENTS_OID

public static final byte[] QC_STATEMENTS_OID
The QCStatements OID.

BIO_INFO

public static final int BIO_INFO
Indicates the Biometric Info extension.

BIO_INFO_OID

public static final byte[] BIO_INFO_OID
The Biometric Info OID.

NON_STANDARD_EXTENSION

public static final int NON_STANDARD_EXTENSION
Use this flag to get an extension by type, or to determine what kind of extension an unknown object contains.
Constructor Detail

X509V3Extension

public X509V3Extension()
Method Detail

extend

public static void extend(byte[] oid,
                          X509V3Extension extension)
                   throws CertificateException
Extends this class to accept a new extension type.

Parameters

         oid  

A byte array containing the OID of the new extension type to be added.

         extension  

An X509V3Extension object holding the new extension object. The class of this argument should be defined as follows. The example demonstrates how to define a certificate extension class, MyExtension.

   public class MyExtension
     extends X509V3Extension
     implements Cloneable, Serializable, CertExtension
   {
     // Constructs an instance of the class.
     public MyExtension (......) 
     {
       this.extensionTypeFlag = NON_STANDARD_EXTENSION;
       extensionTypeString = "My Extension";
       ......
     }
 
     // Initializes for encoding the value.
     // Returns many bytes the encoding will be.
     public int derEncodeValueInit ()
     {
       ......
     }

     // Places the encoding of the value into the encoding 
     // array, beginning at the offset index. This is 
     // the actual contents that are wrapped in 
     // the OCTET STRING (not the surrounding OCTET STRING tag 
     // and length).
     // It returns the number of bytes actually placed into 
     // the encoding array.
     public int derEncodeValue (byte[] encoding, int offset)
     {
       ......
     }

     // Decodes the value. The valueBER is the BER encoding 
     // that was wrapped in the OCTET STRING. 
     public void decodeValue (byte[] valueBER, int offset)
       throws CertificateException
     {
       ......
     }

     // Overrides the default clone method.
     public Object clone ()
       throws CloneNotSupportedException
     {
       ......
     }

 

Throws

CertificateException - If any of the arguments is null, or the oid is already used..

getInstance

public static X509V3Extension getInstance(byte[] extensionBER,
                                          int offset)
                                   throws CertificateException
Given extensionBER, the BER of an extension beginning at offset, this method determines which extension it is and then instantiates the appropriate subclass.

Parameters

         extensionBER  

The BER encoding of an extension.

         offset  

The offset into extensionBER where the encoding begins.

Returns

A new X509V3Extension object that contains the extension.

Throws

CertificateException - If the encoding is not a valid extension.

setEncoding

public void setEncoding(byte[] data,
                        int offset,
                        int len)
Sets the encoding of the value.

Parameters

         data  

The byte array that contains the encoding.

         offset  

The offset into encoding where the encoding to use starts.

         len  

The length of the encoding.


getNextBEROffset

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

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

Parameters

         extensionBER  

The BER encoding of a X509V3Extension object.

         offset  

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

setStandardOID

public void setStandardOID(int lastByte)
Set the OID to be the standard one. The first two bytes are always the same, the third byte is lastByte.

Parameters

         lastByte  

The last byte of the OID.


setSpecialOID

public void setSpecialOID(byte[] extOID)
Set the OID to be the special one.

Parameters

         extensionOID  

the OID.


setCriticality

public void setCriticality(boolean proposedCriticality)
Sets the criticality. Each extension in a certificate may be designated as critical or non-critical. A certificate-using system must reject the certificate if it encounters a critical extension it does not recognize. However, a non-critical extension may be ignored if it is not recognized. The value true means that the extension is to be marked critical.

Parameters

         proposedCriticality  

The criticality to set.


getCriticality

public boolean getCriticality()
Gets the criticality. Each extension in a certificate may be designated as critical or non-critical. A certificate using system must reject the certificate if it encounters a critical extension it does not recognize; however, a non-critical extension may be ignored if it is not recognized. The value true means that the extension has been marked critical.

Returns

The extension criticality value.

decodeValue

public abstract void decodeValue(byte[] valueBER,
                                 int offset)
                          throws CertificateException
Decode the value. Each subclass will have a different way to decode what was wrapped in the OCTET STRING.

Parameters

         valueBER  

The BER encoding of the extension's value.

         offset  

The offset into valueBER where the encoding begins.

Throws

CertificateException - If the encoding is invalid for this extension.

getExtensionType

public int getExtensionType()
Gets the flag that describes the extension type.

Returns

One of the extension-type fields previously defined in this class.

getExtensionTypeString

public String getExtensionTypeString()
Gets the name of the extension type.

Returns

A String that contains the name of the extension type.

isExtensionType

public boolean isExtensionType(int type)
Checks to see if this object is a extension type represented by the given type, which should be one of the extension type fields previously defined in this class.

Parameters

         type  

The extension-type flag to check.

Returns

A boolean, indicating whether this object is of the type contained in type.

getDERLen

public int getDERLen(int special)
Returns the number of bytes of the DER encoding of this extension. If this object is not set with values, the this method returns zero.

The ASN.1 definition of Extension is
      Extension ::= SEQUENCE { . . . }
That ASN.1 definition means the tag will be 0x30. However, an extension object can be part of some other construct, and it may have a different tag caused by IMPLICIT or EXPLICIT. For example, suppose the definition is as follows:

      extension   [1] IMPLICIT Extension
In this case, the tag will change from 0x30 to 0xa1. To indicate that the DER encoding of Extension should follow special circumstances, use the special argument. Set special to any special instructions of the DER encoding. 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

         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 to contain the DER encoding of this Extension.

derEncodeValueInit

public abstract int derEncodeValueInit()
Initialize for encoding the value.

Returns

How many bytes the encoding will be.

getDEREncoding

public int getDEREncoding(byte[] encoding,
                          int offset,
                          int special)
Places the DER encoding of the extension in this 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 byte array and returns zero.

The ASN.1 definition of Extensions is
      extension ::= SEQUENCE { . . . 
That ASN.1 definition means the tag will be 0x30. However, an extension object can be part of some other construct, and it may have a different tag caused by IMPLICIT or EXPLICIT. For example, suppose the definition is as follows:

      extension   [1] IMPLICIT Extension
In this case, the tag will change from 0x30 to 0xa1. To indicate that the DER encoding of Extension should follow special circumstances, use the special argument. Set special to any special instructions of the DER encoding. 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 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 actually placed into encoding.

derEncodeValue

public abstract int derEncodeValue(byte[] encoding,
                                   int offset)
Place the encoding of the value into encoding, beginning at offset. This is the actual contents that are wrapped in the OCTET STRING (not the surrounding OCTET STRING tag and length).

Parameters

         encoding  

The byte array into which the result will be placed.

         offset  

The offest into encoding where the writing is to begin.

Returns

The number of bytes actually placed into encoding.

clone

public abstract Object clone()
                      throws CloneNotSupportedException
Overrides the default clone method to get a deeper clone.

Returns

A new X509V3Extension 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