com.rsa.certj.crmf

Class POPOPrivKey

java.lang.Object
  |
  +--com.rsa.certj.crmf.POPOPrivKey
All Implemented Interfaces:
Cloneable, Serializable

public class POPOPrivKey
extends Object
implements Cloneable, Serializable

This class contains the POPOPrivKeyfield from the ProofOfPossesion.

 POPOPrivKey ::= CHOICE {
   thisMessage        [0] BIT STRING 
     -- possesion is proven in this message (which contains the private key 
     -- itself, encrypted and wrapped in EncryptedValue structure).
   subsequentMessage  [1] SubsequentMessage,
     -- possession will be proven in subsequent message
   dhMAC              [2] BIT STRING }
     -- for keyAgreement (only), possesion is proven in this message,
     -- (which contains a MAC (over the DER-encodedvalue of the
     -- certReq parameter in CertReqMsg, which MUST include both subject
     -- and publicKey) based on a key derived from the end entity's
     -- private DH key and the CA's public DH key);
     -- the dhMAC value MUST be calculated as per the directions given 
     -- in Appendix A in CRMF.
 
 SubsequentMessage ::= INTEGER {
   encrCert (0),
     -- requests that resulting certificate be encrypted for the
     -- end entity (following which, POP will be proven in a 
     -- confirmation message)
   challengeResp (1) }
     -- requests that CA/RA engage in challenge-response exchange with
     -- end entity in order to prove private key possession
 
dhMAC option is not supported in this release

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

See Also

Serialized Form

Field Summary

static int

CHALLENGE_RESPONSE

This flag indicates that SubsequenntMessage is of the type ChallengeResponse

static int

ENCRYPTED_CERT

This flag indicates that SubsequentMessage is of type EncryptedCerrtificate

static int

SUBSEQUENT_MESSAGE

This flag indicates that we are going to use "subsequentMessage" choice

static int

THIS_MESSAGE

This flag indicates that we are going to use "thisMessage" choice

 

Constructor Summary

POPOPrivKey()

Creates a POPOPrivKey

 

Method Summary

 Object

clone()

Overrides the default clone method to get a deeper clone.

 void

decodePOPOPrivKey(byte[] keyBER, int offset, int special)

Decode the POPOPrivKey structure.

 boolean

equals(Object obj)

Returns true if this object and obj contain the same POPOPrivKey, returns false otherwise.

 int

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

Places the DER encoding of the POPOPrivKey object into encoding, beginning at offset.

 int

getDERLen(int special)

Returns the number of bytes that will be used by the DER encoding of the POPOPrivKey.

 EncryptedValue

getEncryptedValue()

Gets the EncryptedValue object.

static int

getNextBEROffset(byte[] valueBER, int offset)

Finds the index of the next element to encode, given valueBER, the BER of a POPOPrivKey beginning at offset.

 int

getSubsequentMessage()

Gets the value of Subsequent Message

 int

getType()

Gets the type of this POPOPrivKey structure

 void

setEncryptedValue(EncryptedValue value)

Sets the EncryptedValue object, if this object is of THIS_MESSAGE type

 void

setEnvironment(CertJ certJ, com.rsa.jsafe.JSAFE_PublicKey pubKey, com.rsa.jsafe.JSAFE_PrivateKey privKey)

Sets the environment variables; use this method only if use THIS_MESSAGE option.

 void

setSubsequentMessage(int value)

Sets the value of Subsequent Message

 void

setType(int type)

Set the type of this POPOPrivKey; one of the flags defined in this class.

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

Field Detail

THIS_MESSAGE

public static final int THIS_MESSAGE
This flag indicates that we are going to use "thisMessage" choice

SUBSEQUENT_MESSAGE

public static final int SUBSEQUENT_MESSAGE
This flag indicates that we are going to use "subsequentMessage" choice

ENCRYPTED_CERT

public static final int ENCRYPTED_CERT
This flag indicates that SubsequentMessage is of type EncryptedCerrtificate

CHALLENGE_RESPONSE

public static final int CHALLENGE_RESPONSE
This flag indicates that SubsequenntMessage is of the type ChallengeResponse
Constructor Detail

POPOPrivKey

public POPOPrivKey()
Creates a POPOPrivKey
Method Detail

setType

public void setType(int type)
             throws CRMFException
Set the type of this POPOPrivKey; one of the flags defined in this class.

Parameters

         type  

Type of this POPOPrivKey

Throws

CRMFException - If it is invalid type

getType

public int getType()
Gets the type of this POPOPrivKey structure

Returns

Type that specifies how we are going to encode POPOPrivKey

setEnvironment

public void setEnvironment(CertJ certJ,
                           com.rsa.jsafe.JSAFE_PublicKey pubKey,
                           com.rsa.jsafe.JSAFE_PrivateKey privKey)
Sets the environment variables; use this method only if use THIS_MESSAGE option.

Parameters

         certJ  

CertJ object that contains environment information

         pubKey  

Public key used to encrypt the Secret key in EncryptedValue structure (pass NULL if decoding)

         privKey  

Private key used to decrypt the Secret key in EncryptedValue structure (pass NULL if encoding)


setEncryptedValue

public void setEncryptedValue(EncryptedValue value)
                       throws CRMFException
Sets the EncryptedValue object, if this object is of THIS_MESSAGE type

Parameters

         value  

The strucure that contains the encrypted Private Key

Throws

CRMFException - If there is a cloning error; or if this object is of SUBSEQUENT_MESSAGE type; or if specified value is null.

getEncryptedValue

public EncryptedValue getEncryptedValue()
                                 throws CRMFException
Gets the EncryptedValue object.

Returns

The EncryptedValue object, if you set the type to THIS_MESSAGE; if this value is not set, returns null

Throws

CRMFException - If if there is a cloning error; or if this object is of SUBSEQUENT_MESSAGE type

setSubsequentMessage

public void setSubsequentMessage(int value)
                          throws CRMFException
Sets the value of Subsequent Message

Parameters

         value  

The type of the Subsequent Message: the resulting certificate will be encrypted for EE or CA/RA will engage in challenge-response exchange with EE; should be one of the flags defined in this class

Throws

CRMFException - If specified type is invalid

getSubsequentMessage

public int getSubsequentMessage()
Gets the value of Subsequent Message

Returns

The type of the Subsequent Message: the resulting certificate will be encrypted for EE or CA/RA will engage in challenge-response exchange with EE.

decodePOPOPrivKey

public void decodePOPOPrivKey(byte[] keyBER,
                              int offset,
                              int special)
                       throws CRMFException
Decode the POPOPrivKey structure. If this object is of THIS_MESSAGE type, user needs to set Recipient's private key and CertJ object that contains environment information before calling this method.

Parameters

         keyBER  

The byte array that contains BER encoding of this object

         offset  

Offset in this array

         special  

That contains any special ASN.1 info, such as OPTIONAL

Throws

CRMFException - If encoding is invalid

getNextBEROffset

public static int getNextBEROffset(byte[] valueBER,
                                   int offset)
                            throws CRMFException
Finds the index of the next element to encode, given valueBER, the BER of a POPOPrivKey beginning at offset. In other words, gets the next offset after the POPOPrivKey.

For example, if the offset is 120 and POPOPrivKey's BER encoding is 1819 bytes, this method returns 1939, the index immediately following the POPOPrivKey. That is, valueBER[120] is the first byte in the encoding of the POPOPrivKey, valueBER[1938] is the last byte in the encoding of the POPOPrivKey and the next element begins at index 1939.

Parameters

         valueBER  

The BER encoding of a POPOPrivKey

         offset  

The offset into valueBER where the encoding begins

Returns

An int that indicates the index to the next element in the BER encoding

Throws

CRMFException - If the method cannot read the BER encoding

getDERLen

public int getDERLen(int special)
              throws CRMFException
Returns the number of bytes that will be used by the DER encoding of the POPOPrivKey. If this object is not set with values, returns 0.

Parameters

         special  

That contains any special ASN.1 info, such as OPTIONAL

Returns

The number of bytes that will be used by the DER encoding of the POPOPrivKey.

getDEREncoding

public int getDEREncoding(byte[] encoding,
                          int offset,
                          int special)
                   throws CRMFException
Places the DER encoding of the POPOPrivKey object into encoding, beginning at offset. To determine how long the encoding will be, call getDERLen. If this object is not yet set with values, this method places nothing into the array and returns 0. To indicate that the DER encoding should follow any special instructions, use the special argument. For instance, to indicate

   data   [1] IMPLICIT INTEGER
 
pass in special = (ASN1.CONTEXT_IMPLICIT | 1);

Of course, if there are no special circumstances, pass in 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 writing is to begin.

         special  

That contains any special ASN.1 info, such as OPTIONAL

Returns

The number of bytes actually placed into encoding.

clone

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

Returns

A new POPOPrivKey object, a copy of this object

Throws

CloneNotSupportedException - If the cloning operation is not successful.

equals

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

Overrides

equals in class Object

Parameters

         obj  

The instance of POPOPrivKey object

Returns

A boolean that indicates whether these objects are equal.


RSA BSAFE ® Cert-J 2.1.1 001-047007-211-001-000