|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.rsa.certj.crmf.EncryptedKey
This class contains the EncryptedKey structure used in Archive Options Control, and in Proof Of Possesion of the Key Encipherment Keys.
EncryptedKey ::= CHOICE { encryptedValue EncryptedValue, envelopedData [0] EnvelopedData } -- The encrypted private key MUST be placed in the envelopedData -- encryptedContentInfo encryptedContent OCTET STRING. EncryptedValue ::= SEQUENCE { intendedAlg [0] AlgorithmIdentifier OPTIONAL, -- the intended algorithm for which the value will be used symmAlg [1] AlgorithmIdentifier OPTIONAL, -- the symmetric algorithm used to encrypt the value encSymmKey [2] BIT STRING OPTIONAL, -- the (encrypted) symmetric key used to encrypt the value keyAlg [3] AlgorithmIdentifier OPTIONAL, -- algorithm used to encrypt the symmetric key valueHint [4] OCTET STRING OPTIONAL, -- a brief description or identifier of the encValue content -- (may be meaningful only to the sending entity, and used only -- if EncryptedValue might be re-examined by the sending entity -- in the future) encValue BIT STRING } EnvelopedData ::= SEQUENCE { version Version, recipientInfos RecipientInfos, encryptedContentInfo EncryptedContentInfo } RecipientInfos ::= SET OF RecipientInfo EncryptedContentInfo ::= SEQUENCE { contentType ContentType, contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier, encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL } EncryptedContent ::= OCTET STRING |
See Also
Field Summary |
|
static int |
ENCRYPTED_VALUE
This flag indicates that we are going to use EncryptedValue structure to set all Encrypted Key values. |
static int |
ENVELOPED_DATA
This flag indicates that we are going to use EnvelopedData structure to set all Encrypted Key values. |
Constructor Summary |
|
EncryptedKey(CertJ certJ,
CertPathCtx pathCtx,
com.rsa.jsafe.JSAFE_PublicKey pubKey,
com.rsa.jsafe.JSAFE_PrivateKey privKey)
Creates a EncryptedKey object that contains the values given. |
Method Summary |
|
clone()
Overrides the default |
|
void |
decodeEncryptedKey(byte[] keyBER,
int offset,
int special)
Decode the EncryptedKey structure. |
boolean |
equals(Object obj)
Returns true if this object and obj contain the same EncryptedKey, returns false otherwise. |
int |
getDEREncoding(byte[] encoding,
int offset,
int special)
Places the DER encoding of the EncryptedKey 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 EncryptedKey. |
getEncryptedValue()
Gets the EncryptedValue object. |
|
getEnvelopedData()
Gets the EnvelopedData object, if this object is of
|
|
static int |
getNextBEROffset(byte[] valueBER,
int offset)
Finds the index of the next element to encode, given valueBER, the BER of a EncryptedKey beginning at offset. |
int |
getType()
Gets the type of this EncryptedKey structure |
void |
setEncryptedValue(EncryptedValue value)
Sets the EncryptedValue object, if this object is of
|
void |
setEnvelopedData(EnvelopedData data)
Sets the EnvelopedData object, if this object is of
|
void |
setType(int type)
Sets the type of the EncryptedKey structure |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ENCRYPTED_VALUE
public static final int ENVELOPED_DATA
Constructor Detail |
public EncryptedKey(CertJ certJ, CertPathCtx pathCtx, com.rsa.jsafe.JSAFE_PublicKey pubKey, com.rsa.jsafe.JSAFE_PrivateKey privKey) throws CRMFException
Parameters
certJ | CertJ object that contains environment information | ||
pathCtx | The CertPathCtx object that contains certificate path validation information for EnvelopedData (pass NULL if using EncryptedValue) | ||
pubKey | Public key used to encrypt the Secret key in EncryptedValue structure (pass NULL if decoding, or using EnvelopedData) | ||
privKey | Private key used to decrypt the Secret key in EncryptedValue structure (pass NULL if encoding, or using EnvelopedData) |
Throws
CRMFException
- If specified values are NULLMethod Detail |
public void decodeEncryptedKey(byte[] keyBER, int offset, int special) throws CRMFException
ENCRYPTED_VALUE
type, user needs to
set Recipient's private key 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 invalidpublic void setType(int type) throws CRMFException
Parameters
type | Specifies how we are going to encode Encrypted Key |
Throws
CRMFException
- If specified type is invalidpublic int getType()
Returns
public void setEncryptedValue(EncryptedValue value) throws CRMFException
ENCRYPTED_VALUE
typeParameters
value | The strucure that contains the encrypted Private Key |
Throws
CRMFException
- If there is a cloning error; or if this object
is of ENVELOPED_DATA
type; or if specified object is null.public EncryptedValue getEncryptedValue() throws CRMFException
Returns
ENCRYPTED_VALUE
; if this value is not set, returns null.
Throws
CRMFException
- If if there is a cloning error; or if this object
is of ENVELOPED_DATA
typepublic void setEnvelopedData(EnvelopedData data) throws CRMFException
ENVELOPED_DATA
typeParameters
data | The EnvelopedData strucure that contains the encrypted Private Key |
Throws
CRMFException
- If there is a cloning error; or if this object
is of ENCRYPTED_VALUE
type; if specified object is NULL.public EnvelopedData getEnvelopedData() throws CRMFException
ENVELOPED_DATA
type
Returns
Throws
CRMFException
- If there is a cloning error; or if this object
is of ENCRYPTED_VALUE
typepublic static int getNextBEROffset(byte[] valueBER, int offset) throws CRMFException
Parameters
valueBER | The BER encoding of a EncryptedKey | ||
offset | The offset into valueBER where the encoding begins |
Returns
Throws
CRMFException
- If the method cannot read the BER
encodingpublic int getDERLen(int special) throws CRMFException
Parameters
special | That contains any special ASN.1 info, such as OPTIONAL |
Returns
public int getDEREncoding(byte[] encoding, int offset, int special) throws CRMFException
data [1] IMPLICIT INTEGER |
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
public Object clone() throws CloneNotSupportedException
clone
method
to get a deeper clone.
Returns
Throws
CloneNotSupportedException
- If the cloning operation
is not successful.public boolean equals(Object obj)
Overrides
equals
in class Object
Parameters
obj | The instance of EncryptedKey object |
Returns
boolean
that indicates whether
these objects are equal.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |