[xmlsec] Signing works in command line tool but not in code? [SEC=UNCLASSIFIED]

Cartland, Bruce Bruce.Cartland at ato.gov.au
Mon Feb 28 19:30:31 PST 2011

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

Thanks muchly

	The information transmitted is for the use of the intended
recipient only and may contain confidential and/or legally
privileged material. Any review, re-transmission, disclosure,
dissemination or other use of, or taking of any action in
reliance upon, this information by persons or entities other
than the intended recipient is prohibited and may result in
severe penalties. If you have received this e-mail in error
please notify the Privacy Hotline of the Australian Taxation
Office, telephone 13 2869 and delete all copies of this
transmission together with any attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aleksey.com/pipermail/xmlsec/attachments/20110301/0bfd2fd6/attachment.html>

More information about the xmlsec mailing list