Firstly - with thanks for the patch! The reason KeyInfo still has a TODO is we are using the KeyInfo classes from Signature, which built on the fly, whereas the Encryption classes martial the XML. The plan is to clean all that up over time.
Just on the errors below - I've run your patch through ant test on my system, and all is goodness. So I'd be interested to find out what is failing in the Baltimore tests on your system.
If you run "ant test_xenc" you should get some more output from the two encryption test sets. Also, if you set the printsummary attribute to "withOutAndError" (instead of "on") for the test target in build.xml there might be some interesting output.
Cheers,
BerinVishal Mahajan wrote:
Axl,
I had run the test target before sending the patch. There was no difference in the results with my patch, though there were some tests already failing. Here's their description:
[junit] Running org.apache.xml.security.test.encryption.BaltimoreEncTest
[junit] Tests run: 10, Failures: 0, Errors: 4, Time elapsed: 8.777 sec
[junit] TEST org.apache.xml.security.test.encryption.BaltimoreEncTest FAILED [junit] Running org.apache.xml.security.test.encryption.XMLCipherTester
[junit] Tests run: 9, Failures: 4, Errors: 0, Time elapsed: 30.753 sec
[junit] TEST org.apache.xml.security.test.encryption.XMLCipherTester FAILED
- Vishal
Axl Mattheus wrote:
Vishal,
I have applied your patch. Just one thing that is a worry (just a gut feel for moving classes to interfaces). Can you please check to make sure that the patch does not break any of the tests?
Ax/
Vishal Mahajan wrote:
Correction, I sent out Reference.java instead of ReferenceList.java :-P (Please find it attached now).
- Vishal
Vishal Mahajan wrote:
All,
I observed that there were some TODO items in XMLCipher.java. Some of them were related to martialing of KeyInfo and ReferenceList. I have prepared (please find attached) a patch for these. The KeyInfo martialing I thought was already achieved (KeyInfo.getElement()), and for ReferenceList I did the following --
1) Converted ReferenceList class into an interface.
2) Added implementation for it (containing a toElement() method) inside the private Factory class.
This change results in a uniformity across the implementation. ReferenceList is now being handled like other encryption elements. Please let me know if there are any issues with this patch.
Regards, Vishal
------------------------------------------------------------------------
------------------------------------------------------------------------
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.xml.security.encryption;
import java.util.Iterator;
/**
* <code>ReferenceList</code> is an element that contains pointers from a key
* value of an <code>EncryptedKey</code> to items encrypted by that key value
* (<code>EncryptedData</code> or <code>EncryptedKey</code> elements).
* <p>
* It is defined as follows:
* <xmp>
* <element name='ReferenceList'>
* <complexType>
* <choice minOccurs='1' maxOccurs='unbounded'>
* <element name='DataReference' type='xenc:ReferenceType'/>
* <element name='KeyReference' type='xenc:ReferenceType'/>
* </choice>
* </complexType>
* </element>
* </xmp>
*
* @author Axl Mattheus
* @see Reference.
*/
public interface ReferenceList {
public static final int DATA_REFERENCE = 0x00000001;
public static final int KEY_REFERENCE = 0x00000002;
/**
* Adds a reference to this reference list.
*
* @param reference the reference to add.
* @throws IllegalArgurmentException if the <code>Reference</code> is not an
* instance of <code>DataReference</code> or <code>KeyReference</code>.
*/
public void add(Reference reference);
/** * Removes a reference from the <code>ReferenceList</code>. * * @param reference the reference to remove. */ public void remove(Reference reference);
/** * Returns the size of the <code>ReferenceList</code>. * * @return the size of the <code>ReferenceList</code>. */ public int size();
/**
* Indicates if the <code>ReferenceList</code> is empty.
*
* @return <code><b>true</b></code> if the <code>ReferenceList</code> is
* empty, else <code><b>false</b></code>.
*/
public boolean isEmpty();
/**
* Returns an <code>Iterator</code> over all the <code>Reference</code>s
* contatined in this <code>ReferenceList</code>.
*
* @return Iterator.
*/
public Iterator getReferences();
/** * <code>DataReference</code> factory method. Returns a * <code>DataReference</code>. */ public Reference newDataReference(String uri);
/**
* <code>KeyReference</code> factory method. Returns a
* <code>KeyReference</code>.
*/
public Reference newKeyReference(String uri);
}
