.net core sdk in linux(AWS ec2 ubuntu)

Hi Team,

Kindly confirm the latest sdk will work on linux deployments(.net core - AWS ec2-ubuntu), I am getting the following errors, but the same code works in windows.

[Error] Generating EInvoice Hash[Error] Generating EInvoice Signature[Error] Transforming Xml Result[Error] Populating Signed Signature Properties[Error] Populating UBL Extensions[Error] Generating EInvoice QR Code[Error] Finalizing Sign Document[Error] Generating EInvoice Hash

Please share your thoughts thanks

Morning @mohan_manakkal

Thanks for reaching out,

To provide comprehensive support as usual, can I kindly ask you to elaborate more on your concern, mentioning the exact steps you followed and what SDK version you are using?

Thanks,
Ibrahem Daoud.

Goodmorning @idaoud ,

I am using zatca-einvoicing-sdk-DotNet-238-R3.4.6 sdk for E invoice signing in ubutu machine.
I created sandboax certificate , private key then I try to sign using the following code:

			string xmlPath = Path.Combine(Directory.GetCurrentDirectory(), "Zatca/invoice.xml");
            string certificatePath = Path.Combine(Directory.GetCurrentDirectory(), "Zatca/certificate.txt");
            string privateKeyPath = Path.Combine(Directory.GetCurrentDirectory(), "Zatca/privatekey.txt");
           
            IEInvoiceQRGenerator qr = new EInvoiceQRGenerator();
            IEInvoiceSigner sign = new EInvoiceSigner();
            IEInvoiceHashGenerator eInvoiceHashGenerator = new EInvoiceHashGenerator();
            XmlDocument doc = new XmlDocument();
            if (!System.IO.File.Exists(xmlPath))
                return xmlPath + " Input xml not found.";
            if (!System.IO.File.Exists(certificatePath))
                return certificatePath + " certificatePath not found.";
            doc.Load(xmlPath);
            
            string certificateContent = System.IO.File.ReadAllText(certificatePath);
            string privateKeyContent = System.IO.File.ReadAllText(privateKeyPath);
            
            HashResult hr = eInvoiceHashGenerator.GenerateEInvoiceHashing(doc);
            SignResult sg = sign.SignDocument(doc, certificateContent, privateKeyContent);
            QRResult InvoiceQR = qr.GenerateEInvoiceQRCode(sg.SignedEInvoice);
            XmlDocument xmlSigned = sg.SignedEInvoice;
            string error = sg.ErrorMessage;
            
            string folderPath = Path.Combine(Directory.GetCurrentDirectory(), "SignedInvoices");
            Directory.CreateDirectory(folderPath);
            sg.SaveSignedEInvoice(folderPath + "/SignedEInvoice.xml");

included the following namespaces

using ZATCA.EInvoice.SDK;
using ZATCA.EInvoice.SDK.Contracts.Models;
using ZATCA.EInvoice.SDK.Contracts;

Thanks

Dear @mohan_manakkal

Thank you for your collaboration. Please note that the sandbox is intended only to clarify the onboarding steps. You can not successfully integrate using Sandbox.

The successful integration can be in the simulation or production environments. After your PCSID is received, it will contain “BinaryToken and Secret”. After that, you need to decode base64 the BinaryToken and replace it in the SDK following this path “zatca-einvoicing-sdk-DotNet-238-R3.4.6\Data\Certificates”. Replace the content of the “cert.pem” file with your own PCSID (Decoded BinaryToken), knowing that when you sign your XML, you must use your PCSID and PrivateKey, that generated along with your CSR. In the same directory, you also need to replace the content of “ec-secp256k1-priv-key.pem” with your own Private key, as mentioned, the same one generated with your CSR.

After following the above steps, you need to sign your B2C invoices using this command (fatooranet sign -invoice “yourInvoice.xml” )
The result will be a New XML signed with your certificate.

When validating the signed XML using the command (fatooranet validate -invoice “yourSignedXML.xml”), if the XML does not contain any Business rule violations, then the result should be passed.

I hope it’s clear enough now.

Thanks,
Ibrahem Daoud.

Sorry still I didnt get you, what I am asking is about the code i pasted above, it works on windows correctly get the signed invoice but the same code in linux i am getting the error -

[Error] Generating EInvoice Hash[Error] Generating EInvoice Signature[Error] Transforming Xml Result[Error] Populating Signed Signature Properties[Error] Populating UBL Extensions[Error] Generating EInvoice QR Code[Error] Finalizing Sign Document[Error] Generating EInvoice Hash

Issue resolved. On Linux, the file system is case-sensitive, so the schematrons folder should be renamed to Schematrons. In the ZATCA SDK, it is currently using lowercase letters, as shown in the second figure.