blautenb    2004/02/09 02:55:51

  Modified:    c/src/dsig DSIGSignature.cpp
               c/src/tools/templatesign templatesign.cpp
  Log:
  Patch for bugzilla #23512 (mismatch between template and key doesn't get 
caught by templatesign)
  
  Revision  Changes    Path
  1.30      +5 -1      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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- DSIGSignature.cpp 8 Feb 2004 10:20:51 -0000       1.29
  +++ DSIGSignature.cpp 9 Feb 2004 10:55:51 -0000       1.30
  @@ -869,6 +869,10 @@
        case HASH_SHA1 :
   
                if (mp_signedInfo->getSignatureMethod() == SIGNATURE_HMAC){
  +                     if (mp_signingKey->getKeyType() != 
XSECCryptoKey::KEY_HMAC) {
  +                             throw XSECException(XSECException::SigVfyError,
  +                                     "DSIGSignature::calculateSignedInfoHash 
- non HMAC key passed in to HMAC signature");
  +                     }
                        XSECnew(txfm, TXFMSHA1(mp_doc, mp_signingKey));
                }
                else  {
  
  
  
  1.18      +9 -1      xml-security/c/src/tools/templatesign/templatesign.cpp
  
  Index: templatesign.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/tools/templatesign/templatesign.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- templatesign.cpp  8 Feb 2004 10:24:59 -0000       1.17
  +++ templatesign.cpp  9 Feb 2004 10:55:51 -0000       1.18
  @@ -35,6 +35,7 @@
   #include <xsec/dsig/DSIGKeyInfoX509.hpp>
   #include <xsec/framework/XSECException.hpp>
   #include <xsec/utils/XSECDOMUtils.hpp>
  +#include <xsec/enc/XSECCryptoException.hpp>
   
   #if defined(_WIN32)
   #    include <xsec/utils/winutils/XSECURIResolverGenericWin32.hpp>
  @@ -1253,6 +1254,13 @@
                delete m;
                errorsOccured = true;
                exit (1);
  +     }
  +
  +     catch (XSECCryptoException &e) {
  +             cerr << "A cryptographic error occured during signature 
operation\n   Message: "
  +             << e.getMsg() << endl;
  +             errorsOccured = true;
  +             exit(1);
        }
   
        catch (NetAccessorException) {
  
  
  

Reply via email to