<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.E-mailStijl17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=NL link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Hi, I have a piece of XML I would like to sign.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>The commands I use are:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>xmlsec1 sign --privkey-pem key.pem --output signedfile.xml test.xml<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>xmlsec1 --verify signedfile.xml<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>The XML template (test.xml) to be signed is:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><dsig:Signature xmlns:dsig="<a href="http://www.w3.org/2000/09/xmldsig#">http://www.w3.org/2000/09/xmldsig#</a>" Id="Signature001"><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><dsig:SignedInfo><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <dsig:CanonicalizationMethod Algorithm="<a href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">http://www.w3.org/TR/2001/REC-xml-c14n-20010315</a>"></dsig:CanonicalizationMethod><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <dsig:SignatureMethod Algorithm="<a href="http://www.w3.org/2000/09/xmldsig#rsa-sha1">http://www.w3.org/2000/09/xmldsig#rsa-sha1</a>"></dsig:SignatureMethod><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <dsig:Reference URI="#KeyInfo001"><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <dsig:DigestMethod Algorithm="<a href="http://www.w3.org/2000/09/xmldsig#sha1">http://www.w3.org/2000/09/xmldsig#sha1</a>"></dsig:DigestMethod><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <dsig:DigestValue></dsig:DigestValue><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> </dsig:Reference><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <dsig:Reference URI="#Resource1"><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <dsig:DigestMethod Algorithm="<a href="http://www.w3.org/2000/09/xmldsig#sha1">http://www.w3.org/2000/09/xmldsig#sha1</a>"></dsig:DigestMethod><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <dsig:DigestValue></dsig:DigestValue><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> </dsig:Reference><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US></dsig:SignedInfo><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><dsig:SignatureValue></dsig:SignatureValue><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><dsig:KeyInfo Id="KeyInfo001"><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <dsig:KeyValue></dsig:KeyValue><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US></dsig:KeyInfo><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><dsig:Object Id="Resource1">hello world</dsig:Object><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US></dsig:Signature><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>The verification outputs:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>func=xmlSecOpenSSLEvpDigestVerify:file=digests.c:line=229:obj=sha1:subj=unknown:error=12:invalid data:data and digest do not match<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>FAIL<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>SignedInfo References (ok/all): 0/1<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Manifests References (ok/all): 0/0<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Error: failed to verify file "signedfile.xml"<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I don’t understand what I’m doing wrong. It’s something with the C14N I suppose, but what to do about it? </span>Can anyone give me a hint?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks, Peter<o:p></o:p></p></div></body></html>