Created
May 4, 2013 21:08
-
-
Save wmene/5518730 to your computer and use it in GitHub Desktop.
Apache Santuario implementation of W3C XML Encryption http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#aes128-cbc.
AES 128 CBC with the iv prepended to the cipher text, then base64 encoded.
From org/apache/xml/security/encryption/XMLCipher.java encryptData method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Now build up to a properly XML Encryption encoded octet stream | |
// IvParameterSpec iv; | |
byte[] iv = c.getIV(); | |
byte[] finalEncryptedBytes = new byte[iv.length + encryptedBytes.length]; | |
System.arraycopy(iv, 0, finalEncryptedBytes, 0, iv.length); | |
System.arraycopy(encryptedBytes, 0, finalEncryptedBytes, iv.length, encryptedBytes.length); | |
String base64EncodedEncryptedOctets = Base64.encode(finalEncryptedBytes); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment