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/09/15 13:48:39 UTC

cvs commit: xml-security/c/src/framework XSECEnv.hpp XSECEnv.cpp

blautenb    2003/09/15 04:48:39

  Modified:    c/src/framework XSECEnv.hpp XSECEnv.cpp
  Log:
  Fix bug in retrieiving XENC namespace
  
  Revision  Changes    Path
  1.2       +36 -2     xml-security/c/src/framework/XSECEnv.hpp
  
  Index: XSECEnv.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/framework/XSECEnv.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSECEnv.hpp	12 Sep 2003 09:47:18 -0000	1.1
  +++ XSECEnv.hpp	15 Sep 2003 11:48:39 -0000	1.2
  @@ -174,6 +174,15 @@
   	void setXPFNSPrefix(const XMLCh * prefix);
   
   	/**
  +	 * \brief Set prefix for XENC nodes
  +	 *
  +	 * Set the namespace prefix the library will use when creating
  +	 * nodes in the XENC namespace
  +	 */
  +
  +	void setXENCNSPrefix(const XMLCh * prefix);
  +
  +	/**
   	 * \brief Get the NS Prefix being used for DSIG elements.
   	 *
   	 * @returns A pointer to the buffer holding the prefix
  @@ -201,6 +210,17 @@
   
   	const XMLCh * getXPFNSPrefix() const {return mp_xpfPrefixNS;}
   
  +	/**
  +	 * \brief Get namespace prefix for XENC nodes
  +	 *
  +	 * Find the string being used by the library to prefix nodes in the 
  +	 * xenc: namespace.
  +	 *
  +	 * @returns XENC namespace prefix
  +	 */
  +
  +	const XMLCh * getXENCNSPrefix(void) const {return mp_xencPrefixNS;}
  +
   	//@}
   
   	/** @name General information functions */
  @@ -252,11 +272,24 @@
   	 * @returns A pointer to the URIResolver registered in this signature
   	 */
   
  -	XSECURIResolver * getURIResolver(void);
  +	XSECURIResolver * getURIResolver(void) const;
   
   
   	//@}
   
  +	/** @name Formatters */
  +	//@{
  +
  +	/** 
  +	 * \brief Get a safeBufferFormatter
  +	 *
  +	 * Return a UTF-8 safeBuffer formatter
  +	 *
  +	 * @returns A pointer to a safeBuffer formatter
  +	 */
  +
  +	XSECSafeBufferFormatter * getSBFormatter(void) const {return mp_formatter;}
  +
   
   private:
   
  @@ -269,6 +302,7 @@
   	XMLCh 						* mp_prefixNS;
   	XMLCh						* mp_ecPrefixNS;
   	XMLCh						* mp_xpfPrefixNS;
  +	XMLCh						* mp_xencPrefixNS;
   
   	// Resolvers
   	XSECURIResolver				* mp_URIResolver;
  
  
  
  1.2       +50 -10    xml-security/c/src/framework/XSECEnv.cpp
  
  Index: XSECEnv.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/framework/XSECEnv.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSECEnv.cpp	12 Sep 2003 09:47:18 -0000	1.1
  +++ XSECEnv.cpp	15 Sep 2003 11:48:39 -0000	1.2
  @@ -73,8 +73,40 @@
   #include <xsec/framework/XSECUriResolver.hpp>
   #include <xsec/dsig/DSIGConstants.hpp>
   
  +#include <xercesc/util/XMLUniDefs.hpp>
  +
   XERCES_CPP_NAMESPACE_USE
   
  +// --------------------------------------------------------------------------------
  +//           Default prefix strings
  +// --------------------------------------------------------------------------------
  +
  +const XMLCh s_defaultECPrefix[] = {
  +
  +	chLatin_e,
  +	chLatin_c,
  +	chNull
  +
  +};
  +
  +const XMLCh s_defaultXPFPrefix[] = {
  +
  +	chLatin_x,
  +	chLatin_p,
  +	chLatin_f,
  +	chNull
  +
  +};
  +
  +const XMLCh s_defaultXENCPrefix[] = {
  +
  +	chLatin_x,
  +	chLatin_e,
  +	chLatin_n,
  +	chLatin_c,
  +	chNull
  +
  +};
   
   // --------------------------------------------------------------------------------
   //           Env
  @@ -87,8 +119,10 @@
   	mp_doc = doc;
   
   	mp_prefixNS = XMLString::replicate(DSIGConstants::s_unicodeStrEmpty);
  -	mp_ecPrefixNS = XMLString::replicate(DSIGConstants::s_unicodeStrEmpty);
  -	mp_xpfPrefixNS = XMLString::replicate(DSIGConstants::s_unicodeStrEmpty);
  +	mp_ecPrefixNS = XMLString::replicate(s_defaultECPrefix);
  +	mp_xpfPrefixNS = XMLString::replicate(s_defaultXPFPrefix);
  +	mp_xencPrefixNS = XMLString::replicate(s_defaultXENCPrefix);
  +
   	mp_URIResolver = NULL;
   
   	// Set up our formatter
  @@ -101,29 +135,27 @@
   XSECEnv::~XSECEnv() {
   
   	if (mp_formatter != NULL) {
  -
   		delete mp_formatter;
  -		mp_formatter = NULL;
   	}
   
   	if (mp_prefixNS != NULL) {
   		delete[] mp_prefixNS;
  -		mp_prefixNS = NULL;
   	}
   
   	if (mp_ecPrefixNS != NULL) {
   		delete[] mp_ecPrefixNS;
  -		mp_ecPrefixNS = NULL;
   	}
   	
   	if (mp_xpfPrefixNS != NULL) {
   		delete[] mp_xpfPrefixNS;
  -		mp_xpfPrefixNS = NULL;
  +	}
  +
  +	if (mp_xencPrefixNS != NULL) {
  +		delete[] mp_xencPrefixNS;
   	}
   
   	if (mp_URIResolver != NULL) {
   		delete mp_URIResolver;
  -		mp_URIResolver = NULL;
   	}
   
   }
  @@ -142,7 +174,7 @@
   
   }
   
  -XSECURIResolver * XSECEnv::getURIResolver(void) {
  +XSECURIResolver * XSECEnv::getURIResolver(void) const {
   
   	return mp_URIResolver;
   
  @@ -179,3 +211,11 @@
   
   }
   
  +void XSECEnv::setXENCNSPrefix(const XMLCh * prefix) {
  +
  +	if (mp_xencPrefixNS != NULL)
  +		delete[] mp_xencPrefixNS;
  +
  +	mp_xencPrefixNS = XMLString::replicate(prefix);
  +
  +}