Make sure you have the right key for the crypto algorithm used in the template.

BTW, your signature makes no sense for a public mailing list

Aleksey

On 2/28/11 7:30 PM, Cartland, Bruce wrote:

I am using the command line tool to successfully sign a template file. A dotnet soap service successfully processes the sign.xml file.

xmlsec --sign --print-debug --privkey-der pk.der --output sign.xml vstsout.xml

I am now trying the same thing in code with exactly the same files but the signature fails. I based this on the sample "sign1.c". However I notice the command line source uses a quite different approach (e.g. a keymanager instance). Before I delve into that, is there anything obviously missing here?

doc = xmlParseFile("vstsout.xml");
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature, xmlSecDSigNs);
      dsigCtx = xmlSecDSigCtxCreate(NULL);
dsigCtx->signKey = xmlSecCryptoAppKeyLoad("pk.der", xmlSecKeyDataFormatDer, NULL, NULL, NULL);
      xmlSecKeySetName(dsigCtx->signKey, BAD_CAST "pk-der");

xmlSecDSigCtxSign(dsigCtx, node); <<<<<<-------- the signature fails

Thanks muchly
Bruce


_______________________________________________
xmlsec mailing list
[email protected]
http://www.aleksey.com/mailman/listinfo/xmlsec

Reply via email to