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/03/30 08:57:13 UTC
cvs commit: xml-security/c/src/enc/OpenSSL OpenSSLCryptoHash.cpp OpenSSLCryptoHashHMAC.cpp OpenSSLCryptoProvider.cpp OpenSSLCryptoProvider.hpp
blautenb 2003/03/29 22:57:13
Modified: c/Projects/VC6.0/xsec/xsec_lib xsec_lib.dsp
c/src/dsig DSIGConstants.cpp DSIGConstants.hpp
DSIGReference.cpp
c/src/enc XSECCryptoHash.hpp XSECCryptoProvider.hpp
c/src/enc/OpenSSL OpenSSLCryptoHash.cpp
OpenSSLCryptoHashHMAC.cpp OpenSSLCryptoProvider.cpp
OpenSSLCryptoProvider.hpp
Log:
Support for MD-5 Digests
Revision Changes Path
1.6 +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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- xsec_lib.dsp 21 Feb 2003 11:53:43 -0000 1.5
+++ xsec_lib.dsp 30 Mar 2003 06:57:12 -0000 1.6
@@ -740,5 +740,13 @@
SOURCE=..\..\..\..\src\framework\version.rc
# End Source File
# End Group
+# Begin Source File
+
+SOURCE=..\..\..\..\src\transformers\TXFMMD5.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\transformers\TXFMMD5.hpp
+# End Source File
# End Target
# End Project
1.3 +5 -3 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DSIGConstants.cpp 9 Feb 2003 11:13:47 -0000 1.2
+++ DSIGConstants.cpp 30 Mar 2003 06:57:12 -0000 1.3
@@ -64,9 +64,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
@@ -84,6 +82,7 @@
static XMLCh * s_unicodeStrURIDSIG;
static XMLCh * s_unicodeStrURISHA1;
+static XMLCh * s_unicodeStrURIMD5;
static XMLCh * s_unicodeStrURIBASE64;
static XMLCh * s_unicodeStrURIXPATH;
static XMLCh * s_unicodeStrURIXSLT;
@@ -111,6 +110,7 @@
const XMLCh * const & DSIGConstants::s_unicodeStrURIDSIG = ::s_unicodeStrURIDSIG;
const XMLCh * const & DSIGConstants::s_unicodeStrURISHA1 = ::s_unicodeStrURISHA1;
+const XMLCh * const & DSIGConstants::s_unicodeStrURIMD5 = ::s_unicodeStrURIMD5;
const XMLCh * const & DSIGConstants::s_unicodeStrURIBASE64 = ::s_unicodeStrURIBASE64;
const XMLCh * const & DSIGConstants::s_unicodeStrURIXPATH = ::s_unicodeStrURIXPATH;
const XMLCh * const & DSIGConstants::s_unicodeStrURIXSLT = ::s_unicodeStrURIXSLT;
@@ -142,6 +142,7 @@
::s_unicodeStrURIDSIG = XMLString::transcode(URI_ID_DSIG);
::s_unicodeStrURISHA1 = XMLString::transcode(URI_ID_SHA1);
+ ::s_unicodeStrURIMD5 = XMLString::transcode(URI_ID_MD5);
::s_unicodeStrURIBASE64 = XMLString::transcode(URI_ID_BASE64);
::s_unicodeStrURIXPATH = XMLString::transcode(URI_ID_XPATH);
::s_unicodeStrURIXSLT = XMLString::transcode(URI_ID_XSLT);
@@ -170,6 +171,7 @@
delete[] ::s_unicodeStrURIDSIG;
delete[] ::s_unicodeStrURISHA1;
+ delete[] ::s_unicodeStrURIMD5;
delete[] ::s_unicodeStrURIBASE64;
delete[] ::s_unicodeStrURIXPATH;
delete[] ::s_unicodeStrURIXSLT;
1.4 +10 -2 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DSIGConstants.hpp 22 Feb 2003 08:47:23 -0000 1.3
+++ DSIGConstants.hpp 30 Mar 2003 06:57:12 -0000 1.4
@@ -86,6 +86,7 @@
// Hashing Algorithms
#define URI_ID_SHA1 "http://www.w3.org/2000/09/xmldsig#sha1"
+#define URI_ID_MD5 "http://www.w3.org/2001/04/xmldsig-more#md5"
// Transforms
@@ -142,7 +143,8 @@
enum hashMethod {
HASH_NONE = 0, // No method defined
- HASH_SHA1 = 1 // SHA1
+ HASH_SHA1 = 1, // SHA1
+ HASH_MD5 = 2,
};
enum transformType {
@@ -250,6 +252,11 @@
uri = URI_ID_SHA1;
break;
+ case (HASH_MD5) :
+
+ uri = URI_ID_MD5;
+ break;
+
default:
return false;
@@ -279,6 +286,7 @@
// URI_IDs
static const XMLCh * const & s_unicodeStrURIDSIG;
static const XMLCh * const & s_unicodeStrURISHA1;
+ static const XMLCh * const & s_unicodeStrURIMD5; // Not recommended
static const XMLCh * const & s_unicodeStrURIBASE64;
static const XMLCh * const & s_unicodeStrURIXPATH;
static const XMLCh * const & s_unicodeStrURIXSLT;
1.8 +13 -1 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DSIGReference.cpp 22 Feb 2003 08:47:23 -0000 1.7
+++ DSIGReference.cpp 30 Mar 2003 06:57:12 -0000 1.8
@@ -76,6 +76,7 @@
#include <xsec/transformers/TXFMDocObject.hpp>
#include <xsec/transformers/TXFMOutputFile.hpp>
#include <xsec/transformers/TXFMSHA1.hpp>
+#include <xsec/transformers/TXFMMD5.hpp>
#include <xsec/transformers/TXFMBase64.hpp>
#include <xsec/transformers/TXFMSB.hpp>
#include <xsec/transformers/TXFMXPath.hpp>
@@ -657,6 +658,12 @@
}
+ else if (strEquals(atts->item(i)->getNodeValue(), DSIGConstants::s_unicodeStrURIMD5)) {
+
+ me_hashMethod = HASH_MD5;
+
+ }
+
else {
safeBuffer tmp, error;
@@ -1251,6 +1258,11 @@
case HASH_SHA1 :
XSECnew(currentTxfm, TXFMSHA1(d));
+ break;
+
+ case HASH_MD5 :
+
+ XSECnew(currentTxfm, TXFMMD5(d));
break;
default :
1.5 +1 -0 xml-security/c/src/enc/XSECCryptoHash.hpp
Index: XSECCryptoHash.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/XSECCryptoHash.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSECCryptoHash.hpp 2 Mar 2003 08:21:01 -0000 1.4
+++ XSECCryptoHash.hpp 30 Mar 2003 06:57:12 -0000 1.5
@@ -111,6 +111,7 @@
HASH_NONE = 0,
HASH_SHA1 = 1,
+ HASH_MD5 = 2
};
1.3 +30 -0 xml-security/c/src/enc/XSECCryptoProvider.hpp
Index: XSECCryptoProvider.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/XSECCryptoProvider.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSECCryptoProvider.hpp 9 Feb 2003 11:13:49 -0000 1.2
+++ XSECCryptoProvider.hpp 30 Mar 2003 06:57:12 -0000 1.3
@@ -216,6 +216,36 @@
virtual XSECCryptoHash * hashHMACSHA1() = 0;
+ /**
+ * \brief Return a MD5 implementation.
+ *
+ * Call used by the library to obtain a MD5 object from the
+ * provider.
+ *
+ * @returns A pointer to a Hash object that implements MD5
+ * @see XSECCryptoHash
+ */
+
+ virtual XSECCryptoHash * hashMD5() = 0;
+
+ /**
+ * \brief Return a HMAC MD5 implementation.
+ *
+ * Call used by the library to obtain a HMAC MD5 object from the
+ * provider. The caller will need to set the key in the hash
+ * object with an XSECCryptoKeyHMAC using XSECCryptoHash::setKey()
+ *
+ * @note The use of MD5 is explicitly marked as <b>not recommended</b>
+ * in the XML Digital Signature standard due to recent advances in
+ * cryptography indicating there <em>may</em> be weaknesses in the
+ * algorithm.
+ *
+ * @returns A pointer to a Hash object that implements HMAC-MD5
+ * @see XSECCryptoHash
+ */
+
+ virtual XSECCryptoHash * hashHMACMD5() = 0;
+
//@}
/** @name Encoding functions */
1.3 +5 -0 xml-security/c/src/enc/OpenSSL/OpenSSLCryptoHash.cpp
Index: OpenSSLCryptoHash.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/OpenSSL/OpenSSLCryptoHash.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- OpenSSLCryptoHash.cpp 9 Feb 2003 11:13:49 -0000 1.2
+++ OpenSSLCryptoHash.cpp 30 Mar 2003 06:57:12 -0000 1.3
@@ -86,6 +86,11 @@
mp_md = EVP_get_digestbyname("SHA1");
break;
+ case (XSECCryptoHash::HASH_MD5) :
+
+ mp_md = EVP_get_digestbyname("MD5");
+ break;
+
default :
mp_md = NULL;
1.3 +5 -0 xml-security/c/src/enc/OpenSSL/OpenSSLCryptoHashHMAC.cpp
Index: OpenSSLCryptoHashHMAC.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/OpenSSL/OpenSSLCryptoHashHMAC.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- OpenSSLCryptoHashHMAC.cpp 9 Feb 2003 11:13:49 -0000 1.2
+++ OpenSSLCryptoHashHMAC.cpp 30 Mar 2003 06:57:12 -0000 1.3
@@ -89,6 +89,11 @@
mp_md = EVP_get_digestbyname("SHA1");
break;
+ case (XSECCryptoHash::HASH_MD5) :
+
+ mp_md = EVP_get_digestbyname("MD5");
+ break;
+
default :
mp_md = NULL;
1.4 +21 -1 xml-security/c/src/enc/OpenSSL/OpenSSLCryptoProvider.cpp
Index: OpenSSLCryptoProvider.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/OpenSSL/OpenSSLCryptoProvider.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- OpenSSLCryptoProvider.cpp 22 Feb 2003 08:47:24 -0000 1.3
+++ OpenSSLCryptoProvider.cpp 30 Mar 2003 06:57:12 -0000 1.4
@@ -111,6 +111,26 @@
}
+XSECCryptoHash * OpenSSLCryptoProvider::hashMD5() {
+
+ OpenSSLCryptoHash * ret;
+
+ XSECnew(ret, OpenSSLCryptoHash(XSECCryptoHash::HASH_MD5));
+
+ return ret;
+
+}
+
+XSECCryptoHash * OpenSSLCryptoProvider::hashHMACMD5() {
+
+ OpenSSLCryptoHashHMAC * ret;
+
+ XSECnew(ret, OpenSSLCryptoHashHMAC(XSECCryptoHash::HASH_MD5));
+
+ return ret;
+
+}
+
XSECCryptoKeyDSA * OpenSSLCryptoProvider::keyDSA() {
OpenSSLCryptoKeyDSA * ret;
1.3 +2 -0 xml-security/c/src/enc/OpenSSL/OpenSSLCryptoProvider.hpp
Index: OpenSSLCryptoProvider.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/OpenSSL/OpenSSLCryptoProvider.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- OpenSSLCryptoProvider.hpp 9 Feb 2003 11:13:50 -0000 1.2
+++ OpenSSLCryptoProvider.hpp 30 Mar 2003 06:57:12 -0000 1.3
@@ -96,6 +96,8 @@
// Hashing classes
virtual XSECCryptoHash * hashSHA1();
virtual XSECCryptoHash * hashHMACSHA1();
+ virtual XSECCryptoHash * hashMD5();
+ virtual XSECCryptoHash * hashHMACMD5();
// Encode/Decode
virtual XSECCryptoBase64 * base64();