The SDK 3.4.3 still does not support Linux

@Ankit.K.Tiwari

Dear support,

We are still encountering an issue with the SDK when using .NET Core 8 in a Linux environment. It appears that the SDK still does not support Linux, and we are receiving the following error:

[ERR] Error Messages: [Error] Parsing EInvoice Certificate
[ERR] Exception: ASN1 corrupted data.
[ERR] Inner Exception: System.Formats.Asn1.AsnContentException: The provided data is tagged with ‘Application’ class value ‘13’, but it should have been ‘Universal’ class value ‘16’.
at System.Formats.Asn1.AsnDecoder.CheckExpectedTag(Asn1Tag tag, Asn1Tag expectedTag, UniversalTagNumber tagNumber)
at System.Formats.Asn1.AsnDecoder.ReadSequence(ReadOnlySpan1 source, AsnEncodingRules ruleSet, Int32& contentOffset, Int32& contentLength, Int32& bytesConsumed, Nullable1 expectedTag)
at System.Formats.Asn1.AsnValueReader.ReadSequence(Nullable1 expectedTag) at System.Security.Cryptography.Asn1.Pkcs12.PfxAsn.DecodeCore(AsnValueReader& reader, Asn1Tag expectedTag, ReadOnlyMemory1 rebind, PfxAsn& decoded)
at System.Security.Cryptography.Asn1.Pkcs12.PfxAsn.Decode(AsnValueReader& reader, Asn1Tag expectedTag, ReadOnlyMemory`1 rebind, PfxAsn& decoded)

We would appreciate your guidance on how to resolve this issue or whether there is a workaround or updated version of the SDK that supports Linux environments under .NET 8.

Thank you for your support.

Dear @Ammar

Thanks for reaching out. It’s good to see your posts again.

Kindly note that it’s a known issue, and our team is currently working on it.

Will inform you once it is resolved.

Thanks for your understanding.

Ibrahem Daoud.

Hi @idaoud . Thank you for information. Do you have any timeline of fixing this issue?

Morning @Ammar @gaji

Kindly check and confirm if the issue is resolved, please ensure to download latest SDK version which is 3.4.5 kindly find the link Zatca

Thanks,
Ibrahem Daoud.

Hi @idaoud We checked but still recieve the error.

We receive this error in Linux:

We receive a positive response to the same action in Windows.

Hi @idaoud

It’s working with me in the version 3.4.6. Thank you for support.

Hello @idaoud

We suffer from the same issue on version 3.4.6, when we run the sdk from widnows it works as expected, when we run it from linux it fails

Hi @m.abumusa

I thing the issue you are facing related the schematrons you must be add to your application and be sure the application will copy when you build your application.

Hi Ammar,

I am using fatoora.dll from the cli, using the samples provided in the sdk

I am calling the sdk like this

dotnet fatoora.dll

I am not integrating it with my app yet

Hi @m.abumusa

Can you share your log if there are any log file.

Here is the complete log

dotnet fatooraNet.dll csr -sim -csrConfig ../Data/csr-config-example-EN-VAT-group.properties -generatedCsr ../Data/csr.csr -privateKey ../Data/key.key

********************* Welcome to ZATCA E-Invoice .Net SDK 3.4.6 *********************

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 Completed Successfully!

Step: [Validate CSR Properties] [Success]

Step: [Generate  CSR String] [Success]

Step: [Generate EC Private Key String] [Success]



 dotnet  fatooraNet.dll sign -invoice ../Data/unsigned_invoice.xml -signedInvoice ../Data/signed.xml -certificate ../Data/csr.csr -privateKey ../Data/key.key 

********************* Welcome to ZATCA E-Invoice .Net SDK 3.4.6 *********************

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

abumusa@abumusa-laptop:~/Desktop/sdk-238-R3.4.6/Test$ dotnet --version
8.0.415
abumusa@abumusa-laptop:~/Desktop/sdk-238-R3.4.6/Test$ 

This is the unsigned_invoice.xml

<?xml version="1.0"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
 <ext:UBLExtensions>
  <ext:UBLExtension>
   <ext:ExtensionURI>urn:oasis:names:specification:ubl:dsig:enveloped:xades</ext:ExtensionURI>
   <ext:ExtensionContent>
    <x1:UBLDocumentSignatures xmlns:x1="urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2">
     <x2:SignatureInformation xmlns:x2="urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2">
      <cbc:ID>urn:oasis:names:specification:ubl:signature:1</cbc:ID>
      <x3:ReferencedSignatureID xmlns:x3="urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2">urn:oasis:names:specification:ubl:signature:Invoice</x3:ReferencedSignatureID>
     </x2:SignatureInformation>
    </x1:UBLDocumentSignatures>
   </ext:ExtensionContent>
  </ext:UBLExtension>
 </ext:UBLExtensions>
 <cbc:ProfileID>reporting:1.0</cbc:ProfileID>
 <cbc:ID>SME00023</cbc:ID>
 <cbc:UUID>3cf5ee18-ee25-44ea-a444-2c37ba7f28be</cbc:UUID>
 <cbc:IssueDate>2025-02-14</cbc:IssueDate>
 <cbc:IssueTime>12:13:20</cbc:IssueTime>
 <cbc:InvoiceTypeCode name="0100000">388</cbc:InvoiceTypeCode>
 <cbc:Note languageID="ar">sss</cbc:Note>
 <cbc:DocumentCurrencyCode>SAR</cbc:DocumentCurrencyCode>
 <cbc:TaxCurrencyCode>SAR</cbc:TaxCurrencyCode>
 <cac:BillingReference>
  <cac:InvoiceDocumentReference>
   <cbc:ID>SME00023</cbc:ID>
  </cac:InvoiceDocumentReference>
 </cac:BillingReference>
 <cac:AdditionalDocumentReference>
  <cbc:ID>ICV</cbc:ID>
  <cbc:UUID>23</cbc:UUID>
 </cac:AdditionalDocumentReference>
 <cac:AdditionalDocumentReference>
  <cbc:ID>PIH</cbc:ID>
  <cac:Attachment>
   <cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain" filename="base64">NWZlY2ViNjZmZmM4NmYzOGQ5NTI3ODZjNmQ2OTZjNzljMmRiYzIzOWRkNGU5MWI0NjcyOWQ3M2EyN2ZiNTdlOQ==</cbc:EmbeddedDocumentBinaryObject>
  </cac:Attachment>
 </cac:AdditionalDocumentReference>
 <cac:AdditionalDocumentReference>
  <cbc:ID>QR</cbc:ID>
 </cac:AdditionalDocumentReference>
 <cac:Signature>
  <cbc:ID>urn:oasis:names:specification:ubl:signature:Invoice</cbc:ID>
  <cbc:SignatureMethod>urn:oasis:names:specification:ubl:dsig:enveloped:xades</cbc:SignatureMethod>
 </cac:Signature>
 <cac:AccountingSupplierParty>
  <cac:Party>
   <cac:PartyIdentification>
    <cbc:ID schemeID="CRN">311111111111113</cbc:ID>
   </cac:PartyIdentification>
   <cac:PostalAddress>
    <cbc:StreetName>الامير سلطان</cbc:StreetName>
    <cbc:BuildingNumber>2322</cbc:BuildingNumber>
    <cbc:PlotIdentification>2223</cbc:PlotIdentification>
    <cbc:CitySubdivisionName>الرياض</cbc:CitySubdivisionName>
    <cbc:CityName>الرياض | Riyadh</cbc:CityName>
    <cbc:PostalZone>23333</cbc:PostalZone>
    <cac:Country>
     <cbc:IdentificationCode>SA</cbc:IdentificationCode>
    </cac:Country>
   </cac:PostalAddress>
   <cac:PartyTaxScheme>
    <cbc:CompanyID>311111111101113</cbc:CompanyID>
    <cac:TaxScheme>
     <cbc:ID>VAT</cbc:ID>
    </cac:TaxScheme>
   </cac:PartyTaxScheme>
   <cac:PartyLegalEntity>
    <cbc:RegistrationName>Acme Widget’s LTD</cbc:RegistrationName>
   </cac:PartyLegalEntity>
  </cac:Party>
 </cac:AccountingSupplierParty>
 <cac:AccountingCustomerParty>
  <cac:Party>
   <cac:PartyIdentification>
    <cbc:ID schemeID="NAT">311111111111113</cbc:ID>
   </cac:PartyIdentification>
   <cac:PostalAddress>
    <cbc:StreetName>الامير سلطان</cbc:StreetName>
    <cbc:BuildingNumber>2322</cbc:BuildingNumber>
    <cbc:PlotIdentification>2223</cbc:PlotIdentification>
    <cbc:CitySubdivisionName>الرياض</cbc:CitySubdivisionName>
    <cbc:CityName>الرياض | Riyadh</cbc:CityName>
    <cbc:PostalZone>23333</cbc:PostalZone>
    <cac:Country>
     <cbc:IdentificationCode>SA</cbc:IdentificationCode>
    </cac:Country>
   </cac:PostalAddress>
   <cac:PartyTaxScheme>
    <cac:TaxScheme>
     <cbc:ID>VAT</cbc:ID>
    </cac:TaxScheme>
   </cac:PartyTaxScheme>
   <cac:PartyLegalEntity>
    <cbc:RegistrationName>Acme Widget’s LTD</cbc:RegistrationName>
   </cac:PartyLegalEntity>
  </cac:Party>
 </cac:AccountingCustomerParty>
 <cac:Delivery>
  <cbc:ActualDeliveryDate>2022-09-07</cbc:ActualDeliveryDate>
 </cac:Delivery>
 <cac:PaymentMeans>
  <cbc:PaymentMeansCode>10</cbc:PaymentMeansCode>
 </cac:PaymentMeans>
 <cac:AllowanceCharge>
  <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
  <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
  <cbc:Amount currencyID="SAR">0.00</cbc:Amount>
  <cac:TaxCategory>
   <cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
   <cbc:Percent>15</cbc:Percent>
   <cac:TaxScheme>
    <cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
   </cac:TaxScheme>
  </cac:TaxCategory>
 </cac:AllowanceCharge>
 <cac:TaxTotal>
  <cbc:TaxAmount currencyID="SAR">0.6</cbc:TaxAmount>
 </cac:TaxTotal>
 <cac:TaxTotal>
  <cbc:TaxAmount currencyID="SAR">0.60</cbc:TaxAmount>
  <cac:TaxSubtotal>
   <cbc:TaxableAmount currencyID="SAR">4.00</cbc:TaxableAmount>
   <cbc:TaxAmount currencyID="SAR">0.60</cbc:TaxAmount>
   <cac:TaxCategory>
    <cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
    <cbc:Percent>15</cbc:Percent>
    <cac:TaxScheme>
     <cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
    </cac:TaxScheme>
   </cac:TaxCategory>
  </cac:TaxSubtotal>
 </cac:TaxTotal>
 <cac:LegalMonetaryTotal>
  <cbc:LineExtensionAmount currencyID="SAR">4.00</cbc:LineExtensionAmount>
  <cbc:TaxExclusiveAmount currencyID="SAR">4.00</cbc:TaxExclusiveAmount>
  <cbc:TaxInclusiveAmount currencyID="SAR">4.60</cbc:TaxInclusiveAmount>
  <cbc:AllowanceTotalAmount currencyID="SAR">0.00</cbc:AllowanceTotalAmount>
  <cbc:ChargeTotalAmount currencyID="SAR">0.00</cbc:ChargeTotalAmount>
  <cbc:PrepaidAmount currencyID="SAR">0.00</cbc:PrepaidAmount>
  <cbc:PayableAmount currencyID="SAR">4.60</cbc:PayableAmount>
 </cac:LegalMonetaryTotal>
 <cac:InvoiceLine>
  <cbc:ID>1</cbc:ID>
  <cbc:InvoicedQuantity unitCode="PCE">2.000000</cbc:InvoicedQuantity>
  <cbc:LineExtensionAmount currencyID="SAR">4.00</cbc:LineExtensionAmount>
  <cac:TaxTotal>
   <cbc:TaxAmount currencyID="SAR">0.60</cbc:TaxAmount>
   <cbc:RoundingAmount currencyID="SAR">4.60</cbc:RoundingAmount>
  </cac:TaxTotal>
  <cac:Item>
   <cbc:Name>قلم رصاص</cbc:Name>
   <cac:ClassifiedTaxCategory>
    <cbc:ID>S</cbc:ID>
    <cbc:Percent>15.00</cbc:Percent>
    <cac:TaxScheme>
     <cbc:ID>VAT</cbc:ID>
    </cac:TaxScheme>
   </cac:ClassifiedTaxCategory>
  </cac:Item>
  <cac:Price>
   <cbc:PriceAmount currencyID="SAR">2.0000</cbc:PriceAmount>
  </cac:Price>
 </cac:InvoiceLine>
</Invoice>

Hi @m.abumusa

Try copying the schematrons files inside the folder Data\Rules and placing them in the same folder where the DLL is located like below screenshot and let me know what happened with you. Because we was facing issue with the schematrons in the direct integrated with the SDK and I think your issue related that.

I do not think this is the issue, I specified the files in the passed parameters. anyways I moved the Data folder inside the same folder as the dll but the issue persist.

If you want you can join me in a quick call to see how I execute the commands

abumusa@abumusa-laptop:~/Desktop/sdk-238-R3.4.6/Test$ ls
BouncyCastle.Crypto.dll        ja					      System.Security.Cryptography.Pkcs.dll
cs			       Kajabity.Tools.Java.dll			      System.Security.Cryptography.ProtectedData.dll
Data			       key.pem					      System.Security.Cryptography.Xml.dll
de			       ko					      tr
es			       Microsoft.Extensions.DependencyModel.dll       version.txt
fatooraNet.deps.json	       Newtonsoft.Json.dll			      xerces.dll
fatooraNet.dll		       pl					      xerces.pdb
fatooraNet.dll.config	       pt-BR					      ZATCA.EInvoice.SDK.Contracts.dll
fatooraNet.exe		       ru					      ZATCA.EInvoice.SDK.Contracts.pdb
fatooraNet.pdb		       runtimes					      ZATCA.EInvoice.SDK.dll
fatooraNet.runtimeconfig.json  saxon.dll				      ZATCA.EInvoice.SDK.pdb
fr			       saxon.pdb				      ZATCA.EInvoice.SDK.Saxon.dll
ikvm			       System.CommandLine.dll			      ZATCA.EInvoice.SDK.Saxon.pdb
IKVM.ByteCode.dll	       System.Configuration.ConfigurationManager.dll  zh-Hans
ikvm.properties		       System.Data.Odbc.dll			      zh-Hant
invoice1.xml		       System.Diagnostics.EventLog.dll
it			       System.IO.Pipelines.dll
abumusa@abumusa-laptop:~/Desktop/sdk-238-R3.4.6/Test$  dotnet  fatooraNet.dll sign -invoice Data/unsigned_invoice.xml -signedInvoice Data/signed.xml -certificate Data/csr.csr -privateKey Data/key.key 
********************* Welcome to ZATCA E-Invoice .Net SDK 3.4.6 *********************
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
abumusa@abumusa-laptop:~/Desktop/sdk-238-R3.4.6/Test$ 


Hello @idaoud

Any update on this?