@Ankit_Tiwari @idaoud @saalotaibi
I am using the zatca.cnf configuration file from the official ZATCA documentation to generate a CSR and request a compliance certificate (PCSID) using the following OpenSSL commands:
zatca.cnf file content
oid_section = OIDs
[OIDs]
certificateTemplateName = 1.3.6.1.4.1.311.20.2
[req]
default_bits = 2048
emailAddress = abccompany@gmail.com
req_extensions = v3_req
x509_extensions = v3_ca
prompt = no
default_md = sha256
req_extensions = req_ext
distinguished_name = dn
[dn]
C = SA
OU = 3001111003
O = ABC COMPANY EST
CN = ABCCOM-1001-20250206-POS01
[v3_req]
basicConstraints = CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment
[req_ext]
certificateTemplateName = ASN1:PRINTABLESTRING:PREZATCA-Code-Signing
subjectAltName = dirName:alt_names
[alt_names]
SN = 1-PQR Private Limited|2-Version 1.0|3-PQR-ABC10001-20250206
UID = 300111100300003
title = 1100
registeredAddress = EMDC1111
businessCategory = Food Stuff
- Generate private key:
openssl ecparam -name secp256k1 -genkey -noout -out privatekey.pem
- Generate CSR:
openssl req -new -sha256 -key privatekey.pem -extensions v3_req -config zatca.cnf -out taxpayer.csr
After obtaining the PCSID, I use it to sign invoices for submission via the ZATCA APIs:
- Compliance API:
https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance
- Invoice Submission API:
https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance/invoices
- Production CSID API:
https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/production/csids
- Reporting API:
https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/invoices/reporting/single
- Clearance API:
https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/invoices/clearance/single
Issue:
Although invoice submission is successful (200 OK with status REPORTED/CLEARED), the ZATCA TestXML tool (https://sandbox.zatca.gov.sa/TestXML
) shows SIGNATURE_ERROR:
- X509IssuerName: wrong X509IssuerName
- X509SerialNumber: wrong X509SerialNumber
The issuer and serial number in my signed invoice are:
<xades:IssuerSerial>
<ds:X509IssuerName>CN=PEZEINVOICESCA2-CA, DC=extgazt, DC=gov, DC=local</ds:X509IssuerName>
<ds:X509SerialNumber>413714254586909904798156159693914687090744894</ds:X509SerialNumber>
</xades:IssuerSerial>
Whereas the ZATCA SDK sample shows:
<xades:IssuerSerial>
<ds:X509IssuerName>CN=PRZEINVOICESCA4-CA, DC=extgazt, DC=gov, DC=local</ds:X509IssuerName>
<ds:X509SerialNumber>379112742831380471835263969587287663520528387</ds:X509SerialNumber>
</xades:IssuerSerial>
Questions:
- Is there an issue with my zatca.cnf file?
- If API responses show no errors, can I proceed with my certificate?
- Why does the TestXML tool flag this as an error?
Would appreciate any insights!