<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Make sure you have the right key for the crypto algorithm used in
the template.<br>
<br>
BTW, your signature makes no sense for a public mailing list<br>
<br>
Aleksey<br>
<br>
On 2/28/11 7:30 PM, Cartland, Bruce wrote:
<blockquote
cite="mid:FB58E6A08940744C972AA8DF8D3933830849AF5E@CBR07M100PCA1.prod.atonet.gov.au"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="MS Exchange Server version
6.5.7651.53">
<title>Signing works in command line tool but not in code?
[SEC=UNCLASSIFIED]</title>
<!-- Converted from text/rtf format -->
<br>
<p><font face="Arial" size="2">I am using the command line tool to
successfully sign a template file. A dotnet soap service
successfully processes the sign.xml file. </font></p>
<p> <font face="Arial" size="2">xmlsec --sign
--print-debug --privkey-der pk.der --output sign.xml
vstsout.xml</font>
</p>
<p><font face="Arial" size="2">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?</font></p>
<p> <font face="Arial" size="2">doc =</font> <font
face="Courier New" size="2">xmlParseFile("</font><font
face="Arial" size="2">vstsout.xml");</font>
<br>
<font face="Courier New" size="2">node =
xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature,
xmlSecDSigNs);</font>
<br>
<font face="Courier New" size="2"> dsigCtx =
xmlSecDSigCtxCreate(NULL);</font>
<br>
<font face="Courier New" size="2"> dsigCtx->signKey =
xmlSecCryptoAppKeyLoad("pk.der", xmlSecKeyDataFormatDer, NULL,
NULL, NULL);</font>
<br>
<font face="Courier New" size="2">
xmlSecKeySetName(dsigCtx->signKey, BAD_CAST "pk-der");</font>
</p>
<p><font face="Courier New" size="2">
xmlSecDSigCtxSign(dsigCtx, node);
<<<<<<-------- the signature fails</font>
</p>
<p><font face="Arial" size="2">Thanks muchly</font>
<br>
<font face="Arial" size="2">Bruce</font> </p>
<br>
</blockquote>
</body>
</html>