Hi
yes, I didn't use the IV for my test case
----- Original Message -----
From: Vishal Mahajan
To: [email protected]
Sent: Thursday, September 27, 2007 1:55 PM
Subject: Re: About Wrap Key
When using TripleDES the resulting cipher text is prefixed by an
Initialization Vector (IV) which is probably different for the two different
wrap operations. Did you try and unwrap/decrypt the wrapped key in the two
cases and see if that results back in the same key?
Vishal
on 09/26/2007 5:36 PM Rio wrote:
Hi,
I found a problem as follows
Key toBeWrappedKey = Generator("DESede", 168);
Key wrapKey = Generator("DESede", 112);
Cipher cipher = Cipher.getInstance("DESede/CBC/ISO10126Padding");
cipher.init(Cipher.WRAP_MODE, wrapKey);
byte[] wrappedKey = cipher.wrap(toBeWrappedKey);
System.out.println(new String(wrappedKey)); // result 1
XMLCipher xcipher = XMLCipher.getInstance(XMLCipher.TRIPLEDES);
xcipher.init(XMLCipher.WRAP_MODE, wrapKey);
EncryptedKey ek = xcipher.encryptKey(getEncryptedData(),
toBeWrappedKey);
byte[] wrappedKey2 =
Base64.decode(ek.getCipherData().getCipherValue().getValue().getBytes());
System.out.println(new String(wrappedKey2)); // result 2
Why the 2 results are different ?
Thanks