You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by bl...@apache.org on 2003/11/10 23:10:38 UTC

cvs commit: xml-security/c/src/xenc/impl XENCCipherReferenceImpl.cpp XENCCipherReferenceImpl.hpp XENCCipherDataImpl.cpp XENCCipherDataImpl.hpp XENCEncryptedTypeImpl.cpp

blautenb    2003/11/10 14:10:37

  Modified:    c/Projects/VC6.0/xsec/xsec_lib xsec_lib.dsp
               c/src/dsig DSIGConstants.cpp DSIGConstants.hpp
                        DSIGReference.cpp DSIGTransformBase64.cpp
               c/src/framework XSECError.cpp XSECException.hpp
               c/src/tools/xtest xtest.cpp
               c/src/xenc XENCCipher.hpp XENCCipherData.hpp
               c/src/xenc/impl XENCCipherDataImpl.cpp
                        XENCCipherDataImpl.hpp XENCEncryptedTypeImpl.cpp
  Added:       c/src/xenc XENCCipherReference.hpp
               c/src/xenc/impl XENCCipherReferenceImpl.cpp
                        XENCCipherReferenceImpl.hpp
  Log:
  Support for CipherReference elements
  
  Revision  Changes    Path
  1.24      +12 -0     xml-security/c/Projects/VC6.0/xsec/xsec_lib/xsec_lib.dsp
  
  Index: xsec_lib.dsp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/Projects/VC6.0/xsec/xsec_lib/xsec_lib.dsp,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- xsec_lib.dsp	10 Nov 2003 02:49:25 -0000	1.23
  +++ xsec_lib.dsp	10 Nov 2003 22:10:37 -0000	1.24
  @@ -960,6 +960,14 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\..\..\..\src\xenc\impl\XENCCipherReferenceImpl.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xenc\impl\XENCCipherReferenceImpl.hpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\..\..\..\src\xenc\impl\XENCCipherValueImpl.cpp
   # End Source File
   # Begin Source File
  @@ -1006,6 +1014,10 @@
   # Begin Source File
   
   SOURCE=..\..\..\..\src\xenc\XENCCipherData.hpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xenc\XENCCipherReference.hpp
   # End Source File
   # Begin Source File
   
  
  
  
  1.18      +4 -1      xml-security/c/src/dsig/DSIGConstants.cpp
  
  Index: DSIGConstants.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGConstants.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DSIGConstants.cpp	4 Nov 2003 05:22:16 -0000	1.17
  +++ DSIGConstants.cpp	10 Nov 2003 22:10:37 -0000	1.18
  @@ -76,6 +76,7 @@
   const XMLCh * DSIGConstants::s_unicodeStrEmpty;		// ""
   const XMLCh * DSIGConstants::s_unicodeStrNL;			// "\n"
   const XMLCh * DSIGConstants::s_unicodeStrXmlns;		// "xmlns"
  +const XMLCh * DSIGConstants::s_unicodeStrURI;
   
   const XMLCh * DSIGConstants::s_unicodeStrAlgorithm;
   
  @@ -129,6 +130,7 @@
   	s_unicodeStrEmpty = XMLString::transcode("");
   	s_unicodeStrNL = XMLString::transcode("\n");
   	s_unicodeStrXmlns = XMLString::transcode("xmlns");
  +	s_unicodeStrURI = XMLString::transcode("URI");
   
   	s_unicodeStrAlgorithm = XMLString::transcode("Algorithm");
   
  @@ -179,6 +181,7 @@
   	delete[] (XMLCh *) s_unicodeStrEmpty;
   	delete[] (XMLCh *) s_unicodeStrNL;
   	delete[] (XMLCh *) s_unicodeStrXmlns;
  +	delete[] (XMLCh *) s_unicodeStrURI;
   
   	delete[] (XMLCh *) s_unicodeStrAlgorithm;
   
  
  
  
  1.20      +2 -1      xml-security/c/src/dsig/DSIGConstants.hpp
  
  Index: DSIGConstants.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGConstants.hpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DSIGConstants.hpp	4 Nov 2003 05:22:16 -0000	1.19
  +++ DSIGConstants.hpp	10 Nov 2003 22:10:37 -0000	1.20
  @@ -399,6 +399,7 @@
   	static const XMLCh * s_unicodeStrEmpty;		// ""
   	static const XMLCh * s_unicodeStrNL;			// "\n"
   	static const XMLCh * s_unicodeStrXmlns;		// "xmlns"
  +	static const XMLCh * s_unicodeStrURI;		// "URI"
   
   	// DSIG Element Strings
   	static const XMLCh * s_unicodeStrAlgorithm;
  
  
  
  1.17      +3 -2      xml-security/c/src/dsig/DSIGReference.cpp
  
  Index: DSIGReference.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGReference.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DSIGReference.cpp	6 Oct 2003 12:16:37 -0000	1.16
  +++ DSIGReference.cpp	10 Nov 2003 22:10:37 -0000	1.17
  @@ -1016,7 +1016,8 @@
   	// This is defined as a static function, not because it makes use of any static variables
   	// in the DSIGReference class, but to neatly link it to the other users
   
  -	if (transformsNode == 0 || !strEquals(getDSIGLocalName(transformsNode), "Transforms")) {
  +	if (transformsNode == 0 || (!strEquals(getDSIGLocalName(transformsNode), "Transforms") &&
  +		!strEquals(getXENCLocalName(transformsNode), "Transforms"))) {
   
   			throw XSECException(XSECException::ExpectedDSIGChildNotFound, 
   					"Expected <Transforms> in function DSIGReference::processTransforms");
  
  
  
  1.7       +11 -8     xml-security/c/src/dsig/DSIGTransformBase64.cpp
  
  Index: DSIGTransformBase64.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGTransformBase64.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DSIGTransformBase64.cpp	15 Sep 2003 11:57:44 -0000	1.6
  +++ DSIGTransformBase64.cpp	10 Nov 2003 22:10:37 -0000	1.7
  @@ -113,21 +113,24 @@
   
   	if (input->getLastTxfm()->getOutputType() == TXFMBase::DOM_NODES) {
   
  +		if (input->getLastTxfm()->getNodeType() != TXFMBase::DOM_NODE_XPATH_NODESET) {
   
   #ifdef XSEC_NO_XPATH
   
  -		throw XSECException(XSECException::UnsupportedFunction,
  -			"Unable to extract Base64 text from Nodes without XPath support");
  +			throw XSECException(XSECException::UnsupportedFunction,
  +				"Unable to extract Base64 text from Nodes without XPath support");
   
   #else
   		
  -		// Use an XPath transform to get "Self::text()" from the nodeset
  +			// Use an XPath transform to get "Self::text()" from the nodeset
   		
  -		TXFMXPath *x;
  +			TXFMXPath *x;
   		
  -		XSECnew(x, TXFMXPath(mp_txfmNode->getOwnerDocument()));
  -		input->appendTxfm(x);
  -		((TXFMXPath *) x)->evaluateExpr(mp_txfmNode, "self::text()");
  +			XSECnew(x, TXFMXPath(mp_txfmNode->getOwnerDocument()));
  +			input->appendTxfm(x);
  +			((TXFMXPath *) x)->evaluateExpr(mp_txfmNode, "self::text()");
  +
  +		}
   		
   		TXFMC14n *c;
   		
  
  
  
  1.9       +1 -0      xml-security/c/src/framework/XSECError.cpp
  
  Index: XSECError.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/framework/XSECError.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XSECError.cpp	15 Sep 2003 11:49:04 -0000	1.8
  +++ XSECError.cpp	10 Nov 2003 22:10:37 -0000	1.9
  @@ -123,6 +123,7 @@
   	"An error occurred in the XSECCipher processor",
   	"An error occurred in the Algorithm Mapper",
   	"An error occurred processing an EncryptionMethod node",
  +	"An error occurred processing a CipherReference node",
   	"Unknown Error type",
   
   };
  
  
  
  1.11      +3 -2      xml-security/c/src/framework/XSECException.hpp
  
  Index: XSECException.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/framework/XSECException.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XSECException.hpp	15 Sep 2003 11:49:04 -0000	1.10
  +++ XSECException.hpp	10 Nov 2003 22:10:37 -0000	1.11
  @@ -152,7 +152,8 @@
   		CipherError					= 46,
   		AlgorithmMapperError		= 47,
   		EncryptionMethodError		= 48,
  -		UnknownError				= 49		// Must be last!
  +		CipherReferenceError		= 49,
  +		UnknownError				= 50		// Must be last!
   
   	};
   
  
  
  
  1.34      +107 -1    xml-security/c/src/tools/xtest/xtest.cpp
  
  Index: xtest.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/tools/xtest/xtest.cpp,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- xtest.cpp	10 Nov 2003 02:49:04 -0000	1.33
  +++ xtest.cpp	10 Nov 2003 22:10:37 -0000	1.34
  @@ -117,6 +117,7 @@
   #include <xsec/dsig/DSIGSignature.hpp>
   #include <xsec/utils/XSECNameSpaceExpander.hpp>
   #include <xsec/utils/XSECDOMUtils.hpp>
  +#include <xsec/utils/XSECBinTXFMInputStream.hpp>
   #include <xsec/enc/XSECCryptoException.hpp>
   #include <xsec/dsig/DSIGKeyInfoX509.hpp>
   #include <xsec/dsig/DSIGKeyInfoName.hpp>
  @@ -286,6 +287,9 @@
   
   unsigned char s_tstOAEPparams[] = "12345678";
   
  +unsigned char s_tstBase64EncodedString[] = "YmNkZWZnaGlqa2xtbm9wcRrPXjQ1hvhDFT+EdesMAPE4F6vlT+y0HPXe0+nAGLQ8";
  +char s_tstDecryptedString[] = "A test encrypted secret";
  +
   // --------------------------------------------------------------------------------
   //           Some test keys
   // --------------------------------------------------------------------------------
  @@ -837,6 +841,106 @@
   //           Unit tests for test encrypt/Decrypt
   // --------------------------------------------------------------------------------
   
  +void unitTestCipherReference(DOMImplementation * impl) {
  +
  +	DOMDocument *doc = impl->createDocument(
  +				0,                    // root element namespace URI.
  +				MAKE_UNICODE_STRING("ADoc"),            // root element name
  +				NULL);// DOMDocumentType());  // document type object (DTD).
  +
  +	DOMElement *rootElem = doc->getDocumentElement();
  +
  +	// Use key k to wrap a test key, decrypt it and make sure it is still OK
  +	XSECProvider prov;
  +	XENCCipher * cipher;
  +
  +	try {
  +
  +		cipher = prov.newCipher(doc);
  +
  +		cerr << "Creating CipherReference ... ";
  +
  +		XENCEncryptedData * xenc = 
  +			cipher->createEncryptedData(XENCCipherData::REFERENCE_TYPE, DSIGConstants::s_unicodeStrURIAES128_CBC, MAKE_UNICODE_STRING("#CipherText"));
  +
  +		rootElem->appendChild(xenc->getDOMNode());
  +
  +		// Now create the data that is referenced
  +		DOMElement * cipherVal = doc->createElement(MAKE_UNICODE_STRING("MyCipherValue"));
  +		rootElem->appendChild(cipherVal);
  +		cipherVal->setAttribute(MAKE_UNICODE_STRING("Id"), MAKE_UNICODE_STRING("CipherText"));
  +		cipherVal->setIdAttribute(MAKE_UNICODE_STRING("Id"));
  +
  +		cipherVal->appendChild(doc->createTextNode(MAKE_UNICODE_STRING((char *) s_tstBase64EncodedString)));
  +
  +		// Now add the transforms necessary to decrypt
  +		XENCCipherReference *cref = xenc->getCipherData()->getCipherReference();
  +
  +		if (cref == NULL) {
  +			cerr << "Failed - no CipherReference object" << endl;
  +			exit(1);
  +		}
  +
  +		cerr << "done ... appending XPath and Base64 transforms ... ";
  +
  +		//cref->appendXPathTransform("self::text()[parent::rep:CipherValue[@Id="example1"]]");
  +		cref->appendXPathTransform("self::text()[parent::MyCipherValue[@Id=\"CipherText\"]]");
  +		cref->appendBase64Transform();
  +
  +		cerr << "done ... decrypting ... ";
  +
  +		// Create a key
  +		XSECCryptoSymmetricKey * ks =
  +				XSECPlatformUtils::g_cryptoProvider->keySymmetric(XSECCryptoSymmetricKey::KEY_AES_128);
  +		ks->setKey((unsigned char *) s_keyStr, 16);
  +
  +		cipher->setKey(ks);
  +
  +		// Now try to decrypt
  +		DOMNode * n = findXENCNode(doc, "EncryptedData");
  +
  +		XSECBinTXFMInputStream *is = cipher->decryptToBinInputStream((DOMElement *) n);
  +		Janitor<XSECBinTXFMInputStream> j_is(is);
  +
  +		XMLByte buf[1024];
  +
  +		cerr << "done ... comparing to known good ... ";
  +
  +		int bytesRead = is->readBytes(buf, 1024);
  +		buf[bytesRead] = '\0';
  +		if (strcmp((char *) buf, s_tstDecryptedString) == 0) {
  +			cerr << "OK" << endl;
  +		}
  +		else {
  +			cerr << "failed - bad compare of decrypted data" << endl;
  +		}
  +
  +	}
  +
  +	catch (XSECException &e)
  +	{
  +		cerr << "failed\n";
  +		cerr << "An error occured during signature processing\n   Message: ";
  +		char * ce = XMLString::transcode(e.getMsg());
  +		cerr << ce << endl;
  +		delete ce;
  +		exit(1);
  +		
  +	}	
  +	catch (XSECCryptoException &e)
  +	{
  +		cerr << "failed\n";
  +		cerr << "A cryptographic error occured during signature processing\n   Message: "
  +		<< e.getMsg() << endl;
  +		exit(1);
  +	}
  +
  +	outputDoc(impl, doc);
  +	doc->release();
  +
  +}
  +
  +
   void unitTestElementContentEncrypt(DOMImplementation *impl, XSECCryptoKey * key, encryptionMethod em, bool doElementContent) {
   
   	if (doElementContent)
  @@ -1165,6 +1269,8 @@
   		unitTestElementContentEncrypt(impl, ks->clone(), ENCRYPT_3DES_CBC, false);
   		unitTestElementContentEncrypt(impl, ks, ENCRYPT_3DES_CBC, true);
   
  +		cerr << "Unit testing CipherReference creation and decryption" << endl;
  +		unitTestCipherReference(impl);
   
   	}
   	catch (XSECCryptoException &e)
  
  
  
  1.12      +3 -2      xml-security/c/src/xenc/XENCCipher.hpp
  
  Index: XENCCipher.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xenc/XENCCipher.hpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XENCCipher.hpp	10 Nov 2003 02:48:23 -0000	1.11
  +++ XENCCipher.hpp	10 Nov 2003 22:10:37 -0000	1.12
  @@ -466,7 +466,8 @@
   	 * @param type Should this set up a CipherReference or a CipherValue
   	 * @param algorithm URI string to use for the Algorithm attribute in EncryptionMethod.
   	 * Set to NULL for no defined algorithm.
  -	 * @param value String to set the cipher data to if the type is VALUE_TYPE
  +	 * @param value String to set the cipher data to if the type is VALUE_TYPE.
  +	 * for REFERENCE_TYPE CipherData elements, this should be the URI value.
   	 * @returns An XENCEncryptedData object
   	 */
   
  
  
  
  1.4       +10 -1     xml-security/c/src/xenc/XENCCipherData.hpp
  
  Index: XENCCipherData.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xenc/XENCCipherData.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XENCCipherData.hpp	17 Sep 2003 10:10:21 -0000	1.3
  +++ XENCCipherData.hpp	10 Nov 2003 22:10:37 -0000	1.4
  @@ -74,6 +74,7 @@
   #include <xsec/framework/XSECDefs.hpp>
   
   #include <xsec/xenc/XENCCipherValue.hpp>
  +#include <xsec/xenc/XENCCipherReference.hpp>
   
   /**
    * @ingroup xenc
  @@ -144,6 +145,14 @@
   	 */
   
   	virtual XENCCipherValue * getCipherValue(void) = 0;
  +
  +	/**
  +	 * \brief Get the CipherReference element
  +	 *
  +	 * @returns the CipherReference element, or NULL if one is not held
  +	 */
  +
  +	virtual XENCCipherReference * getCipherReference(void) = 0;
   
   	/**
   	 * \brief Get the DOM Node of this structure
  
  
  
  1.1                  xml-security/c/src/xenc/XENCCipherReference.hpp
  
  Index: XENCCipherReference.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "<WebSig>" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 2001, Institute for
   * Data Communications Systems, <http://www.nue.et-inf.uni-siegen.de/>.
   * The development of this software was partly funded by the European 
   * Commission in the <WebSig> project in the ISIS Programme. 
   * For more information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /*
   * XSEC
   *
   * XENCCipherReference := Interface definition for CipherReference element
   *
   * $Id: XENCCipherReference.hpp,v 1.1 2003/11/10 22:10:37 blautenb Exp $
   *
   */
  
  #ifndef XENCCIPHERREFERENCE_INCLUDE
  #define XENCCIPHERREFERENCE_INCLUDE
  
  // XSEC Includes
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/dsig/DSIGConstants.hpp>
  
  class DSIGTransformList;
  class DSIGTransformBase64;
  class DSIGTransformXPath;
  class DSIGTransformXPathFilter;
  class DSIGTransformXSL;
  class DSIGTransformC14n;
  
  XSEC_DECLARE_XERCES_CLASS(DOMNode);
  
  /**
   * @ingroup xenc
   * @{
   */
  
  /**
   * @brief Interface definition for the CipherValue object
   *
   * The \<CipherValue\> element holds the base64 encoded, encrypted data.
   * This is a very simple class that acts purely as a holder of data.
   *
   */
  
  
  class XENCCipherReference {
  
  	/** @name Constructors and Destructors */
  	//@{
  
  protected:
  
  	XENCCipherReference() {};
  
  public:
  
  	virtual ~XENCCipherReference() {};
  
  	/** @name Get Interface Methods */
  	//@{
  
  	/**
  	 * \brief Obtain the transforms for this CipherReference
  	 *
  	 * Get the DSIGTransformList object for this CipherReference.  Can be used to
  	 * obtain information about the transforms and also change the the transforms
  	 */
  
  	virtual DSIGTransformList * getTransforms(void) = 0;
  
  	/**
  	 * \brief Obtain the URI for this CipherReference
  	 *
  	 * @returns A pointer to the URI string for this CipherReference
  	 */
  
  	virtual const XMLCh * getURI (void) = 0;
  	
  	/**
  	 * \brief Get the DOM Node of this structure
  	 *
  	 * @returns the DOM Node representing the <CipherValue> element
  	 */
  
  	virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * getDOMNode(void) = 0;
  
  	//@}
  
  	/** @name Set Interface Methods */
  	//@{
  	
  	/**
  	 * \brief Append a Base64 Transform to the Reference.
  	 *
  	 * @returns The newly created Base64 transform.
  	 * @todo Move to DSIGTransformList rather than re-implement in both DSIGReference
  	 * and XENCCipherReference
  	 */
  
  	virtual DSIGTransformBase64 * appendBase64Transform() = 0;
  	
  	/**
  	 * \brief Append an XPath Transform to the Reference.
  	 *
  	 * <p> Append an XPath transform.  Namespaces can be added to the 
  	 * transform directly using the returned <em>DSIGTransformXPath</em>
  	 * structure</p>
  	 *
  	 * @param expr The XPath expression to be placed in the transform.
  	 * @returns The newly created XPath transform
  	 * @todo Move to DSIGTransformList rather than re-implement in both DSIGReference
  	 * and XENCCipherReference
  	 */
  
  	virtual DSIGTransformXPath * appendXPathTransform(const char * expr) = 0;
  	
  	/**
  	 * \brief Append an XPath-Filter2 Transform to the Reference.
  	 *
  	 * The returned DSIGTransformXPathFilter will have no actual filter
  	 * expressions loaded, but calls can be made to
  	 * DSIGTransformXPathFilter::appendTransform to add them.
  	 *
  	 * @returns The newly created XPath Filter transform
  	 * @todo Move to DSIGTransformList rather than re-implement in both DSIGReference
  	 * and XENCCipherReference
  	 */
  
  	virtual DSIGTransformXPathFilter * appendXPathFilterTransform(void) = 0;
  
  	/**
  	 * \brief Append an XSLT Transform to the Reference.
  	 *
  	 * <p>The caller must have already create the stylesheet and turned it into
  	 * a DOM structure that is passed in as the stylesheet parameter.</p>
  	 *
  	 * @param stylesheet The stylesheet DOM structure to be placed in the reference.
  	 * @returns The newly create XSLT transform
  	 * @todo Move to DSIGTransformList rather than re-implement in both DSIGReference
  	 * and XENCCipherReference
  	 */
  
  	virtual DSIGTransformXSL * appendXSLTransform(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *stylesheet) = 0;
  	
  	/**
  	 * \brief Append a Canonicalization Transform to the Reference.
  	 *
  	 * @param cm The type of canonicalisation to be added.
  	 * @returns The newly create canonicalisation transform
  	 * @todo Move to DSIGTransformList rather than re-implement in both DSIGReference
  	 * and XENCCipherReference
  	 */
  
  	virtual DSIGTransformC14n * appendCanonicalizationTransform(canonicalizationMethod cm) = 0;
  
  	//@}
  
  private:
  
  	// Unimplemented
  	XENCCipherReference(const XENCCipherReference &);
  	XENCCipherReference & operator = (const XENCCipherReference &);
  
  };
  
  #endif /* XENCCIPHERREFERENCE_INCLUDE */
  
  
  
  
  1.8       +30 -4     xml-security/c/src/xenc/impl/XENCCipherDataImpl.cpp
  
  Index: XENCCipherDataImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xenc/impl/XENCCipherDataImpl.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XENCCipherDataImpl.cpp	4 Nov 2003 11:28:36 -0000	1.7
  +++ XENCCipherDataImpl.cpp	10 Nov 2003 22:10:37 -0000	1.8
  @@ -69,6 +69,7 @@
   
   #include "XENCCipherDataImpl.hpp"
   #include "XENCCipherValueImpl.hpp"
  +#include "XENCCipherReferenceImpl.hpp"
   
   #include <xsec/framework/XSECError.hpp>
   #include <xsec/utils/XSECDOMUtils.hpp>
  @@ -140,7 +141,8 @@
   XENCCipherDataImpl::XENCCipherDataImpl(const XSECEnv * env) :
   mp_env(env),
   mp_cipherDataNode(NULL),
  -mp_cipherValue(NULL) {
  +mp_cipherValue(NULL),
  +mp_cipherReference(NULL) {
   
   }
   
  @@ -148,7 +150,8 @@
   XENCCipherDataImpl::XENCCipherDataImpl(const XSECEnv * env, DOMNode * node) :
   mp_env(env),
   mp_cipherDataNode(node),
  -mp_cipherValue(NULL) {
  +mp_cipherValue(NULL),
  +mp_cipherReference(NULL) {
   
   }
   
  @@ -156,6 +159,9 @@
   
   	if (mp_cipherValue != NULL)
   		delete mp_cipherValue;
  +	if (mp_cipherReference != NULL)
  +		delete mp_cipherReference;
  +
   }
   
   // --------------------------------------------------------------------------------
  @@ -194,7 +200,9 @@
   
   	else if (tmpElt != NULL && strEquals(getXENCLocalName(tmpElt), s_CipherReference)) {
   
  -		m_cipherDataType = NO_TYPE;
  +		m_cipherDataType = REFERENCE_TYPE;
  +		XSECnew(mp_cipherReference, XENCCipherReferenceImpl(mp_env, tmpElt));
  +		mp_cipherReference->load();
   
   	}
   
  @@ -251,6 +259,19 @@
   
   	}
   
  +	else if (type == REFERENCE_TYPE) {
  +
  +		m_cipherDataType = REFERENCE_TYPE;
  +
  +		// Create the Cipher Reference
  +		XSECnew(mp_cipherReference, XENCCipherReferenceImpl(mp_env));
  +		DOMNode * cipherReferenceNode = mp_cipherReference->createBlankCipherReference(value);
  +
  +		ret->appendChild(cipherReferenceNode);
  +		mp_env->doPrettyPrint(ret);
  +
  +	}
  +
   	return ret;
   
   }
  @@ -272,4 +293,9 @@
   
   }
   
  +XENCCipherReference * XENCCipherDataImpl::getCipherReference(void) {
  +
  +	return mp_cipherReference;
  +
  +}
   
  
  
  
  1.6       +4 -1      xml-security/c/src/xenc/impl/XENCCipherDataImpl.hpp
  
  Index: XENCCipherDataImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xenc/impl/XENCCipherDataImpl.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XENCCipherDataImpl.hpp	17 Sep 2003 10:10:22 -0000	1.5
  +++ XENCCipherDataImpl.hpp	10 Nov 2003 22:10:37 -0000	1.6
  @@ -77,6 +77,7 @@
   #include "XENCCipherImpl.hpp"
   
   class XENCCipherValueImpl;
  +class XENCCipherReferenceImpl;
   
   XSEC_DECLARE_XERCES_CLASS(DOMNode);
   
  @@ -102,6 +103,7 @@
   	// Interface methods
   	virtual XENCCipherDataType getCipherDataType(void);
   	virtual XENCCipherValue * getCipherValue(void);
  +	virtual XENCCipherReference * getCipherReference(void);
   	virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * getDOMNode(void)
   		{return mp_cipherDataNode;}
   
  @@ -117,6 +119,7 @@
   
   	XENCCipherDataType		m_cipherDataType;			// Is this a value or a reference?
   	XENCCipherValueImpl		* mp_cipherValue;			// Cipher value node
  +	XENCCipherReferenceImpl		* mp_cipherReference;			// Cipher Reference node
   };
   
   #endif /* XENCCIPHERDATAIMPL_INCLUDE */
  
  
  
  1.11      +25 -2     xml-security/c/src/xenc/impl/XENCEncryptedTypeImpl.cpp
  
  Index: XENCEncryptedTypeImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xenc/impl/XENCEncryptedTypeImpl.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XENCEncryptedTypeImpl.cpp	4 Nov 2003 05:22:17 -0000	1.10
  +++ XENCEncryptedTypeImpl.cpp	10 Nov 2003 22:10:37 -0000	1.11
  @@ -81,7 +81,9 @@
   #include <xsec/transformers/TXFMBase64.hpp>
   #include <xsec/transformers/TXFMChain.hpp>
   #include <xsec/transformers/TXFMSB.hpp>
  +#include <xsec/transformers/TXFMC14n.hpp>
   #include <xsec/framework/XSECEnv.hpp>
  +#include <xsec/dsig/DSIGReference.hpp>
   
   #include <xercesc/util/XMLUniDefs.hpp>
   #include <xercesc/util/Janitor.hpp>
  @@ -392,10 +394,31 @@
   
   	}
   
  +	else if (mp_cipherData->getCipherDataType() == XENCCipherData::REFERENCE_TYPE) {
  +
  +		TXFMChain * chain;
  +		TXFMBase * b = DSIGReference::getURIBaseTXFM(mp_env->getParentDocument(), mp_cipherData->getCipherReference()->getURI(), mp_env->getURIResolver());
  +
  +		chain = DSIGReference::createTXFMChainFromList(b, mp_cipherData->getCipherReference()->getTransforms());
  +		Janitor<TXFMChain> j_chain(chain);
  +
  +		if (chain->getLastTxfm()->getOutputType() == TXFMBase::DOM_NODES) {
  +
  +			TXFMC14n * c14n;
  +			XSECnew(c14n, TXFMC14n(mp_env->getParentDocument()));
  +			chain->appendTxfm(c14n);
  +
  +		}
  +
  +		j_chain.release();
  +		return chain;
  +
  +	}
  +
   	else {
   
   		throw XSECException(XSECException::EncryptedTypeError,
  -			"XENCEncryptedType::createDecryptionTXFMChain - cannot process non CipherValue elements");
  +			"XENCEncryptedType::createDecryptionTXFMChain - Unknown type of CipherData");
   
   	}
   
  
  
  
  1.1                  xml-security/c/src/xenc/impl/XENCCipherReferenceImpl.cpp
  
  Index: XENCCipherReferenceImpl.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "<WebSig>" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 2001, Institute for
   * Data Communications Systems, <http://www.nue.et-inf.uni-siegen.de/>.
   * The development of this software was partly funded by the European 
   * Commission in the <WebSig> project in the ISIS Programme. 
   * For more information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /*
   * XSEC
   *
   * XENCCipherReference := Implementation for CipherReference element
   *
   * $Id: XENCCipherReferenceImpl.cpp,v 1.1 2003/11/10 22:10:37 blautenb Exp $
   *
   */
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/dsig/DSIGTransformList.hpp>
  #include <xsec/dsig/DSIGReference.hpp>
  #include <xsec/dsig/DSIGTransformList.hpp>
  #include <xsec/dsig/DSIGTransformBase64.hpp>
  #include <xsec/dsig/DSIGTransformXPath.hpp>
  #include <xsec/dsig/DSIGTransformXPathFilter.hpp>
  #include <xsec/dsig/DSIGTransformXSL.hpp>
  #include <xsec/dsig/DSIGTransformC14n.hpp>
  #include <xsec/framework/XSECError.hpp>
  #include <xsec/utils/XSECDOMUtils.hpp>
  #include <xsec/utils/XSECSafeBufferFormatter.hpp>
  #include <xsec/framework/XSECEnv.hpp>
  
  #include <xercesc/util/XMLUniDefs.hpp>
  #include <xercesc/util/Janitor.hpp>
  
  #include "XENCCipherReferenceImpl.hpp"
  
  XERCES_CPP_NAMESPACE_USE
  
  // --------------------------------------------------------------------------------
  //			String Constants
  // --------------------------------------------------------------------------------
  
  static XMLCh s_CipherReference[] = {
  
  	chLatin_C,
  	chLatin_i,
  	chLatin_p,
  	chLatin_h,
  	chLatin_e,
  	chLatin_r,
  	chLatin_R,
  	chLatin_e,
  	chLatin_f,
  	chLatin_e,
  	chLatin_r,
  	chLatin_e,
  	chLatin_n,
  	chLatin_c,
  	chLatin_e,
  	chNull
  };
  
  static XMLCh s_Transforms[] = {
  
  	chLatin_T,
  	chLatin_r,
  	chLatin_a,
  	chLatin_n,
  	chLatin_s,
  	chLatin_f,
  	chLatin_o,
  	chLatin_r,
  	chLatin_m,
  	chLatin_s,
  	chNull
  };
  
  // --------------------------------------------------------------------------------
  //			Constructors/Destructors
  // --------------------------------------------------------------------------------
  
  XENCCipherReferenceImpl::XENCCipherReferenceImpl(const XSECEnv * env) :
  mp_env(env),
  mp_cipherReferenceNode(NULL),
  mp_uriAttributeNode(NULL),
  mp_transformsNode(NULL),
  mp_transformList(NULL) {
  
  }
  
  XENCCipherReferenceImpl::XENCCipherReferenceImpl(const XSECEnv * env, DOMNode * node) :
  mp_env(env),
  mp_cipherReferenceNode(node),
  mp_uriAttributeNode(NULL),
  mp_transformsNode(NULL),
  mp_transformList(NULL) {
  
  }
  
  
  XENCCipherReferenceImpl::~XENCCipherReferenceImpl() {
  
  	if (mp_transformList != NULL)
  		delete mp_transformList;
  
  }
  
  // --------------------------------------------------------------------------------
  //           Creation of Transforms
  // --------------------------------------------------------------------------------
  
  void XENCCipherReferenceImpl::createTransformList(void) {
  
  	// Creates the transforms list
  	safeBuffer str;
  	const XMLCh * prefix;
  	DOMDocument *doc = mp_env->getParentDocument();
  
  	prefix = mp_env->getXENCNSPrefix();
  	
  	if (mp_transformsNode == NULL) {
  
  		// Need to create a transforms node
  		makeQName(str, prefix, "Transforms");
  		mp_transformsNode = doc->createElementNS(DSIGConstants::s_unicodeStrURIXENC, str.rawXMLChBuffer());
  		mp_env->doPrettyPrint(mp_cipherReferenceNode);
  		mp_cipherReferenceNode->appendChild(mp_transformsNode);
  		mp_env->doPrettyPrint(mp_transformsNode);
  		mp_env->doPrettyPrint(mp_cipherReferenceNode);
  
  		// Create the list
  		XSECnew(mp_transformList, DSIGTransformList());
  	}
  
  }
  
  void XENCCipherReferenceImpl::addTransform(DSIGTransform * txfm, DOMElement * txfmElt) {
  
  	DOMDocument *doc = mp_env->getParentDocument();
  
  	if (mp_transformList == NULL)
  		createTransformList();
  
  	mp_transformsNode->appendChild(txfmElt);
  	mp_env->doPrettyPrint(mp_transformsNode);
  
  	mp_transformList->addTransform(txfm);
  }
  
  
  DSIGTransformBase64 * XENCCipherReferenceImpl::appendBase64Transform() {
  
  	DOMElement *txfmElt;
  	DSIGTransformBase64 * txfm;
  
  	XSECnew(txfm, DSIGTransformBase64(mp_env));
  	txfmElt = txfm->createBlankTransform(mp_env->getParentDocument());
  
  	addTransform(txfm, txfmElt);
  
  	return txfm;
  
  }
  
  DSIGTransformXSL * XENCCipherReferenceImpl::appendXSLTransform(DOMNode * stylesheet) {
  
  	DOMElement *txfmElt;
  	DSIGTransformXSL * txfm;
  
  	XSECnew(txfm, DSIGTransformXSL(mp_env));
  	txfmElt = txfm->createBlankTransform(mp_env->getParentDocument());
  	txfm->setStylesheet(stylesheet);
  
  	addTransform(txfm, txfmElt);
  
  	return txfm;
  
  }
  
  DSIGTransformC14n * XENCCipherReferenceImpl::appendCanonicalizationTransform(canonicalizationMethod cm) {
  
  	DOMElement *txfmElt;
  	DSIGTransformC14n * txfm;
  
  	XSECnew(txfm, DSIGTransformC14n(mp_env));
  	txfmElt = txfm->createBlankTransform(mp_env->getParentDocument());
  	txfm->setCanonicalizationMethod(cm);
  
  	addTransform(txfm, txfmElt);
  
  	return txfm;
  
  }	
  
  DSIGTransformXPath * XENCCipherReferenceImpl::appendXPathTransform(const char * expr) {
  
  	DOMElement *txfmElt;
  	DSIGTransformXPath * txfm;
  
  	XSECnew(txfm, DSIGTransformXPath(mp_env));
  	txfmElt = txfm->createBlankTransform(mp_env->getParentDocument());
  	txfm->setExpression(expr);
  
  	addTransform(txfm, txfmElt);
  
  	return txfm;
  }
  
  DSIGTransformXPathFilter * XENCCipherReferenceImpl::appendXPathFilterTransform(void) {
  
  	DOMElement *txfmElt;
  	DSIGTransformXPathFilter * txfm;
  
  	XSECnew(txfm, DSIGTransformXPathFilter(mp_env));
  	txfmElt = txfm->createBlankTransform(mp_env->getParentDocument());
  
  	addTransform(txfm, txfmElt);
  	mp_env->doPrettyPrint(txfmElt);
  
  	return txfm;
  }
  
  // --------------------------------------------------------------------------------
  //			Load
  // --------------------------------------------------------------------------------
  
  void XENCCipherReferenceImpl::load(void) {
  
  	if (mp_cipherReferenceNode == NULL) {
  
  		// Attempt to load an empty encryptedType element
  		throw XSECException(XSECException::CipherReferenceError,
  			"XENCCipherReference::load - called on empty DOM");
  
  	}
  
  	if (!strEquals(getXENCLocalName(mp_cipherReferenceNode), s_CipherReference)) {
  	
  		throw XSECException(XSECException::CipherReferenceError,
  			"XENCCipherReference::load - called incorrect node");
  	
  	}
  
  	// Find the URI attribute
  	DOMNamedNodeMap * tmpAtts = mp_cipherReferenceNode->getAttributes();
  
  	if (tmpAtts != NULL) {
  
  		mp_uriAttributeNode = tmpAtts->getNamedItem(DSIGConstants::s_unicodeStrURI);
  
  	}
  
  	if (mp_uriAttributeNode == NULL) {
  
  		throw XSECException(XSECException::CipherReferenceError,
  			"XENCCipherReference::load - URI attribute not found");
  	
  	}
  
  	// See if there are any transforms
  	DOMNode * c = findFirstChildOfType(mp_cipherReferenceNode, DOMNode::ELEMENT_NODE);
  	if (c != NULL) {
  
  		if (!strEquals(getXENCLocalName(c), s_Transforms)) {
  
  			throw XSECException(XSECException::CipherReferenceError,
  				"XENCCipherReference::load - Expected Transforms, found something else");
  
  		}
  
  		mp_transformsNode = c;
  
  		XSECSafeBufferFormatter * formatter;
  		XSECnew(formatter, XSECSafeBufferFormatter("UTF-8",XMLFormatter::NoEscapes, 
  												XMLFormatter::UnRep_CharRef));
  		Janitor<XSECSafeBufferFormatter> j_formatter(formatter);
  
  		mp_transformList = DSIGReference::loadTransforms(c, formatter, mp_env);
  
  	}
  
  
  }
  
  // --------------------------------------------------------------------------------
  //			Create a blank structure
  // --------------------------------------------------------------------------------
  
  DOMElement * XENCCipherReferenceImpl::createBlankCipherReference(
  						const XMLCh * URI) {
  
  	// Clean up
  	if (mp_transformList != NULL) {
  		delete mp_transformList;
  		mp_transformList = NULL;
  	}
  
  	mp_uriAttributeNode = NULL;
  
  	// Get some setup values
  	safeBuffer str;
  	DOMDocument *doc = mp_env->getParentDocument();
  	const XMLCh * prefix = mp_env->getXENCNSPrefix();
  
  	makeQName(str, prefix, s_CipherReference);
  
  	DOMElement *ret = doc->createElementNS(DSIGConstants::s_unicodeStrURIXENC, str.rawXMLChBuffer());
  	mp_cipherReferenceNode = ret;
  
  	// Set the URI Attribute
  	ret->setAttributeNS(DSIGConstants::s_unicodeStrURIXENC, DSIGConstants::s_unicodeStrURI, URI);
  
  	// Find the URI
  	DOMNamedNodeMap * tmpAtts = mp_cipherReferenceNode->getAttributes();
  
  	if (tmpAtts != NULL) {
  
  		mp_uriAttributeNode = tmpAtts->getNamedItem(DSIGConstants::s_unicodeStrURI);
  
  	}
  
  	if (mp_uriAttributeNode == NULL) {
  
  		throw XSECException(XSECException::CipherReferenceError,
  			"XENCCipherReference::createBlankReference - URI attribute not found after creation");
  	
  	}
  
  	return ret;
  
  }
  
  // --------------------------------------------------------------------------------
  //			Get Interface methods
  // --------------------------------------------------------------------------------
  
  DSIGTransformList * XENCCipherReferenceImpl::getTransforms(void) {
  
  	return mp_transformList;
  
  }
  
  const XMLCh * XENCCipherReferenceImpl::getURI (void) {
  
  	if (mp_uriAttributeNode != NULL)
  		return mp_uriAttributeNode->getNodeValue();
  
  	return NULL;
  
  }
  
  DOMNode * XENCCipherReferenceImpl::getDOMNode(void) {
  
  	return mp_cipherReferenceNode;
  
  }
  
  
  
  1.1                  xml-security/c/src/xenc/impl/XENCCipherReferenceImpl.hpp
  
  Index: XENCCipherReferenceImpl.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "<WebSig>" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 2001, Institute for
   * Data Communications Systems, <http://www.nue.et-inf.uni-siegen.de/>.
   * The development of this software was partly funded by the European 
   * Commission in the <WebSig> project in the ISIS Programme. 
   * For more information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /*
   * XSEC
   *
   * XENCCipherReference := Implementation for CipherReference element
   *
   * $Id: XENCCipherReferenceImpl.hpp,v 1.1 2003/11/10 22:10:37 blautenb Exp $
   *
   */
  
  #ifndef XENCCIPHERREFERENCEIMPL_INCLUDE
  #define XENCCIPHERREFERENCEIMPL_INCLUDE
  
  // XSEC Includes
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/xenc/XENCCipherReference.hpp>
  
  XSEC_DECLARE_XERCES_CLASS(DOMNode);
  
  class DSIGTransformList;
  class XSECEnv;
  class DSIGTransform;
  
  class XENCCipherReferenceImpl : public XENCCipherReference {
  
  public: 
  
  	XENCCipherReferenceImpl(const XSECEnv * env);
  	XENCCipherReferenceImpl(
  		const XSECEnv * env, 
  		XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * node
  	);
  
  	virtual ~XENCCipherReferenceImpl();
  
  	// Load
  	void load(void);
  	// Create
  	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * 
  		createBlankCipherReference(const XMLCh * URI);
  
  	// Get methods
  	virtual DSIGTransformList * getTransforms(void);
  	virtual const XMLCh * getURI (void);
  	virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * getDOMNode(void);
  
  	// Set methods
  	virtual DSIGTransformBase64 * appendBase64Transform();
  	virtual DSIGTransformXPath * appendXPathTransform(const char * expr);
  	virtual DSIGTransformXPathFilter * appendXPathFilterTransform(void);
  	virtual DSIGTransformXSL * appendXSLTransform(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *stylesheet);
  	virtual DSIGTransformC14n * appendCanonicalizationTransform(canonicalizationMethod cm);
  
  
  private:
  
  	// Unimplemented
  	XENCCipherReferenceImpl(const XENCCipherReference &);
  	XENCCipherReferenceImpl & operator = (const XENCCipherReference &);
  
  	// Private functions
  	void createTransformList(void);
  	void addTransform(DSIGTransform * txfm, 
  		XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * txfmElt);
  
  
  	const XSECEnv			* mp_env;
  	XERCES_CPP_NAMESPACE_QUALIFIER DOMNode					
  							* mp_cipherReferenceNode;
  	XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
  							* mp_uriAttributeNode;
  	XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
  							* mp_transformsNode;
  	DSIGTransformList		* mp_transformList;
  
  
  };
  
  #endif /* XENCCIPHERREFERENCE_INCLUDE */