blautenb 2003/09/12 02:47:18
Modified: c/Projects/VC6.0/xsec/xsec_lib xsec_lib.dsp
c/src/dsig DSIGKeyInfo.hpp DSIGKeyInfoList.cpp
DSIGKeyInfoList.hpp DSIGKeyInfoMgmtData.cpp
DSIGKeyInfoMgmtData.hpp DSIGKeyInfoName.cpp
DSIGKeyInfoName.hpp DSIGKeyInfoPGPData.cpp
DSIGKeyInfoPGPData.hpp DSIGKeyInfoSPKIData.cpp
DSIGKeyInfoSPKIData.hpp DSIGKeyInfoValue.cpp
DSIGKeyInfoValue.hpp DSIGKeyInfoX509.cpp
DSIGKeyInfoX509.hpp DSIGSignature.cpp
DSIGSignature.hpp
c/src/framework XSECProvider.hpp
Added: c/src/framework XSECEnv.cpp XSECEnv.hpp
Log:
Abstracted signature environment into a holder class and implemented into
KeyInfo classes to allow use within XML Encryption classes
Revision Changes Path
1.19 +8 -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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- xsec_lib.dsp 11 Sep 2003 11:15:44 -0000 1.18
+++ xsec_lib.dsp 12 Sep 2003 09:47:17 -0000 1.19
@@ -713,6 +713,10 @@
# End Source File
# Begin Source File
+SOURCE=..\..\..\..\src\framework\XSECEnv.hpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\src\framework\XSECError.cpp
# End Source File
# Begin Source File
@@ -964,5 +968,9 @@
SOURCE=..\..\..\..\src\xenc\XENCEncryptionMethod.hpp
# End Source File
# End Group
+# Begin Source File
+
+SOURCE=..\..\..\..\src\framework\XSECEnv.cpp
+# End Source File
# End Target
# End Project
1.8 +6 -5 xml-security/c/src/dsig/DSIGKeyInfo.hpp
Index: DSIGKeyInfo.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfo.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DSIGKeyInfo.hpp 11 Sep 2003 11:13:35 -0000 1.7
+++ DSIGKeyInfo.hpp 12 Sep 2003 09:47:17 -0000 1.8
@@ -80,6 +80,7 @@
#include <xercesc/dom/DOM.hpp>
class DSIGSignature;
+class XSECEnv;
/**
* @ingroup pubsig
@@ -134,12 +135,12 @@
/**
* \brief Construct from an owning signature
*
- * All KeyInfo types take a constructor that names the owning signature.
+ * All KeyInfo types take a constructor that provides the controlling
environment.
*
- * @param sig The signature that owns this element
+ * @param env The environment that the KeyInfo is operating within
*/
- DSIGKeyInfo(DSIGSignature * sig) {mp_keyInfoDOMNode = NULL;
mp_parentSignature = sig;}
+ DSIGKeyInfo(const XSECEnv * env) {mp_keyInfoDOMNode = NULL; mp_env =
env;}
/**
* \brief The Destructor
@@ -197,7 +198,7 @@
protected:
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *
mp_keyInfoDOMNode;
- DSIGSignature
* mp_parentSignature;
+ const XSECEnv
* mp_env;
private:
DSIGKeyInfo();
1.10 +9 -9 xml-security/c/src/dsig/DSIGKeyInfoList.cpp
Index: DSIGKeyInfoList.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoList.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DSIGKeyInfoList.cpp 11 Sep 2003 11:13:35 -0000 1.9
+++ DSIGKeyInfoList.cpp 12 Sep 2003 09:47:17 -0000 1.10
@@ -82,8 +82,8 @@
XERCES_CPP_NAMESPACE_USE
-DSIGKeyInfoList::DSIGKeyInfoList(DSIGSignature * sig) :
-mp_parentSignature(sig) {}
+DSIGKeyInfoList::DSIGKeyInfoList(const XSECEnv * env) :
+mp_env(env) {}
DSIGKeyInfoList::~DSIGKeyInfoList() {
@@ -159,33 +159,33 @@
if (strEquals(getDSIGLocalName(ki), "X509Data")) {
// Have a certificate!
- XSECnew(k, DSIGKeyInfoX509(mp_parentSignature, ki));
+ XSECnew(k, DSIGKeyInfoX509(mp_env, ki));
}
else if (strEquals(getDSIGLocalName(ki), "KeyName")) {
- XSECnew(k, DSIGKeyInfoName(mp_parentSignature, ki));
+ XSECnew(k, DSIGKeyInfoName(mp_env, ki));
}
else if (strEquals(getDSIGLocalName(ki), "KeyValue")) {
- XSECnew(k, DSIGKeyInfoValue(mp_parentSignature, ki));
+ XSECnew(k, DSIGKeyInfoValue(mp_env, ki));
}
else if (strEquals(getDSIGLocalName(ki), "PGPData")) {
- XSECnew(k, DSIGKeyInfoPGPData(mp_parentSignature, ki));
+ XSECnew(k, DSIGKeyInfoPGPData(mp_env, ki));
}
else if (strEquals(getDSIGLocalName(ki), "SPKIData")) {
- XSECnew(k, DSIGKeyInfoSPKIData(mp_parentSignature, ki));
+ XSECnew(k, DSIGKeyInfoSPKIData(mp_env, ki));
}
else if (strEquals(getDSIGLocalName(ki), "MgmtData")) {
- XSECnew(k, DSIGKeyInfoMgmtData(mp_parentSignature, ki));
+ XSECnew(k, DSIGKeyInfoMgmtData(mp_env, ki));
}
1.5 +9 -9 xml-security/c/src/dsig/DSIGKeyInfoList.hpp
Index: DSIGKeyInfoList.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoList.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DSIGKeyInfoList.hpp 11 Sep 2003 11:13:35 -0000 1.4
+++ DSIGKeyInfoList.hpp 12 Sep 2003 09:47:17 -0000 1.5
@@ -119,12 +119,12 @@
*
* Main constructor called by DSIGSignature
*
- * @note Should only ever be created by a Signature class.
+ * @note Should only ever be created by a Signature or Cipher class.
*
- * @param sig The owning signature
+ * @param env The environment the KeyInfo is operating within
*/
- DSIGKeyInfoList(DSIGSignature * sig);
+ DSIGKeyInfoList(const XSECEnv * env);
/**
* \brief Destructor
@@ -200,14 +200,14 @@
DSIGKeyInfo * removeKeyInfo(size_type index);
/**
- * \brief Set the owning signature
+ * \brief Set the overarching environment
*
- * Sets the signature owner of this element
+ * Sets the environment this list is operating within
*
- * @param sig The owner signature
+ * @param env Operating environment
*/
- void setParentSignature(DSIGSignature * sig) {mp_parentSignature = sig;}
+ void setEnvironment(const XSECEnv * env) {mp_env = env;}
/**
* \brief Clear out the list
@@ -234,7 +234,7 @@
DSIGKeyInfoList();
KeyInfoListVectorType m_keyInfoList;
- DSIGSignature *
mp_parentSignature;
+ const XSECEnv *
mp_env;
// KeyInfoListVectorType::iterator m_iterator;
};
1.4 +8 -7 xml-security/c/src/dsig/DSIGKeyInfoMgmtData.cpp
Index: DSIGKeyInfoMgmtData.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoMgmtData.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DSIGKeyInfoMgmtData.cpp 11 Sep 2003 11:13:35 -0000 1.3
+++ DSIGKeyInfoMgmtData.cpp 12 Sep 2003 09:47:17 -0000 1.4
@@ -72,6 +72,7 @@
#include <xsec/framework/XSECError.hpp>
#include <xsec/utils/XSECDOMUtils.hpp>
#include <xsec/dsig/DSIGSignature.hpp>
+#include <xsec/framework/XSECEnv.hpp>
#include <xercesc/util/Janitor.hpp>
@@ -82,8 +83,8 @@
//
--------------------------------------------------------------------------------
-DSIGKeyInfoMgmtData::DSIGKeyInfoMgmtData(DSIGSignature *sig, DOMNode
*nameNode) :
-DSIGKeyInfo(sig),
+DSIGKeyInfoMgmtData::DSIGKeyInfoMgmtData(const XSECEnv * env, DOMNode
*nameNode) :
+DSIGKeyInfo(env),
mp_data(NULL),
mp_dataTextNode(0) {
@@ -92,8 +93,8 @@
}
-DSIGKeyInfoMgmtData::DSIGKeyInfoMgmtData(DSIGSignature *sig) :
-DSIGKeyInfo(sig),
+DSIGKeyInfoMgmtData::DSIGKeyInfoMgmtData(const XSECEnv * env) :
+DSIGKeyInfo(env),
mp_data(NULL),
mp_dataTextNode(0) {
@@ -161,8 +162,8 @@
// Create the DOM Structure
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "MgmtData");
1.5 +7 -7 xml-security/c/src/dsig/DSIGKeyInfoMgmtData.hpp
Index: DSIGKeyInfoMgmtData.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoMgmtData.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DSIGKeyInfoMgmtData.hpp 11 Sep 2003 11:13:35 -0000 1.4
+++ DSIGKeyInfoMgmtData.hpp 12 Sep 2003 09:47:17 -0000 1.5
@@ -102,26 +102,26 @@
/**
* \brief Constructor used when XML exists.
*
- * This constructor is used by DSIGSignature objects to load
+ * This constructor is used by other user interface classes to load
* an existing DOM structure into the Name element.
*
- * @param sig Calling signature object.
+ * @param env Environment operating within.
* @param nameNode DOMNode to load information from
*/
- DSIGKeyInfoMgmtData(DSIGSignature * sig, XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode *nameNode);
+ DSIGKeyInfoMgmtData(const XSECEnv * env, XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode *nameNode);
/**
* \brief Constructor used when XML needs to be created.
*
- * This constructor is used by DSIGSignature objects to
+ * This constructor is used by interface objects to
* create a DSIGKeyInfoName object that can then be used
* to create the required XML.
*
- * @param sig Calling signature object.
+ * @param env Operating environment
*/
- DSIGKeyInfoMgmtData(DSIGSignature * sig);
+ DSIGKeyInfoMgmtData(const XSECEnv * env);
/**
* \brief Destructor
1.6 +8 -7 xml-security/c/src/dsig/DSIGKeyInfoName.cpp
Index: DSIGKeyInfoName.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoName.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DSIGKeyInfoName.cpp 11 Sep 2003 11:13:35 -0000 1.5
+++ DSIGKeyInfoName.cpp 12 Sep 2003 09:47:17 -0000 1.6
@@ -73,6 +73,7 @@
#include <xsec/utils/XSECPlatformUtils.hpp>
#include <xsec/utils/XSECDOMUtils.hpp>
#include <xsec/dsig/DSIGSignature.hpp>
+#include <xsec/framework/XSECEnv.hpp>
#include <xercesc/util/Janitor.hpp>
@@ -83,8 +84,8 @@
//
--------------------------------------------------------------------------------
-DSIGKeyInfoName::DSIGKeyInfoName(DSIGSignature *sig, DOMNode *nameNode) :
-DSIGKeyInfo(sig),
+DSIGKeyInfoName::DSIGKeyInfoName(const XSECEnv * env, DOMNode *nameNode) :
+DSIGKeyInfo(env),
mp_name(NULL),
mp_decodedDName(NULL),
mp_keyNameTextNode(0) {
@@ -94,8 +95,8 @@
}
-DSIGKeyInfoName::DSIGKeyInfoName(DSIGSignature *sig) :
-DSIGKeyInfo(sig),
+DSIGKeyInfoName::DSIGKeyInfoName(const XSECEnv * env) :
+DSIGKeyInfo(env),
mp_name(NULL),
mp_decodedDName(NULL),
mp_keyNameTextNode(0) {
@@ -179,8 +180,8 @@
// Create the DOM Structure
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "KeyName");
1.7 +7 -7 xml-security/c/src/dsig/DSIGKeyInfoName.hpp
Index: DSIGKeyInfoName.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoName.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DSIGKeyInfoName.hpp 11 Sep 2003 11:13:35 -0000 1.6
+++ DSIGKeyInfoName.hpp 12 Sep 2003 09:47:17 -0000 1.7
@@ -101,26 +101,26 @@
/**
* \brief Constructor used when XML exists.
*
- * This constructor is used by DSIGSignature objects to load
+ * This constructor is used by interface classes
* an existing DOM structure into the Name element.
*
- * @param sig Calling signature object.
+ * @param env Environment the KeyInfo is operating within
* @param nameNode DOMNode to load information from
*/
- DSIGKeyInfoName(DSIGSignature * sig, XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode *nameNode);
+ DSIGKeyInfoName(const XSECEnv * env, XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode *nameNode);
/**
* \brief Constructor used when XML needs to be created.
*
- * This constructor is used by DSIGSignature objects to
+ * This constructor is used by interface objects to
* create a DSIGKeyInfoName object that can then be used
* to create the required XML.
*
- * @param sig Calling signature object.
+ * @param env Operating environment
*/
- DSIGKeyInfoName(DSIGSignature * sig);
+ DSIGKeyInfoName(const XSECEnv * env);
/**
* \brief Destructor
1.4 +12 -11 xml-security/c/src/dsig/DSIGKeyInfoPGPData.cpp
Index: DSIGKeyInfoPGPData.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoPGPData.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DSIGKeyInfoPGPData.cpp 11 Sep 2003 11:13:36 -0000 1.3
+++ DSIGKeyInfoPGPData.cpp 12 Sep 2003 09:47:17 -0000 1.4
@@ -73,6 +73,7 @@
#include <xsec/utils/XSECPlatformUtils.hpp>
#include <xsec/utils/XSECDOMUtils.hpp>
#include <xsec/dsig/DSIGSignature.hpp>
+#include <xsec/framework/XSECEnv.hpp>
#include <xercesc/util/Janitor.hpp>
@@ -83,8 +84,8 @@
//
--------------------------------------------------------------------------------
-DSIGKeyInfoPGPData::DSIGKeyInfoPGPData(DSIGSignature *sig, DOMNode
*pgpDataNode) :
-DSIGKeyInfo(sig),
+DSIGKeyInfoPGPData::DSIGKeyInfoPGPData(const XSECEnv * env, DOMNode
*pgpDataNode) :
+DSIGKeyInfo(env),
mp_keyID(NULL),
mp_keyPacket(NULL),
mp_keyIDTextNode(NULL),
@@ -95,8 +96,8 @@
}
-DSIGKeyInfoPGPData::DSIGKeyInfoPGPData(DSIGSignature *sig) :
-DSIGKeyInfo(sig),
+DSIGKeyInfoPGPData::DSIGKeyInfoPGPData(const XSECEnv * env) :
+DSIGKeyInfo(env),
mp_keyID(NULL),
mp_keyPacket(NULL),
mp_keyIDTextNode(NULL),
@@ -202,8 +203,8 @@
// Create the DOM Structure
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "PGPData");
@@ -251,8 +252,8 @@
// Need to create
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "PGPKeyID");
DOMElement * t =
doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG, str.rawXMLChBuffer());
@@ -290,8 +291,8 @@
// Need to create
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "PGPKeyPacket");
DOMElement * t =
doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG, str.rawXMLChBuffer());
1.5 +7 -7 xml-security/c/src/dsig/DSIGKeyInfoPGPData.hpp
Index: DSIGKeyInfoPGPData.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoPGPData.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DSIGKeyInfoPGPData.hpp 11 Sep 2003 11:13:36 -0000 1.4
+++ DSIGKeyInfoPGPData.hpp 12 Sep 2003 09:47:17 -0000 1.5
@@ -102,27 +102,27 @@
/**
* \brief Constructor used when XML exists.
*
- * This constructor is used by DSIGSignature objects to load
+ * This constructor is used by interface objects to load
* an existing DOM structure into the PGPData element.
*
- * @param sig Calling signature object.
+ * @param env Environment the KeyInfo is operating within
* @param pgpDataNode DOMNode to load information from
*/
- DSIGKeyInfoPGPData(DSIGSignature * sig,
+ DSIGKeyInfoPGPData(const XSECEnv * env,
XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode *pgpDataNode);
/**
* \brief Constructor used when XML needs to be created.
*
- * This constructor is used by DSIGSignature objects to
+ * This constructor is used by interface objects to
* create a DSIGKeyInfoPGPData object that can then be used
* to create the required XML.
*
- * @param sig Calling signature object.
+ * @param env Operating environment
*/
- DSIGKeyInfoPGPData(DSIGSignature * sig);
+ DSIGKeyInfoPGPData(const XSECEnv * env);
/**
* \brief Destructor
1.5 +10 -9 xml-security/c/src/dsig/DSIGKeyInfoSPKIData.cpp
Index: DSIGKeyInfoSPKIData.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoSPKIData.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DSIGKeyInfoSPKIData.cpp 11 Sep 2003 11:13:36 -0000 1.4
+++ DSIGKeyInfoSPKIData.cpp 12 Sep 2003 09:47:17 -0000 1.5
@@ -71,6 +71,7 @@
#include <xsec/dsig/DSIGKeyInfoSPKIData.hpp>
#include <xsec/framework/XSECError.hpp>
#include <xsec/dsig/DSIGSignature.hpp>
+#include <xsec/framework/XSECEnv.hpp>
#include <xercesc/dom/DOM.hpp>
@@ -80,15 +81,15 @@
// Constructors and Destructors
//
--------------------------------------------------------------------------------
-DSIGKeyInfoSPKIData::DSIGKeyInfoSPKIData(DSIGSignature * sig, DOMNode
*nameNode) :
-DSIGKeyInfo(sig) {
+DSIGKeyInfoSPKIData::DSIGKeyInfoSPKIData(const XSECEnv * env, DOMNode
*nameNode) :
+DSIGKeyInfo(env) {
mp_keyInfoDOMNode = nameNode;
}
-DSIGKeyInfoSPKIData::DSIGKeyInfoSPKIData(DSIGSignature * sig) :
-DSIGKeyInfo(sig) {
+DSIGKeyInfoSPKIData::DSIGKeyInfoSPKIData(const XSECEnv * env) :
+DSIGKeyInfo(env) {
mp_keyInfoDOMNode = NULL;
@@ -196,8 +197,8 @@
// Create the DOM Structure
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "SPKIData");
@@ -220,8 +221,8 @@
m_sexpList.push_back(s);
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "SPKISexp");
1.6 +7 -7 xml-security/c/src/dsig/DSIGKeyInfoSPKIData.hpp
Index: DSIGKeyInfoSPKIData.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoSPKIData.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DSIGKeyInfoSPKIData.hpp 11 Sep 2003 11:13:36 -0000 1.5
+++ DSIGKeyInfoSPKIData.hpp 12 Sep 2003 09:47:17 -0000 1.6
@@ -103,27 +103,27 @@
/**
* \brief Constructor used when XML exists.
*
- * This constructor is used by DSIGSignature objects to load
+ * This constructor is used by interface objects to load
* an existing DOM structure into the Name element.
*
- * @param sig Calling signature object.
+ * @param env Environment KeyInfo is operating in
* @param nameNode DOMNode to load information from
*/
- DSIGKeyInfoSPKIData(DSIGSignature * sig,
+ DSIGKeyInfoSPKIData(const XSECEnv * env,
XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode *nameNode);
/**
* \brief Constructor used when XML needs to be created.
*
- * This constructor is used by DSIGSignature objects to
+ * This constructor is used by interface objects to
* create a DSIGKeyInfoSPKIData object that can then be used
* to create the required XML.
*
- * @param sig Calling signature object.
+ * @param env Operating environment
*/
- DSIGKeyInfoSPKIData(DSIGSignature * sig);
+ DSIGKeyInfoSPKIData(const XSECEnv * env);
/**
* \brief Destructor
1.5 +10 -9 xml-security/c/src/dsig/DSIGKeyInfoValue.cpp
Index: DSIGKeyInfoValue.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoValue.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DSIGKeyInfoValue.cpp 11 Sep 2003 11:13:36 -0000 1.4
+++ DSIGKeyInfoValue.cpp 12 Sep 2003 09:47:17 -0000 1.5
@@ -71,11 +71,12 @@
#include <xsec/utils/XSECDOMUtils.hpp>
#include <xsec/framework/XSECException.hpp>
#include <xsec/dsig/DSIGSignature.hpp>
+#include <xsec/framework/XSECEnv.hpp>
XERCES_CPP_NAMESPACE_USE
-DSIGKeyInfoValue::DSIGKeyInfoValue(DSIGSignature * sig, DOMNode *valueNode) :
-DSIGKeyInfo(sig),
+DSIGKeyInfoValue::DSIGKeyInfoValue(const XSECEnv * env, DOMNode *valueNode) :
+DSIGKeyInfo(env),
mp_PTextNode(0),
mp_QTextNode(0),
mp_GTextNode(0),
@@ -87,8 +88,8 @@
}
-DSIGKeyInfoValue::DSIGKeyInfoValue(DSIGSignature * sig) :
-DSIGKeyInfo(sig),
+DSIGKeyInfoValue::DSIGKeyInfoValue(const XSECEnv * env) :
+DSIGKeyInfo(env),
mp_PTextNode(0),
mp_QTextNode(0),
mp_GTextNode(0),
@@ -279,8 +280,8 @@
// Create the DOM Structure
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "KeyValue");
@@ -394,8 +395,8 @@
// Create the DOM Structure
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "KeyValue");
1.8 +6 -6 xml-security/c/src/dsig/DSIGKeyInfoValue.hpp
Index: DSIGKeyInfoValue.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoValue.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DSIGKeyInfoValue.hpp 11 Sep 2003 11:13:36 -0000 1.7
+++ DSIGKeyInfoValue.hpp 12 Sep 2003 09:47:17 -0000 1.8
@@ -111,17 +111,17 @@
//@{
/**
- * \brief Constructor for an existing signature *
+ * \brief Constructor for an existing KeyInfo *
*
* Constructor used when loading a KeyValue node that already exists
* in an XML document.
*
- * @param sig Owning signature
+ * @param env Operating environment
* @param valueNode DOMNode at head of XML structure
*/
DSIGKeyInfoValue(
- DSIGSignature * sig,
+ const XSECEnv * env,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *valueNode
);
@@ -131,10 +131,10 @@
* Constructor used when creating a new KeyValue node to append
* to a signature structure.
*
- * @param sig Owning signature
+ * @param env Operating environment
*/
- DSIGKeyInfoValue(DSIGSignature * sig);
+ DSIGKeyInfoValue(const XSECEnv * env);
virtual ~DSIGKeyInfoValue();
1.9 +18 -17 xml-security/c/src/dsig/DSIGKeyInfoX509.cpp
Index: DSIGKeyInfoX509.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoX509.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DSIGKeyInfoX509.cpp 11 Sep 2003 11:13:36 -0000 1.8
+++ DSIGKeyInfoX509.cpp 12 Sep 2003 09:47:17 -0000 1.9
@@ -72,6 +72,7 @@
#include <xsec/utils/XSECPlatformUtils.hpp>
#include <xsec/utils/XSECDOMUtils.hpp>
#include <xsec/dsig/DSIGSignature.hpp>
+#include <xsec/framework/XSECEnv.hpp>
#include <xercesc/util/Janitor.hpp>
@@ -82,8 +83,8 @@
//
--------------------------------------------------------------------------------
-DSIGKeyInfoX509::DSIGKeyInfoX509(DSIGSignature * sig, DOMNode *X509Data) :
-DSIGKeyInfo(sig),
+DSIGKeyInfoX509::DSIGKeyInfoX509(const XSECEnv * env, DOMNode *X509Data) :
+DSIGKeyInfo(env),
mp_X509IssuerName(NULL),
mp_X509SerialNumber(NULL),
mp_X509SubjectName(NULL),
@@ -101,8 +102,8 @@
}
-DSIGKeyInfoX509::DSIGKeyInfoX509(DSIGSignature * sig) :
-DSIGKeyInfo(sig),
+DSIGKeyInfoX509::DSIGKeyInfoX509(const XSECEnv * env) :
+DSIGKeyInfo(env),
mp_X509IssuerName(NULL),
mp_X509SerialNumber(NULL),
mp_X509SubjectName(NULL),
@@ -383,8 +384,8 @@
// Create the DOM Structure
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "X509Data");
@@ -401,8 +402,8 @@
if (mp_X509CRLTextNode == 0) {
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "X509CRL");
@@ -431,8 +432,8 @@
if (mp_X509SKITextNode == 0) {
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "X509SKI");
@@ -471,8 +472,8 @@
// Does not yet exist in the DOM
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "X509SubjectName");
@@ -508,8 +509,8 @@
// Does not yet exist in the DOM
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "X509IssuerSerial");
@@ -565,8 +566,8 @@
void DSIGKeyInfoX509::appendX509Certificate(const XMLCh * base64Certificate)
{
safeBuffer str;
- DOMDocument *doc = mp_parentSignature->getParentDocument();
- const XMLCh * prefix = mp_parentSignature->getDSIGNSPrefix();
+ DOMDocument *doc = mp_env->getParentDocument();
+ const XMLCh * prefix = mp_env->getDSIGNSPrefix();
makeQName(str, prefix, "X509Certificate");
1.8 +8 -8 xml-security/c/src/dsig/DSIGKeyInfoX509.hpp
Index: DSIGKeyInfoX509.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoX509.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DSIGKeyInfoX509.hpp 11 Sep 2003 11:13:36 -0000 1.7
+++ DSIGKeyInfoX509.hpp 12 Sep 2003 09:47:17 -0000 1.8
@@ -122,25 +122,25 @@
/**
* \brief Constructor used when XML structures exist.
*
- * Constructor called by DSIGSignature class when loading an
+ * Constructor called by interface class when loading an
* X509Data element from DOM nodes.
*
- * @param sig Calling signature
+ * @param env Operating environment
* @param X509Data DOMNode at start of data
*/
- DSIGKeyInfoX509(DSIGSignature * sig, XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode *X509Data);
+ DSIGKeyInfoX509(const XSECEnv * env, XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode *X509Data);
/**
* \brief Constructor called when building XML structures
*
- * Constructor called by DSIGSignature class when an XML
+ * Constructor called by interface class when an XML
* structure is being built by a user calling the API
*
- * @param sig Calling signature
+ * @param env Operating environment
*/
- DSIGKeyInfoX509(DSIGSignature * sig);
+ DSIGKeyInfoX509(const XSECEnv * env);
/**
* \brief Destructor
@@ -156,7 +156,7 @@
/**
* \brief Function called to load an XML structure
*
- * Function called by DSIGSignature to load an X509Data structure
+ * Function called by intercace class to load an X509Data structure
* from DOMNodes.
*/
1.23 +57 -66 xml-security/c/src/dsig/DSIGSignature.cpp
Index: DSIGSignature.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGSignature.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- DSIGSignature.cpp 11 Sep 2003 11:13:36 -0000 1.22
+++ DSIGSignature.cpp 12 Sep 2003 09:47:17 -0000 1.23
@@ -93,6 +93,7 @@
#include <xsec/dsig/DSIGKeyInfoPGPData.hpp>
#include <xsec/dsig/DSIGKeyInfoSPKIData.hpp>
#include <xsec/dsig/DSIGKeyInfoMgmtData.hpp>
+#include <xsec/framework/XSECEnv.hpp>
// Xerces includes
@@ -334,16 +335,13 @@
void DSIGSignature::setURIResolver(XSECURIResolver * resolver) {
- if (mp_URIResolver != 0)
- delete mp_URIResolver;
-
- mp_URIResolver = resolver->clone();
+ mp_env->setURIResolver(resolver);
}
XSECURIResolver * DSIGSignature::getURIResolver(void) {
- return mp_URIResolver;
+ return mp_env->getURIResolver();
}
@@ -377,20 +375,18 @@
mp_sigNode = sigNode;
mp_signingKey = NULL;
mp_signedInfo = NULL;
- mp_prefixNS = XMLString::replicate(DSIGConstants::s_unicodeStrEmpty);
- mp_ecPrefixNS = XMLString::replicate(DSIGConstants::s_unicodeStrEmpty);
- mp_xpfPrefixNS = XMLString::replicate(DSIGConstants::s_unicodeStrEmpty);
- mp_URIResolver = NULL;
mp_KeyInfoResolver = NULL;
mp_KeyInfoNode = NULL;
m_loaded = false;
- m_keyInfoList.setParentSignature(this);
-
// Set up our formatter
XSECnew(mp_formatter,
XSECSafeBufferFormatter("UTF-8",XMLFormatter::NoEscapes,
XMLFormatter::UnRep_CharRef));
+ // Set up the environment
+ XSECnew(mp_env, XSECEnv(doc));
+
+ m_keyInfoList.setEnvironment(mp_env);
}
@@ -401,25 +397,25 @@
mp_sigNode = NULL;
mp_signingKey = NULL;
mp_signedInfo = NULL;
- mp_prefixNS = XMLString::replicate(DSIGConstants::s_unicodeStrEmpty);
- mp_ecPrefixNS = XMLString::replicate(DSIGConstants::s_unicodeStrEmpty);
- mp_xpfPrefixNS = XMLString::replicate(DSIGConstants::s_unicodeStrEmpty);
- mp_URIResolver = NULL;
mp_KeyInfoResolver = NULL;
mp_KeyInfoNode = NULL;
m_loaded = false;
- m_keyInfoList.setParentSignature(this);
-
// Set up our formatter
XSECnew(mp_formatter,
XSECSafeBufferFormatter("UTF-8",XMLFormatter::NoEscapes,
XMLFormatter::UnRep_CharRef));
+ XSECnew(mp_env, XSECEnv(NULL));
+
+ m_keyInfoList.setEnvironment(mp_env);
}
DSIGSignature::~DSIGSignature() {
+ if (mp_env != NULL)
+ delete mp_env;
+
if (mp_signingKey != NULL) {
delete mp_signingKey;
@@ -440,30 +436,11 @@
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_KeyInfoResolver != NULL) {
delete mp_KeyInfoResolver;
mp_KeyInfoResolver = NULL;
}
- if (mp_URIResolver != NULL) {
- delete mp_URIResolver;
- mp_URIResolver = NULL;
- }
}
@@ -480,49 +457,66 @@
void DSIGSignature::setDSIGNSPrefix(const XMLCh * prefix) {
- if (mp_prefixNS != NULL)
- delete[] mp_prefixNS;
-
- mp_prefixNS = XMLString::replicate(prefix);
+ mp_env->setDSIGNSPrefix(prefix);
}
void DSIGSignature::setECNSPrefix(const XMLCh * prefix) {
- if (mp_ecPrefixNS != NULL)
- delete[] mp_ecPrefixNS;
-
- mp_ecPrefixNS = XMLString::replicate(prefix);
+ mp_env->setECNSPrefix(prefix);
}
void DSIGSignature::setXPFNSPrefix(const XMLCh * prefix) {
- if (mp_xpfPrefixNS != NULL)
- delete[] mp_xpfPrefixNS;
+ mp_env->setXPFNSPrefix(prefix);
+
+}
+
+// get
+
+const XMLCh * DSIGSignature::getDSIGNSPrefix() {
+
+ return mp_env->getDSIGNSPrefix();
+
+}
+
+
+const XMLCh * DSIGSignature::getECNSPrefix() {
- mp_xpfPrefixNS = XMLString::replicate(prefix);
+ return mp_env->getECNSPrefix();
}
+const XMLCh * DSIGSignature::getXPFNSPrefix() {
+
+ return mp_env->getXPFNSPrefix();
+
+}
+
+
DOMElement *DSIGSignature::createBlankSignature(DOMDocument *doc,
canonicalizationMethod cm,
signatureMethod sm,
hashMethod hm) {
mp_doc = doc;
+ mp_env->setParentDocument(doc);
+
+ const XMLCh * prefixNS = mp_env->getDSIGNSPrefix();
+
safeBuffer str;
- makeQName(str, mp_prefixNS, "Signature");
+ makeQName(str, prefixNS, "Signature");
DOMElement *sigNode =
doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG, str.rawXMLChBuffer());
- if (mp_prefixNS[0] == '\0') {
+ if (prefixNS[0] == '\0') {
str.sbTranscodeIn("xmlns");
}
else {
str.sbTranscodeIn("xmlns:");
- str.sbXMLChCat(mp_prefixNS);
+ str.sbXMLChCat(prefixNS);
}
sigNode->setAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
@@ -541,7 +535,7 @@
// Create a dummy signature value (dummy until signed)
- makeQName(str, mp_prefixNS, "SignatureValue");
+ makeQName(str, mp_env->getDSIGNSPrefix(), "SignatureValue");
DOMElement *sigValNode =
doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG,
str.rawXMLChBuffer());
mp_signatureValueNode = sigValNode;
@@ -600,7 +594,7 @@
safeBuffer str;
- makeQName(str, mp_prefixNS, "KeyInfo");
+ makeQName(str, mp_env->getDSIGNSPrefix(), "KeyInfo");
mp_KeyInfoNode =
mp_doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG,
str.rawXMLChBuffer());
@@ -635,7 +629,7 @@
// Create the new element
DSIGKeyInfoValue * v;
- XSECnew(v, DSIGKeyInfoValue(this));
+ XSECnew(v, DSIGKeyInfoValue(mp_env));
mp_KeyInfoNode->appendChild(v->createBlankDSAKeyValue(P, Q, G, Y));
mp_KeyInfoNode->appendChild(mp_doc->createTextNode(DSIGConstants::s_unicodeStrNL));
@@ -654,7 +648,7 @@
// Create the new element
DSIGKeyInfoValue * v;
- XSECnew(v, DSIGKeyInfoValue(this));
+ XSECnew(v, DSIGKeyInfoValue(mp_env));
mp_KeyInfoNode->appendChild(v->createBlankRSAKeyValue(modulus,
exponent));
mp_KeyInfoNode->appendChild(mp_doc->createTextNode(DSIGConstants::s_unicodeStrNL));
@@ -673,7 +667,7 @@
DSIGKeyInfoX509 * x;
- XSECnew(x, DSIGKeyInfoX509(this));
+ XSECnew(x, DSIGKeyInfoX509(mp_env));
mp_KeyInfoNode->appendChild(x->createBlankX509Data());
mp_KeyInfoNode->appendChild(mp_doc->createTextNode(DSIGConstants::s_unicodeStrNL));
@@ -691,7 +685,7 @@
DSIGKeyInfoName * n;
- XSECnew(n, DSIGKeyInfoName(this));
+ XSECnew(n, DSIGKeyInfoName(mp_env));
mp_KeyInfoNode->appendChild(n->createBlankKeyName(name, isDName));
mp_KeyInfoNode->appendChild(mp_doc->createTextNode(DSIGConstants::s_unicodeStrNL));
@@ -709,7 +703,7 @@
DSIGKeyInfoPGPData * p;
- XSECnew(p, DSIGKeyInfoPGPData(this));
+ XSECnew(p, DSIGKeyInfoPGPData(mp_env));
mp_KeyInfoNode->appendChild(p->createBlankPGPData(id, packet));
mp_KeyInfoNode->appendChild(mp_doc->createTextNode(DSIGConstants::s_unicodeStrNL));
@@ -726,7 +720,7 @@
DSIGKeyInfoSPKIData * s;
- XSECnew(s, DSIGKeyInfoSPKIData(this));
+ XSECnew(s, DSIGKeyInfoSPKIData(mp_env));
mp_KeyInfoNode->appendChild(s->createBlankSPKIData(sexp));
mp_KeyInfoNode->appendChild(mp_doc->createTextNode(DSIGConstants::s_unicodeStrNL));
@@ -743,7 +737,7 @@
DSIGKeyInfoMgmtData * m;
- XSECnew(m, DSIGKeyInfoMgmtData(this));
+ XSECnew(m, DSIGKeyInfoMgmtData(mp_env));
mp_KeyInfoNode->appendChild(m->createBlankMgmtData(data));
mp_KeyInfoNode->appendChild(mp_doc->createTextNode(DSIGConstants::s_unicodeStrNL));
@@ -780,10 +774,7 @@
m_loaded = true;
// Find the prefix being used so that we can later use it to manipulate
the signature
- if (mp_prefixNS != NULL)
- delete[] mp_prefixNS;
-
- mp_prefixNS = XMLString::replicate(mp_sigNode->getPrefix());
+ mp_env->setDSIGNSPrefix(mp_sigNode->getPrefix());
// Now check for SignedInfo
DOMNode *tmpElt = mp_sigNode->getFirstChild();
@@ -917,7 +908,7 @@
}
DSIGKeyInfoX509 * x509;
- XSECnew(x509, DSIGKeyInfoX509(this));
+ XSECnew(x509, DSIGKeyInfoX509(mp_env));
x509->setRawRetrievalURI(URI);
this->m_keyInfoList.addKeyInfo(x509);
@@ -927,7 +918,7 @@
else {
// Find base transform using the base
URI
- currentTxfm =
DSIGReference::getURIBaseTXFM(mp_doc, URI, mp_URIResolver);
+ currentTxfm =
DSIGReference::getURIBaseTXFM(mp_doc, URI, mp_env->getURIResolver());
TXFMChain * chain;
XSECnew(chain, TXFMChain(currentTxfm));
Janitor<TXFMChain> j_chain(chain);
1.16 +8 -10 xml-security/c/src/dsig/DSIGSignature.hpp
Index: DSIGSignature.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGSignature.hpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- DSIGSignature.hpp 11 Sep 2003 11:13:36 -0000 1.15
+++ DSIGSignature.hpp 12 Sep 2003 09:47:17 -0000 1.16
@@ -82,6 +82,7 @@
#include <xercesc/dom/DOM.hpp>
+class XSECEnv;
class XSECBinTXFMInputStream;
class XSECURIResolver;
class XSECKeyInfoResolver;
@@ -425,7 +426,7 @@
*
*/
- const XMLCh * getDSIGNSPrefix() {return mp_prefixNS;}
+ const XMLCh * getDSIGNSPrefix();
/**
* \brief Get the NS being used for EC nodes
@@ -434,7 +435,7 @@
* @see #setECNSPrefix
*/
- const XMLCh * getECNSPrefix() {return mp_ecPrefixNS;}
+ const XMLCh * getECNSPrefix();
/**
* \brief Get the NS being used for XPath Filter2 nodes
@@ -443,7 +444,7 @@
* @see #setXPFNSPrefix
*/
- const XMLCh * getXPFNSPrefix() {return mp_xpfPrefixNS;}
+ const XMLCh * getXPFNSPrefix();
/**
* \brief
@@ -696,16 +697,13 @@
*
mp_KeyInfoNode;
safeBuffer m_errStr;
- // For creating functions
- XMLCh * mp_prefixNS;
- XMLCh * mp_ecPrefixNS;
- XMLCh * mp_xpfPrefixNS;
-
+ // Environment
+ XSECEnv * mp_env;
+
// The signing/verifying key
XSECCryptoKey * mp_signingKey;
// Resolvers
- XSECURIResolver * mp_URIResolver;
XSECKeyInfoResolver * mp_KeyInfoResolver;
// Not implemented constructors
1.9 +3 -5 xml-security/c/src/framework/XSECProvider.hpp
Index: XSECProvider.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/framework/XSECProvider.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XSECProvider.hpp 11 Sep 2003 11:12:39 -0000 1.8
+++ XSECProvider.hpp 12 Sep 2003 09:47:18 -0000 1.9
@@ -60,10 +60,8 @@
/*
* XSEC
*
- * XSECProvider.hpp := The main interface for users wishing to gain access
- * to signature objects
- *
- * Author(s): Berin Lautenbach
+ * XSECProvider.hpp := Main interface class that applications use to
+ * get access to Signature and
Encryption functions.
*
* $Id$
*
1.1 xml-security/c/src/framework/XSECEnv.cpp
Index: XSECEnv.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 [EMAIL PROTECTED]
*
* 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
*
* XSECEnv := Configuration class - used by the other classes to retrieve
* information on the environment they are working under
*
* $Id: XSECEnv.cpp,v 1.1 2003/09/12 09:47:18 blautenb Exp $
*
*/
// XSEC Includes
#include <xsec/framework/XSECEnv.hpp>
#include <xsec/framework/XSECError.hpp>
#include <xsec/framework/XSECUriResolver.hpp>
#include <xsec/dsig/DSIGConstants.hpp>
XERCES_CPP_NAMESPACE_USE
//
--------------------------------------------------------------------------------
// Env
//
--------------------------------------------------------------------------------
// Constructors and Destructors
XSECEnv::XSECEnv(DOMDocument *doc) {
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_URIResolver = NULL;
// Set up our formatter
XSECnew(mp_formatter,
XSECSafeBufferFormatter("UTF-8",XMLFormatter::NoEscapes,
XMLFormatter::UnRep_CharRef));
}
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_URIResolver != NULL) {
delete mp_URIResolver;
mp_URIResolver = NULL;
}
}
//
--------------------------------------------------------------------------------
// Set and Get Resolvers
//
--------------------------------------------------------------------------------
void XSECEnv::setURIResolver(XSECURIResolver * resolver) {
if (mp_URIResolver != 0)
delete mp_URIResolver;
mp_URIResolver = resolver->clone();
}
XSECURIResolver * XSECEnv::getURIResolver(void) {
return mp_URIResolver;
}
//
--------------------------------------------------------------------------------
// Set and Get Prefixes
//
--------------------------------------------------------------------------------
void XSECEnv::setDSIGNSPrefix(const XMLCh * prefix) {
if (mp_prefixNS != NULL)
delete[] mp_prefixNS;
mp_prefixNS = XMLString::replicate(prefix);
}
void XSECEnv::setECNSPrefix(const XMLCh * prefix) {
if (mp_ecPrefixNS != NULL)
delete[] mp_ecPrefixNS;
mp_ecPrefixNS = XMLString::replicate(prefix);
}
void XSECEnv::setXPFNSPrefix(const XMLCh * prefix) {
if (mp_xpfPrefixNS != NULL)
delete[] mp_xpfPrefixNS;
mp_xpfPrefixNS = XMLString::replicate(prefix);
}
1.1 xml-security/c/src/framework/XSECEnv.hpp
Index: XSECEnv.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 [EMAIL PROTECTED]
*
* 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
*
* XSECEnv := Configuration class - used by the other classes to retrieve
* information on the environment they are working under
*
* $Id: XSECEnv.hpp,v 1.1 2003/09/12 09:47:18 blautenb Exp $
*
*/
#ifndef XSECENV_INCLUDE
#define XSECENV_INCLUDE
// XSEC Includes
#include <xsec/framework/XSECDefs.hpp>
#include <xsec/utils/XSECSafeBufferFormatter.hpp>
// Xerces Includes
#include <xercesc/dom/DOM.hpp>
class XSECURIResolver;
/**
* @ingroup internal
*/
/[EMAIL PROTECTED]/
/**
* @brief Holds environmental information
*
* The various XSEC classes need to be able to retrieve information
* about the environment they are operating in (namespace prefixes,
* owning document etc.) - this class is used to provide and hold
* this info.
*
*/
class DSIG_EXPORT XSECEnv {
public:
/** @name Constructors and Destructors */
//@{
/**
* \brief Contructor.
*
*/
XSECEnv(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc);
virtual ~XSECEnv();
//@}
/** @name Prefix handling. */
//@{
/**
* \brief Set the prefix be used for the DSIG namespace.
*
* <p>When the XSEC library creates XML Element nodes, it uses the
prefix here
* for all nodes created. By default, the library assumes that the
default
* namespace is used.</p>
*
* <p>The #createBlankSignature function will use this prefix to setup
the
* dsig namespace. E.g. (assuming a call has been made to set the
prefix to "ds")
* the \<Signature\> element will have a namespace attribute added
of</p>
*
* <p>xmlns:ds="http://www.w3.org/2000/09/xmldsig#"</p>
*
* <p>If no prefix has been set, this attribute will be set as the
default namespace</p>
*
* @see #createBlankSignature
* @param prefix The UTF-16 encoided NS prefix to use for the XML
* Digital Signature nodes
*/
void setDSIGNSPrefix(const XMLCh * prefix);
/**
* \brief Set the prefix be used for the Exclusive Canonicalisation
namespace.
*
* The Exclusive Canonicalisation specification defines a new
namespace for the
* InclusiveNamespaces node. This function can be used to set the
prefix
* that the library will use when creating nodes within this namespace.
*
* <p>xmlns:ds="http://www.w3.org/2001/10/xml-exc-c14n#"</p>
*
* If no prefix is set, the default namespace will be used
*
* @see #createBlankSignature
* @param prefix The UTF-16 encoided NS prefix to use for the XML
* Exclusive Canonicalisation nodes
*/
void setECNSPrefix(const XMLCh * prefix);
/**
* \brief Set the prefix be used for the XPath-Filter2 namespace.
*
* The XPathFilter definition uses its own namespace. This
* method can be used to set the prefix that the library will use
* when creating elements in this namespace
*
* <p>xmlns:ds="http://www.w3.org/2002/06/xmldsig-filter2"</p>
*
* If no prefix is set, the default namespace will be used
*
* @see #createBlankSignature
* @param prefix The UTF-16 encoided NS prefix to use for the XPath
* filter nodes
*/
void setXPFNSPrefix(const XMLCh * prefix);
/**
* \brief Get the NS Prefix being used for DSIG elements.
*
* @returns A pointer to the buffer holding the prefix
* @see #setDSIGNSPrefix
*
*/
const XMLCh * getDSIGNSPrefix() const {return mp_prefixNS;}
/**
* \brief Get the NS being used for EC nodes
*
* @returns A pointer to the buffer holding the prefix
* @see #setECNSPrefix
*/
const XMLCh * getECNSPrefix() const {return mp_ecPrefixNS;}
/**
* \brief Get the NS being used for XPath Filter2 nodes
*
* @returns A pointer to the buffer holding the prefix
* @see #setXPFNSPrefix
*/
const XMLCh * getXPFNSPrefix() const {return mp_xpfPrefixNS;}
//@}
/** @name General information functions */
/**
* \brief
*
* Get the DOMDocument that the super class is operating within.
*
* Mainly used by the library itself.
*
* @returns The DOM_Document node.
*/
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * getParentDocument() const
{return mp_doc;}
/**
* \brief
*
* Set the DOMDocument that the super class is operating within.
*
* Mainly used by the library itself.
*
* @param doc The Document node.
*/
void setParentDocument(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc)
{mp_doc = doc;}
//@}
/** @name Resolver manipulation */
//@{
/**
* \brief Register a URIResolver
*
* Registers a URIResolver to be used by the Signature when
dereferencing
* a URI in a Reference element
*
*/
void setURIResolver(XSECURIResolver * resolver);
/**
* \brief Return a pointer to the resolver being used
*
* @returns A pointer to the URIResolver registered in this signature
*/
XSECURIResolver * getURIResolver(void);
//@}
private:
// Internal functions
XSECSafeBufferFormatter * mp_formatter;
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument
* mp_doc;
// For creating functions
XMLCh * mp_prefixNS;
XMLCh * mp_ecPrefixNS;
XMLCh * mp_xpfPrefixNS;
// Resolvers
XSECURIResolver * mp_URIResolver;
XSECEnv();
/[EMAIL PROTECTED]/
};
#endif /* XSECENV_INCLUDE */