|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.rsa.certj.crmf.EncryptedValue
This class contains the EncryptedValue structure used in Archive Options Control, and in Proof Of Possesion of the Key Encipherment Keys.
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 } |
See Also
Constructor Summary |
|
EncryptedValue(CertJ certJ,
com.rsa.jsafe.JSAFE_PublicKey pubKey,
com.rsa.jsafe.JSAFE_PrivateKey privKey)
Creates a EncryptedValue object that contains the values given. |
Method Summary |
|
clone()
Overrides the default |
|
void |
decodeEncryptedValue(byte[] valueBER,
int offset,
int special)
Decode the EncryptedValue structure. |
void |
decryptPrivateKey()
Decrypts the symmetric key using the recipient's private key, and then decrypts the private key using the decrypted symmetric key. |
byte[] |
encryptPrivateKey()
Encrypt the private key using the secret key. |
byte[] |
encryptSecretKey()
Encrypt the secret key with the recipient's public key.Wrap the secret key without using PKCS #8 format |
boolean |
equals(Object obj)
Returns true if this object and obj contain the same EncryptedValue, returns false otherwise. |
byte[] |
getDecryptedValue()
Gets the decrypted value |
int |
getDEREncoding(byte[] encoding,
int offset,
int special)
Places the DER encoding of the EncryptedValue 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 EncryptedValue. |
byte[] |
getEncryptedPrivateKey()
Gets the encrypted private key The encrypted key data is BER-encoded in PKCS #8 format |
byte[] |
getEncryptedSecretKey()
Gets the encrypted symmetric key used to encrypt the private key value The encrypted key data is BER-encoded in PKCS #8 format |
byte[] |
getIntendedAlgorithm()
Gets the intended Algorithm ID for which the value will be used |
byte[] |
getKeyEncryptionAlgorithm()
Gets the Algorithm ID used to encrypt the symmetric key |
static int |
getNextBEROffset(byte[] valueBER,
int offset)
Finds the index of the next element to encode, given valueBER, the BER of a EncryptedValue beginning at offset. |
com.rsa.jsafe.JSAFE_PrivateKey |
getPrivateKey()
Gets the Private Key |
com.rsa.jsafe.JSAFE_SecretKey |
getSecretKey()
Gets the secret key that is used to encrypt the private key |
byte[] |
getValueEncryptionAlgorithm()
Gets the Algorithm ID used to encrypt the Private key value |
byte[] |
getValueHint()
Gets the |
void |
setEncryptedPrivateKey(byte[] encPrivateKey,
int offset,
int len)
Sets the encrypted private key The encrypted key data should be BER-encoded in PKCS #8 format |
void |
setEncryptedSecretKey(byte[] encSecretKey,
int offset,
int len)
Sets the encrypted symmetric key used to encrypt the private key value. |
void |
setIntendedAlgorithm(byte[] oid,
int offset,
int len)
Sets the intended Algorithm ID for which the value will be used |
void |
setKeyEncryptionAlgorithm(byte[] oid,
int offset,
int len)
Sets Asymmetric Algorithm ID used to encrypt the symmetric key |
void |
setPrivateKey(com.rsa.jsafe.JSAFE_PrivateKey privateKey)
Sets the Private key to be encrypted |
void |
setSymmetricKey(com.rsa.jsafe.JSAFE_SecretKey symmKey)
Sets the symmetic key that is used to encrypt private key |
void |
setValueEncryptionAlgorithm(byte[] oid,
int offset,
int len)
Sets Symmetric Algorithm ID used to encrypt the Private Key value |
void |
setValueHint(byte[] hint,
int offset,
int len)
Sets the |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EncryptedValue(CertJ certJ, com.rsa.jsafe.JSAFE_PublicKey pubKey, com.rsa.jsafe.JSAFE_PrivateKey privKey) throws CRMFException
Parameters
certJ | CertJ object that contains environment information and random object | ||
pubKey | Public key used to encrypt the Secret key (pass NULL if decoding) | ||
privKey | Private key used to decrypt the Secret key (pass NULL if encoding) |
Throws
CRMFException
- If specified values are nullMethod Detail |
public void decodeEncryptedValue(byte[] valueBER, int offset, int special) throws CRMFException
decryptPrivateKey
method.Parameters
valueBER | The BER-encoding of EncyptedValue | ||
offset | The offset into | ||
special | That contains any special ASN.1 info, such as OPTIONAL |
Throws
CRMFException
- If the encoding is invalidpublic void decryptPrivateKey() throws CRMFException
decodeEncryptedValue
method.
Throws
CRMFException
- If we cannot decrypt those keys.public void setPrivateKey(com.rsa.jsafe.JSAFE_PrivateKey privateKey) throws CRMFException
Parameters
privateKey | A JSAFE_PrivateKey object |
Throws
CRMFException
- If there is a cloning error,
or if the key is NULLpublic com.rsa.jsafe.JSAFE_PrivateKey getPrivateKey() throws CRMFException
Returns
Throws
CRMFException
- If there is a cloning errorpublic byte[] getDecryptedValue()
Returns
byte
array holding the decrypted
value.public void setSymmetricKey(com.rsa.jsafe.JSAFE_SecretKey symmKey) throws CRMFException
Parameters
symmKey | The secret key |
Throws
CRMFException
- If there is a clonning error; or if
symmKey
is NULLpublic com.rsa.jsafe.JSAFE_SecretKey getSecretKey() throws CRMFException
Returns
Throws
CRMFException
- If there is a clonning error.public void setEncryptedSecretKey(byte[] encSecretKey, int offset, int len) throws CRMFException
Parameters
encSecretKey | The byte array that contains the encrypted secret key | ||
offset | The offset into | ||
len | The length of the |
Throws
CRMFException
- If specified data is nullpublic byte[] getEncryptedSecretKey()
Returns
public void setEncryptedPrivateKey(byte[] encPrivateKey, int offset, int len) throws CRMFException
Parameters
encPrivateKey | The byte array that contains the encrypted private key | ||
offset | The offset into | ||
len | The length of the |
Throws
CRMFException
- If specified data is nullpublic byte[] getEncryptedPrivateKey()
Returns
public void setValueHint(byte[] hint, int offset, int len) throws CRMFException
valueHint
valueParameters
hint | The byte array that contains | ||
offset | The offset into | ||
len | The length of the |
Throws
CRMFException
- If valueHint
is NULLpublic byte[] getValueHint()
valueHint
value
Returns
valueHint
;
returns NULL if valueHint
is not setpublic void setKeyEncryptionAlgorithm(byte[] oid, int offset, int len) throws CRMFException
Parameters
oid | Identifies the algorithm (and any associated parameters) under which the symmetric key is encrypted | ||
offset | Into oid array | ||
len | Length of oid data |
Throws
CRMFException
- If specified OID is nullpublic byte[] getKeyEncryptionAlgorithm()
Returns
public void setValueEncryptionAlgorithm(byte[] oid, int offset, int len) throws CRMFException
Parameters
oid | Identifies the algorithm (and any associated parameters) under which the private key is encrypted | ||
offset | Into oid array | ||
len | Length of oid data |
Throws
CRMFException
- If specified OID is nullpublic byte[] getValueEncryptionAlgorithm()
Returns
public void setIntendedAlgorithm(byte[] oid, int offset, int len) throws CRMFException
Parameters
oid | Identifies the intended algorithm (and any associated parameters) | ||
offset | Into oid array | ||
len | Length of oid data |
Throws
CRMFException
- If specified OID is nullpublic byte[] getIntendedAlgorithm()
Returns
public byte[] encryptPrivateKey() throws CRMFException
Returns
Throws
if
- There is an encryption error;public byte[] encryptSecretKey() throws CRMFException
Returns
Throws
CRMFException
- If there is an encryption error;public static int getNextBEROffset(byte[] valueBER, int offset) throws CRMFException
Parameters
valueBER | The BER encoding of a EncryptedValue | ||
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 EncryptedValue 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 |