com.rsa.certj.cert.extensions

Class PolicyQualifiers

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

public class PolicyQualifiers
extends Object
implements Cloneable, Serializable

This class contains the policy qualifier values for the CertificatePolicies extension.

The ASN.1 definition is as follows:

 policyQualifiers ::= SEQUENCE SIZE (1..MAX) OF PolicyQualifierInfo 

 PolicyQualifierInfo ::= SEQUENCE {
       policyQualifierId  PolicyQualifierId,
       qualifier          ANY DEFINED BY policyQualifierId }

 PolicyQualifierId ::= OBJECT IDENTIFIER
 

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

See Also

Serialized Form

Constructor Summary

PolicyQualifiers()

Constructs an empty PolicyQualifiers object.

PolicyQualifiers(byte[] valueBER, int offset, int special)

Constructs a PolicyQualifiers object and initializes it with the given values.

 

Method Summary

 void

addPolicyQualifier(byte[] id, int idOffset, int idLen, byte[] data, int dataOffset, int dataLen)

Adds the PolicyQualifiers values.

 Object

clone()

Overrides the default clone method to get a deeper clone.

 boolean

equals(Object obj)

Returns true if this object and obj contains the same PolicyQualifiers, returns false otherwise.

 int

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

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

static int

getNextBEROffset(byte[] valueBER, int offset)

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

 byte[]

getPolicyQualifierId(int Index)

Gets the OID value of the PolicyQualifier object specified by index.

 byte[]

getQualifier(int Index)

Gets the data value of the PolicyQualifier object specified by index.

 int

getQualifiersCount()

Gets the number of policy qualifier elements in this object.

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

Constructor Detail

PolicyQualifiers

public PolicyQualifiers()
Constructs an empty PolicyQualifiers object.

PolicyQualifiers

public PolicyQualifiers(byte[] valueBER,
                        int offset,
                        int special)
                 throws CertificateException
Constructs a PolicyQualifiers object and initializes it with the given values.

Parameters

         valueBER  

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

         offset  

The offset into the valueBER array.

         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

CertificateException - If this method cannot decode PolicyQualifiers.
Method Detail

addPolicyQualifier

public void addPolicyQualifier(byte[] id,
                               int idOffset,
                               int idLen,
                               byte[] data,
                               int dataOffset,
                               int dataLen)
                        throws CertificateException
Adds the PolicyQualifiers values.

Parameters

         id  

The policy qualifier ID.

         idOffset  

The offset into the id array.

         idLen  

The length of the id array.

         data  

The qualifier value that can be any valid BER encoding.

         dataOffset  

The offset into the data array.

         dataLen  

The length of the data array.

Throws

CertificateException - If data or id are null.

getPolicyQualifierId

public byte[] getPolicyQualifierId(int Index)
                            throws CertificateException
Gets the OID value of the PolicyQualifier object specified by index.

Parameters

         index  

The index to the list of PolicyQualifier elements.

Returns

The policy qualifier ID.

Throws

CertificateException - If the specified index is invalid.

getQualifier

public byte[] getQualifier(int Index)
                    throws CertificateException
Gets the data value of the PolicyQualifier object specified by index.

Parameters

         index  

The index to the list of PolicyQualifier elements.

Returns

The policy qualifier data value.

Throws

CertificateException - If the specified index is invalid.

getQualifiersCount

public int getQualifiersCount()
Gets the number of policy qualifier elements in this object.

Returns

The number of policy qualifier elements in this object.

getNextBEROffset

public static int getNextBEROffset(byte[] valueBER,
                                   int offset)
                            throws CertificateException
Gets the next offset after the name: Given nameBER, the BER encoding of a PolicyQualifiers 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 PolicyQualifiers object is 1819 bytes, this method returns 1939, the index immediately following the PolicyQualifiers object. nameBER[120] is the first byte in the encoding of the PolicyQualifiers object, nameBER[1938] is the last byte in the encoding of the PolicyQualifiers object, and the next element begins at index 1939.

Parameters

         nameBER  

The BER encoding of a PolicyQualifiers object.

         offset  

The offset into nameBER where the encoding begins.

Returns

The index to the next element in the BER encoding.

Throws

CertificateException - If the method cannot read the BER encoding.

getDERLen

public int getDERLen(int special)
              throws CertificateException
Returns the number of bytes that will be used by the DER encoding of this PolicyQualifiers 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.

Throws

CertificateException - If PolicyQualifiers cannot be encoded.

getDEREncoding

public int getDEREncoding(byte[] encoding,
                          int offset,
                          int special)
                   throws CertificateException
Places the DER encoding of the PolicyQualifiers 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 the DER encoding of the PolicyQualifiers object begins.

         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

CertificateException - If the method cannot create the DER encoding.

equals

public boolean equals(Object obj)
Returns true if this object and obj contains the same PolicyQualifiers, returns false otherwise.

Overrides

equals in class Object

Parameters

         obj  

An instance of PolicyQualifiers object.

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