You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by sc...@apache.org on 2017/12/05 20:59:07 UTC

svn commit: r1817235 - in /santuario/xml-security-cpp/trunk/xsec: dsig/DSIGSignature.cpp dsig/DSIGSignature.hpp dsig/DSIGSignedInfo.cpp dsig/DSIGSignedInfo.hpp tools/threadTest/threadtest.cpp utils/XSECAutoPtr.hpp

Author: scantor
Date: Tue Dec  5 20:59:07 2017
New Revision: 1817235

URL: http://svn.apache.org/viewvc?rev=1817235&view=rev
Log:
Remove deprecated signature methods.

Modified:
    santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.cpp
    santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.hpp
    santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignedInfo.cpp
    santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignedInfo.hpp
    santuario/xml-security-cpp/trunk/xsec/tools/threadTest/threadtest.cpp
    santuario/xml-security-cpp/trunk/xsec/utils/XSECAutoPtr.hpp

Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.cpp?rev=1817235&r1=1817234&r2=1817235&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.cpp Tue Dec  5 20:59:07 2017
@@ -446,37 +446,6 @@ const XMLCh * DSIGSignature::getXPFNSPre
 
 }
 
-// --------------------------------------------------------------------------------
-//           Creating Blank Signature
-// --------------------------------------------------------------------------------
-
-DOMElement *DSIGSignature::createBlankSignature(DOMDocument *doc,
-			canonicalizationMethod cm,
-			signatureMethod	sm,
-			hashMethod hm) {
-
-	// This is now deprecated.  Because this is so, we go the long way - translate
-	// to URI and then call the "standard" method, which will translate back to 
-	// internal enums if possible
-
-	const XMLCh * cURI;
-	safeBuffer sURI;
-
-	if ((cURI = canonicalizationMethod2UNICODEURI(cm)) == NULL) {
-		throw XSECException(XSECException::UnknownCanonicalization,
-			"DSIGSignature::createBlankSignature - Canonicalisation method unknown");
-	}
-
-	if (signatureHashMethod2URI(sURI, sm, hm) == false) {
-		throw XSECException(XSECException::UnknownSignatureAlgorithm,
-			"DSIGSignature::createBlankSignature - Signature/Hash method unknown");
-	}
-
-	return createBlankSignature(doc, cURI, sURI.sbStrToXMLCh());
-
-}
-
-
 DOMElement *DSIGSignature::createBlankSignature(
 		DOMDocument *doc,
 		const XMLCh * canonicalizationAlgorithmURI,
@@ -541,14 +510,6 @@ DOMElement *DSIGSignature::createBlankSi
 //           Creating References
 // --------------------------------------------------------------------------------
 
-DSIGReference * DSIGSignature::createReference(const XMLCh * URI, 
-								hashMethod hm, 
-								char * type) {
-
-	return mp_signedInfo->createReference(URI, hm, type);
-
-}
-
 DSIGReference * DSIGSignature::createReference(
 		const XMLCh * URI,
 		const XMLCh * hashAlgorithmURI, 

Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.hpp?rev=1817235&r1=1817234&r2=1817235&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.hpp Tue Dec  5 20:59:07 2017
@@ -310,65 +310,6 @@ public:
 	);
 
 	/**
-	 * \brief Create a \<Signature\> DOM structure.
-	 *
-	 * <p>The DOM structure created is still divorced from the document.  The callee
-	 * needs to take the returned \<Signature\> Element node and insert it at the
-	 * appropriate place in their document.</p>
-	 *
-	 * <p>The signature is a skeleton only.  There are no references or KeyInfo
-	 * elements inserted.  However the DSIGSignature structures are set up with the
-	 * new information, so once an element has been created and a signing key has been
-	 * set, a call to #sign will sign appropriately.
-	 *
-	 * @note The digest method (hash method) set here is for the signing function only.
-	 * Different hash methods can be used for reference elements.
-	 *
-	 * @param doc The document the Signature DOM structure will be inserted into.
-	 * @param cm The canonicalisation method to use.
-	 * @param sm The signature algorithm to be used.
-	 * @param hm The Digest function to be used for the actual signatures.
-	 * @returns The newly created \<Signature\> element that the caller should insert in
-	 * the document.
-	 * @deprecated Use the URI based creation method instead, as this supports 
-	 * signature algorithms that are not known to the library directly.
-	 */
-
-	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *createBlankSignature(
-		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
-		canonicalizationMethod cm = CANON_C14N_NOC,
-		signatureMethod	sm = SIGNATURE_DSA,
-		hashMethod hm = HASH_SHA1
-	);
-
-	/**
-	 * \brief Add a new reference to the end of the list of \<Reference\> nodes.
-	 *
-	 * <p>Creates a new DSIGReference, adds it to the list of references handled
-	 * by the owning DSIGSignature and also creates the skeleton DOM structure into
-	 * the document.</p>
-	 *
-	 * @note The XSEC Library currently makes very little use of <em>type</em>
-	 * attributes in \<Reference\> Elements.  However this may of use to calling
-	 * applications.
-	 *
-	 * @see DSIGReference
-	 * @param URI The Data that this Reference node refers to.
-	 * @param hm The hashing (digest) method to be used for this reference
-	 * @param type A "type" string (as defined in XML Signature).
-	 * @returns The newly created DSIGReference element.
-	 * @deprecated Use the URI based creation method instead
-	 *
-	 */
-
-	
-	DSIGReference * createReference(
-		const XMLCh * URI,
-		hashMethod hm = HASH_SHA1, 
-		char * type = NULL
-	);
-
-	/**
 	 * \brief Add a new reference to the end of the list of \<Reference\> nodes.
 	 *
 	 * <p>Creates a new DSIGReference, adds it to the list of references handled
@@ -564,32 +505,6 @@ public:
     const XMLCh * getAlgorithmURI() const;
 
 	/**
-	 * \brief Get the hash method
-	 *
-	 * Obtain the hash (digest) algorithm that is used to generate a hash
-	 * of the canonicalised \<SignedInfo\> element.
-	 *
-	 * @returns the Hash (digest) Method
-	 */
-
-	hashMethod getHashMethod(void) const
-	{return (mp_signedInfo != NULL ? 
-			 mp_signedInfo->getHashMethod() : HASH_NONE);}
-
-	/**
-	 * \brief Get the signature method
-	 *
-	 * Obtain the algorithm that will be used to generate/check the signature
-	 * of the canonicalised and hashed \<SignedInfo\> element.
-	 *
-	 * @returns the Signature method
-	 */
-
-	signatureMethod getSignatureMethod(void) const
-	{return (mp_signedInfo != NULL ? 
-			 mp_signedInfo->getSignatureMethod() : SIGNATURE_NONE);}
-
-	/**
 	 * \brief Get the Signature Value
 	 *
 	 * Returns the base64 string holding the signature value for this signature

Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignedInfo.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignedInfo.cpp?rev=1817235&r1=1817234&r2=1817235&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignedInfo.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignedInfo.cpp Tue Dec  5 20:59:07 2017
@@ -48,8 +48,6 @@ DSIGSignedInfo::DSIGSignedInfo(DOMDocume
 	m_HMACOutputLength = 0;
 	mp_formatter = pFormatter;
 	mp_signedInfoNode = signedInfoNode;
-	m_hashMethod = HASH_NONE;
-	m_signatureMethod = SIGNATURE_NONE;
 	m_canonicalizationMethod = CANON_NONE;
 	mp_algorithmURI = NULL;
 	mp_env = env;
@@ -66,8 +64,6 @@ DSIGSignedInfo::DSIGSignedInfo(DOMDocume
 	m_HMACOutputLength = 0;
 	mp_formatter = pFormatter;
 	mp_signedInfoNode = NULL;
-	m_hashMethod = HASH_NONE;
-	m_signatureMethod = SIGNATURE_NONE;
 	m_canonicalizationMethod = CANON_NONE;
 	mp_algorithmURI = NULL;
 	mp_env = env;
@@ -89,12 +85,6 @@ DSIGSignedInfo::~DSIGSignedInfo() {
 
 }
 
-signatureMethod DSIGSignedInfo::getSignatureMethod(void) const {
-
-	return m_signatureMethod;
-
-}
-
 DOMNode * DSIGSignedInfo::getDOMNode() const {
 
 	return mp_signedInfoNode;
@@ -107,12 +97,6 @@ canonicalizationMethod DSIGSignedInfo::g
 
 }
 
-hashMethod DSIGSignedInfo::getHashMethod() const {
-
-	return m_hashMethod;
-
-}
-
 int DSIGSignedInfo::getHMACOutputLength() const {
 
 	return m_HMACOutputLength;
@@ -148,20 +132,6 @@ void DSIGSignedInfo::hash(bool interlock
 // --------------------------------------------------------------------------------
 
 
-DSIGReference * DSIGSignedInfo::createReference(const XMLCh * URI, 
-								hashMethod hm, 
-								char * type) {
-
-	safeBuffer hURI;
-
-	if (hashMethod2URI(hURI, hm) == false) {
-		throw XSECException(XSECException::UnknownSignatureAlgorithm,
-			"DSIGSignedInfo::createReference - Hash method unknown");
-	}
-	
-	return createReference(URI, hURI.sbStrToXMLCh(), MAKE_UNICODE_STRING(type));;
-}
-
 DSIGReference * DSIGSignedInfo::createReference(
 		const XMLCh * URI,
 		const XMLCh * hashAlgorithmURI, 
@@ -201,33 +171,6 @@ DSIGReference * DSIGSignedInfo::removeRe
 //           Create an empty SignedInfo
 // --------------------------------------------------------------------------------
 
-// deprecated
-
-DOMElement *DSIGSignedInfo::createBlankSignedInfo(canonicalizationMethod cm,
-			signatureMethod	sm,
-			hashMethod hm) {
-
-	// This is now deprecated.  Because this is so, we go the long way - translate
-	// to URI and then call the "standard" method, which will translate back to 
-	// internal enums if possible
-
-	const XMLCh * cURI;
-	safeBuffer sURI;
-
-	if ((cURI = canonicalizationMethod2UNICODEURI(cm)) == NULL) {
-		throw XSECException(XSECException::UnknownCanonicalization,
-			"DSIGSignature::createBlankSignature - Canonicalisation method unknown");
-	}
-
-	if (signatureHashMethod2URI(sURI, sm, hm) == false) {
-		throw XSECException(XSECException::UnknownSignatureAlgorithm,
-			"DSIGSignature::createBlankSignature - Signature/Hash method unknown");
-	}
-
-	return createBlankSignedInfo(cURI, sURI.sbStrToXMLCh());
-
-}
-
 DOMElement * DSIGSignedInfo::createBlankSignedInfo(
 			const XMLCh * canonicalizationAlgorithmURI,
 			const XMLCh * signatureAlgorithmURI) {
@@ -244,7 +187,6 @@ DOMElement * DSIGSignedInfo::createBlank
 
 	// Now create the algorithm parts
 	XSECmapURIToCanonicalizationMethod(canonicalizationAlgorithmURI, m_canonicalizationMethod);
-	XSECmapURIToSignatureMethods(signatureAlgorithmURI, m_signatureMethod, m_hashMethod);
 
 	// Canonicalisation
 

Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignedInfo.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignedInfo.hpp?rev=1817235&r1=1817234&r2=1817235&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignedInfo.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignedInfo.hpp Tue Dec  5 20:59:07 2017
@@ -173,41 +173,6 @@ public:
 		);
 
 	/**
-	 * \brief Create an empty SignedInfo
-	 *
-	 * Creates the DOM structure for a SignedInfo
-	 *
-	 * Builds the DOM structures and sets the control
-	 * structures of the SignedInfo
-	 *
-	 * @param cm The canonicalisation method to set the SignedInfo as
-	 * @param sm Signature Method to use
-	 * @param hm Hash method to use (for the SignedInfo, not the references)
-	 * @deprecated Use URI based creation method instead
-	 */
-
-	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
-		createBlankSignedInfo(canonicalizationMethod cm,
-			signatureMethod	sm,
-			hashMethod hm
-		);
-
-	/**
-	 * \brief Create a reference to add to the SignedInfo
-	 *
-	 * Called by DSIGSignature to create and enter a new reference element
-	 *
-	 * @param URI What the reference references
-	 * @param hm Digest method to use for the reference
-	 * @param type Reference type
-	 * @deprecated Use the algorithmURI based call instead
-	 */
-
-	DSIGReference * createReference(const XMLCh * URI,
-		hashMethod hm, char * type);
-
-
-	/**
 	 * \brief Create a reference to add to the SignedInfo
 	 *
 	 * Called by DSIGSignature to create and enter a new reference element
@@ -270,22 +235,6 @@ public:
 	canonicalizationMethod getCanonicalizationMethod(void) const;
 
 	/**
-	 * \brief Get the hash method
-	 *
-	 * @returns the Hash (digest) Method
-	 */
-
-	hashMethod getHashMethod(void) const;
-
-	/**
-	 * \brief Get the signature method
-	 *
-	 * @returns the Signature method
-	 */
-
-	signatureMethod getSignatureMethod(void) const;
-
-	/**
 	 * \brief Get HMAC length
 	 * 
 	 * HMAC signatures can be truncated to a nominated length.
@@ -324,8 +273,6 @@ private:
 	XERCES_CPP_NAMESPACE_QUALIFIER DOMNode						
 								* mp_signedInfoNode;
 	canonicalizationMethod		m_canonicalizationMethod;
-	signatureMethod				m_signatureMethod;
-	hashMethod					m_hashMethod;
 	DSIGReferenceList			* mp_referenceList;
 	int							m_HMACOutputLength;
 	const XMLCh					* mp_algorithmURI;

Modified: santuario/xml-security-cpp/trunk/xsec/tools/threadTest/threadtest.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/tools/threadTest/threadtest.cpp?rev=1817235&r1=1817234&r2=1817235&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/tools/threadTest/threadtest.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/tools/threadTest/threadtest.cpp Tue Dec  5 20:59:07 2017
@@ -251,10 +251,10 @@ DWORD WINAPI doSignThread (LPVOID Param)
 		DOMElement * sigNode;
 
 		sig->setDSIGNSPrefix(MAKE_UNICODE_STRING("ds"));
-		sigNode = sig->createBlankSignature(myDoc, CANON_C14N_COM, SIGNATURE_HMAC, HASH_SHA1);
+		sigNode = sig->createBlankSignature(myDoc, DSIGConstants::s_unicodeStrURIC14N_COM, DSIGConstants::s_unicodeStrURIHMAC_SHA1);
 		myRootElem->appendChild(sigNode);
 		myRootElem->appendChild(myDoc->createTextNode(DSIGConstants::s_unicodeStrNL));
-		ref = sig->createReference(MAKE_UNICODE_STRING(""));
+		ref = sig->createReference(MAKE_UNICODE_STRING(""), DSIGConstants::s_unicodeStrURISHA1);
 		ref->appendEnvelopedSignatureTransform();
 
 		sig->appendKeyName(MAKE_UNICODE_STRING("The secret key is \"secret\""));

Modified: santuario/xml-security-cpp/trunk/xsec/utils/XSECAutoPtr.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/utils/XSECAutoPtr.hpp?rev=1817235&r1=1817234&r2=1817235&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/utils/XSECAutoPtr.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/utils/XSECAutoPtr.hpp Tue Dec  5 20:59:07 2017
@@ -1,20 +1,20 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 
 /*