Axl Mattheus wrote:
Vishal,
There are different mechanisms used to encrypt/decrypt clear text/cipher text to wrap/unwrap a key. If one wants to encrypt something, one initializes the XMLCipher (javax.crypto.Cipher) to be in ENCRYPT_MODE in order for it to perform the appropriate functionality. Alternatively if one wants to wrap a key, one will initialize the XMLCipher to WRAP_MODE in order for it to perform the appropriate functionality.
Maybe I'll put my question again in other words --
What's the difference between "wrapping a key" and "encrypting a key" :-\ ?
Key wrapping algorithms are especially designed to provide extra security for encrypting and decrypting keys, as opposed to arbitrary data. See http://www.faqs.org/rfcs/rfc3394.html for example.
--Sean
Thanks, Vishal
Ax/
Vishal Mahajan wrote:
All,
Can someone explain what's the difference between the following two ways of initializing the javax.crypto.Cipher class for encrypting a symmetric key:
1) Cipher.init(WRAP_MODE, RSAPublicKey)
2) Cipher.init(ENCRYPT_MODE, RSAPublicKey)
I observe that XMLCipher.encryptKey() method always initializes the _contextCipher (javax.crypto.Cipher object) in WRAP_MODE.
Thanks in advance, Vishal
