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 2006/09/28 09:52:39 UTC

svn commit: r450745 - /xml/security/trunk/c/src/dsig/DSIGAlgorithmHandlerDefault.cpp

Author: blautenb
Date: Thu Sep 28 00:52:38 2006
New Revision: 450745

URL: http://svn.apache.org/viewvc?view=rev&rev=450745
Log:
Handle non SHA1 based RSA signatures (SHA224/256/384/512 and MD5)

Modified:
    xml/security/trunk/c/src/dsig/DSIGAlgorithmHandlerDefault.cpp

Modified: xml/security/trunk/c/src/dsig/DSIGAlgorithmHandlerDefault.cpp
URL: http://svn.apache.org/viewvc/xml/security/trunk/c/src/dsig/DSIGAlgorithmHandlerDefault.cpp?view=diff&rev=450745&r1=450744&r2=450745
==============================================================================
--- xml/security/trunk/c/src/dsig/DSIGAlgorithmHandlerDefault.cpp (original)
+++ xml/security/trunk/c/src/dsig/DSIGAlgorithmHandlerDefault.cpp Thu Sep 28 00:52:38 2006
@@ -210,6 +210,21 @@
 	
 	switch (hm) {
 
+	case HASH_MD5 :
+
+		if (sm == SIGNATURE_HMAC){
+			if (key->getKeyType() != XSECCryptoKey::KEY_HMAC) {
+				throw XSECException(XSECException::AlgorithmMapperError,
+					"DSIGAlgorithmHandlerDefault::addHashTxfm - non HMAC key passed in to HMAC signature");
+			}
+			XSECnew(txfm, TXFMMD5(doc, key));
+		}
+		else  {
+			XSECnew(txfm, TXFMMD5(doc));
+		}
+
+		break;
+
 	case HASH_SHA1 :
 
 		if (sm == SIGNATURE_HMAC){
@@ -415,7 +430,8 @@
 			hash, 
 			hashLen,
 			(char *) b64Buf, 
-			1024);
+			1024,
+			hm);
 
 		if (b64Len <= 0) {
 
@@ -536,7 +552,8 @@
 			hash,
 			hashLen,
 			sig,
-			(unsigned int) strlen(sig));
+			(unsigned int) strlen(sig),
+			hm);
 
 		break;