Zatca SDK Cmdline and .NET library method generating different invoiceHash Digest value

I am developing a .Net application to onboard Invoices to ZATCA using SDK’s .Net library in step of Signing Standard invoice I am using following commands/methods

.Net method:
eInvoiceSigner.SignDocument(eInvoice, certificateContent, privateKeyContent).SaveSignedEInvoice(xmlFilePath)

CLI : fatoora -sign -qr -invoice .\Standard_Invoice_.xml -signed .\Standard_Signed.xml

both generates SignedXML file corrected with EInvoice Hash,Signature,Hash and ParseCertificate embeded in xml file but the invoiceHash in DigestValue of CLI generated file is valid and gives 200 status on compliance check . whereas .Net method generated invoice throws Error:The invoice hash API body does not match the (calculated) Hash of the XML . both are same XML files not even single word is modified.

Possibile issue is .NET eInvoiceSigner.SignDocument(eInvoice, certificateContent, privateKeyContent).SaveSignedEInvoice(xmlFilePath) method is using Windows Line endings (CR ,LF) or ((\r\n) and encoding=“utf-8”? while CLI fatoora cmd uses Linux Line endings (LF,\n) and encoding=“UTF-8”? (its capital) these are the only changes but I can assure you in my input file I am sending it with “UTF-8” and “\n” only

Anyone who is able to use .Net Library correctly to generate signed invoice which passes compliance check please help me

Hi,
Here are possible issues,

  1. XML having extra tags which SDK is managing but .NET is not so better to remove all extra tags like QR etc as per XML required format/tags.
  2. Both not having same certificate keys.
  3. There are special characters in your data which SDK is removing but .NET not removing hence hash will be different.
    Thanks

I am facing the same issue. What I did is using an older version of SDK and it worked fine for me. If you solved this in another way please share.

hi Ebrahim
which older version of SDK you use, ?
i am also having the same error with .net SDK

Hi, I am using 3.2.6

https://sadzit.sharepoint.com/ZATCA%20Library/Forms/AllItems.aspx?id=%2FZATCA%20Library%2FOCT%202023%2F10-04-2023%2Fzatca-einvoicing-sdk-238-R3.2.6.rar&parent=%2FZATCA%20Library%2FOCT%202023%2F10-04-2023&p=true&ga=1