<div dir="ltr"><div><div><div>Hello,<br><br></div>I'm new to xmlsec.<br></div><div><br>I'm trying to sign a xml using nss engine.<br><br></div>I'm using the code base of the example "sign a xml with 509 certificate (<a href="https://www.aleksey.com/xmlsec/api/xmlsec-examples-sign-x509.html">https://www.aleksey.com/xmlsec/api/xmlsec-examples-sign-x509.html</a>)" <br>with some changes:<br><br><ul><li>The initialization code include the required initialization code for the nss engine;</li><li>For the steps of loading the private key and certificate, i replaced the generic functions "xmlSecCryptoAppKeyLoad" and "xmlSecCryptoAppKeyCertLoad" with the "xmlSecNssAppKeyLoadSECItem" and "xmlSecNssAppKeyCertLoadSECItem" (my application already has a reference to a CERTCertificate object at the time of the document signing).  <br></li></ul><p>All the steps <span lang="en">are performed successfully.</span></p><p>The error occurs when executing the function "xmlSecDSigCtxSign". I get function result of -1 and the error reporting bellow:<br></p><p>file: xmldsig.c<br>line: 871<br>func: xmlSecDSigCtxProcessKeyInfoNode<br>errorObject: <br>errorSubject: <br>reason: 45<br>msg:  <br>-------------------------------<br>file: xmldsig.c<br>line: 565<br>func: xmlSecDSigCtxProcessSignatureNode<br>errorObject: <br>errorSubject: xmlSecDSigCtxProcessKeyInfoNode<br>reason: 1<br>msg:  <br>-------------------------------<br>file: xmldsig.c<br>line: 303<br>func: xmlSecDSigCtxSign<br>errorObject: <br>errorSubject: xmlSecDSigCtxSignatureProcessNode<br>reason: 1<br>msg:  <br>-------------------------------</p><p><br></p><pre class="" id="tw-target-text" style="text-align:left;height:72px"><span lang="en">What may be the cause of the error?<br>Best regards<br></span></pre><p><br></p><p><br></p><p><span lang="en"></span></p></div></div>