Bug 46732

Summary: Failed to add more than one child element to EncryptionMethod.
Product: Security - Now in JIRA Reporter: Natallia <maseln>
Component: EncryptionAssignee: XML Security Developers Mailing List <security-dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Natallia 2009-02-19 00:45:54 UTC
According to the w3c EncryptionMethod element schema the number of parameters (child elements) is unbounded. 

http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#sec-EncryptionMethod

While org.apache.xml.security.encryption.XMLCipher.Factory.EncryptionMethodImpl implementation places into Element only ONE parameter from the encryptionMethodInformation List.

org.apache.xml.security.encryption.XMLCipher.Factory.EncryptionMethodImpl {

           private List encryptionMethodInformation = null;
           ...
           Element toElement() {
           ...
               if (!encryptionMethodInformation.isEmpty()) {
                   Iterator itr = encryptionMethodInformation.iterator();
                   result.appendChild((Element) itr.next());
               }

               return (result);
           }
       }
}
Comment 1 sean.mullan 2009-02-19 08:14:59 UTC
Fixed. Normally I add a test case but this fix seemed very low risk. However, if you have a test case, please send it to me and I will incorporate it.