Use .NET SDK on Linux

I want to use .NET SDK on linux, because I will send the invoices for multilple merchants, so that I used the .NET SDK not JAVA.

But I’m facing an issue when run the DLL file, I’m using 3.3.8 version:

$ dotnet /zatca-einvoicing-sdk-238-R3.3.8/Lib/Dot-Net8/Test/fatooraNet.dll sign -invoice “399999999900003_20241203T113812_2024-12-03-1082.xml” -privateKey “PrivateKey.pem” -certificate “cert.pem” -signedInvoice “signed_399999999900003_20241203T113812_2024-12-03-1082.xml”
********************* Welcome to ZATCA E-Invoice .Net SDK 3.3.8 *********************
This App uses .Net to call the SDK passing it an invoice XML file.
It can take a Standard or Simplified XML, Credit Note, or Debit Note.
It returns if the validation is successful or shows errors where the XML validation fails.
It checks for syntax and content as well.
You can use the command (fatooraNet -help) for more information.
You can use the command (fatooraNet {Command} -help) for instructions on how to use the command and expected arguments.


Operation Failed
Step: [Generate EInvoice Hash] [Failed]
Errors: [Error] Generating EInvoice Hash
Step: [Generate Signature] [Failed]
Errors: [Error] Generating EInvoice Signature
Step: [Parse Certificate] [Failed]
Errors: [Error] Parsing EInvoice Certificate
Step: [Transform Xml Result] [Failed]
Errors: [Error] Transforming Xml Result
Step: [Populate Signed Signature Properties] [Failed]
Errors: [Error] Populating Signed Signature Properties
Step: [Populate UBL Extensions] [Failed]
Errors: [Error] Populating UBL Extensions
Step: [Generate EInvoice QR] [Failed]
Errors: [Error] Generating EInvoice QR Code
Step: [Finalize Sign Document] [Failed]
Errors: [Error] Finalizing Sign Document

Dear @ucitco

Thanks for reaching out, welcome to our community.

Can I kindly ask you to share all the steps that you are followed, and If you provide screen shout this will be helpful for our investigation, to provide a comprehensive support as usual.

Thanks,
Ibrahem Daoud.

Hi,

First, thank you!

yes sure, here are the steps:
1- create CSR:
env(“ZATCA_SDK”) . " csr -csrConfig "$configPath" -privateKey "$privateKey" -generatedCsr "$csrPath""

2- send the otp and csr to /compliance
and get the result and store it

3- send the complience_request_id with secret and security token to /production/csids
get the result and store it inside cert.pem

4- create the XML from invoice and try to sign it using
env(“ZATCA_SDK”) . " sign -invoice "$xmlInvoicePath" -privateKey "$privateKey" -certificate "$certificate" -signedInvoice "$signedInvoice""

everything is working locally (windows) with .exe but in the server (linux) with dll the error appers

Dear @ucitco

Can I kindly ask you to reach out to your RM and share the full concerns with screenshot via below SP mail, to have better investigations and schedule meeting if needed?

SP mail: sp_support@zatca.gov.sa

Thanks,
Ibrahem Daoud.

We do not have RM right now, can you advice?

We have online solution, and we have already customers in KSA who are using our system for phase 1 and we want to prepare our system to comply with ZATCA phase 2 for their future needs.
Kindly advice.

Dear @ucitco

Well, As you mentioned previously that it work in windows, are you followed the exact same steps?

One more thing, Did you execute the install.net.sh inside SDK (zatca-einvoicing-sdk-238-R3.3.8\Lib\Dot-Net8)
Additionally, what is the exact command that you are using to sign the invoice?

Thanks,
Ibrahem Daoud.

Yes, the same steps on linux and windows.

yes, I installed it and the same thing.

dotnet zatca-einvoicing-sdk-238-R3.3.8/Lib/Dot-Net8/Test/fatooraNet.dll sign -invoice “399999999900003_20241203T143051_2024-12-03-1085.xml” -privateKey “PrivateKey.pem” -certificate “cert.pem” -signedInvoice “signed_399999999900003_20241203T143051_2024-12-03-1085.xml”

attached the files:

If it’s suitable and more easier to have a meeting, we can have a meeting when you are free.

Thank you so much!

Dear @ucitco

Can you try the below command to sign the invoice:

fatooranet sign -invoice “invoice.xml”

Additionally, ensure that you are using the command from the same directory where your invoice saved, and you have your PCSID token decoded base64 in the cert.pem file inside the SDK.

Are you solution provider?

Thanks,
Ibrahem Daoud.

Dear @idaoud ,

I tried with fatooraNet command it’s not working the command not found.

But I tried with this:
dotnet /home/server/zatca-einvoicing-sdk-238-R3.3.8/Lib/Dot-Net8/Test/fatooraNet.dll sign -invoice “Simplified_Invoice.xml” -certificate …/…/…/Certificates/cert.pem -privateKey …/…/…/Certificates/ec-secp256k1-priv-key.pem

Operation Failed
Step: [Generate EInvoice Hash] [Failed]
Errors: [Error] Generating EInvoice Hash
Step: [Generate Signature] [Failed]
Errors: [Error] Generating EInvoice Signature
Step: [Parse Certificate] [Failed]
Errors: [Error] Parsing EInvoice Certificate
Step: [Transform Xml Result] [Failed]
Errors: [Error] Transforming Xml Result
Step: [Populate Signed Signature Properties] [Failed]
Errors: [Error] Populating Signed Signature Properties
Step: [Populate UBL Extensions] [Failed]
Errors: [Error] Populating UBL Extensions
Step: [Generate EInvoice QR] [Failed]
Errors: [Error] Generating EInvoice QR Code
Step: [Finalize Sign Document] [Failed]
Errors: [Error] Finalizing Sign Document

Are you solution provider? Yes

Thank you so much!

Dear @idaoud

Kindly, is there any update here?

Regards

Dear @ucitco

Thanks for reaching out,

Can I kindly ask you to share your full concerns via SP support mail that shared previously in this post, to schedule meeting if needed?

Thanks,
Ibrahem Daoud.

Dear @idaoud ,

Thank you, sure I will share it.

Regards