Hi,

how does xmlsec java library 2.0.2 supports AES/CBC/PKCS5PADDING xml
encryption with predefined AES IV parameter ?

This is simple Java example :

String aesKeyAsHEXString = ...
String aesIvAsHEXString = ...
String secretContent = "my secret content !";

SecretKeySpec skeySpec = new SecretKeySpec(Hex.decode(aesKeyAsHEXString),
"AES");
AlgorithmParameterSpec params = new IvParameterSpec(Hex.decode(
aesIvAsHEXString));

Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
       cipher.init(Cipher.ENCRYPT_MODE, skeySpec, params);

String encryptedContent = Base64.encode(cipher.doFinal(secretContent
.getBytes()));

as you can see Cipher#init method allows do define AlgorithmParameterSpec,
but I did not
found way how to pass AES IV data into *XMLCipher* object.

I understand that AES IV should be propably 'internal random value' however
for purpose of testing would be great if we could encrypt xml with specific
AES + AES IV parameters...

Regards,
Martin V.

Reply via email to