You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2014/06/06 15:59:55 UTC

svn commit: r1600893 - /santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java

Author: coheigea
Date: Fri Jun  6 13:59:54 2014
New Revision: 1600893

URL: http://svn.apache.org/r1600893
Log:
Use cipher.getIV() if not-null

Modified:
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java?rev=1600893&r1=1600892&r2=1600893&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java Fri Jun  6 13:59:54 2014
@@ -1196,8 +1196,12 @@ public class XMLCipher {
             throw new XMLEncryptionException("empty", uee);
         }
 
+        // Get IV from Cipher Object. If this is null (see BouncyCastle issue BJA-473) then use
+        // the original IV that was generated
+        if (c.getIV() != null) {
+            iv = c.getIV();
+        }
         // Now build up to a properly XML Encryption encoded octet stream
-        // IvParameterSpec iv;
         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);
@@ -1211,7 +1215,6 @@ public class XMLCipher {
         try {
             CipherData cd = ed.getCipherData();
             CipherValue cv = cd.getCipherValue();
-            // cv.setValue(base64EncodedEncryptedOctets.getBytes());
             cv.setValue(base64EncodedEncryptedOctets);
 
             if (type != null) {