<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=iso-8859-1"><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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 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.EstilCorreuElectrnic17
        {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 3.0cm 70.85pt 3.0cm;}
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=CA link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=EN-GB>Hi,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>I’m trying to digitally sign a XML with MsCrypto and I get the following error when calling xmlSecTmplSignatureCreate.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>signNode = xmlSecTmplSignatureCreate(</span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:gray;background:white;mso-highlight:white'>xmlDoc</span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>, </span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:#6F008A;background:white;mso-highlight:white'>xmlSecTransformExclC14NId</span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>, </span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:#6F008A;background:white;mso-highlight:white'>xmlSecTransformRsaSha256Id</span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>, </span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:#6F008A;background:white;mso-highlight:white'>NULL</span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>);</span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>func=xmlSecTransformNodeRead:file=\xmlsec\src\transforms.c:line=1307:obj=unknown:subj=xmlSecTransformIdListFindByHref:error=1:xmlsec library function failed:href=http://www.w3.org/2001/04/xmldsig-more#rsa-sha256<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>func=xmlSecTransformCtxNodeRead:file=xmlsec\src\transforms.c :line=588:obj=DigestMethod:subj=xmlSecTransformNodeRead:error=1:xmlsec library function failed: <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>func=xmlSecDSigReferenceCtxProcessNode:file=\llibreries\xmlsec\src\xmldsig.c:line=1350:obj=DigestMethod:subj=xmlSecTransformCtxNodeRead:error=1:xmlsec library function failed: <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>func=xmlSecDSigCtxProcessReferences:file=\xmlsec\src\xmldsig.c:line=750:obj=Reference:subj=xmlSecDSigReferenceCtxProcessNode:error=1:xmlsec library function failed: <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>func=xmlSecDSigCtxProcessSignatureNode:file=\xmlsec\src\xmldsig.c:line=512:obj=unknown:subj=xmlSecDSigCtxProcessReferences:error=1:xmlsec library function failed: <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>func=xmlSecDSigCtxSign:file=\xmlsec\src\xmldsig.c:line=286:obj=unknown:subj=xmlSecDSigCtxSignatureProcessNode:error=1:xmlsec library function failed:</span><span lang=EN-GB><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>If I use the </span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:#6F008A;background:white;mso-highlight:white'>xmlSecTransformRsaSha1Id</span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:#6F008A'> </span><span lang=EN-GB>transform it works correct.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>signNode = xmlSecTmplSignatureCreate(</span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:gray;background:white;mso-highlight:white'>xmlDoc</span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>, </span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:#6F008A;background:white;mso-highlight:white'>xmlSecTransformExclC14NId</span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>, </span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:#6F008A;background:white;mso-highlight:white'>xmlSecTransformRsaSha1Id</span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>, </span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:#6F008A;background:white;mso-highlight:white'>NULL</span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>);</span><span lang=EN-GB style='font-size:9.5pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>I’m using latest sources from github and XmlSec is compiled with XMLSEC_MSCRYPTO_NT4=1. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>I need to use this compile flag because if it’s not used, when I sign with a smart card certificate it fails. Otherwise with a certificate in “My” system store it works.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>Here the error log when not compiled with the mentioned flag. Thrown when I call </span><span style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>xmlSecDSigCtxSign</span><span style='font-size:9.5pt;font-family:Consolas;color:black'>.</span><span lang=EN-GB><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>func=xmlSecMSCryptoKeyDataCtxDuplicateKey:file=\xmlsec\src\mscrypto\certkeys.c:line=191:obj=unknown:subj=CryptDuplicateKey:error=4:crypto library function failed:MSCrypto error: 120: 0x00000078: </span><strong><span style='font-family:"Calibri",sans-serif'>ERROR_CALL_NOT_IMPLEMENTED</span></strong><span style='font-size:9.5pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-GB>Or with another card.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>func=xmlSecMSCryptoKeyDataCtxDuplicateKey:file=\xmlsec\src\mscrypto\certkeys.c:line=191:obj=unknown:subj=CryptDuplicateKey:error=4:crypto library function failed:MSCrypto error: 87: 0x00000057: </span><strong><span style='font-family:"Calibri",sans-serif'>ERROR_INVALID_PARAMETER</span></strong><span lang=EN-GB><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>Any idea?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>Thank you.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-GB style='font-size:10.0pt;color:#1F497D;mso-fareast-language:CA'>Xavier Portell </span></b><span lang=EN-GB><o:p></o:p></span></p></div></body></html>