The cryptographic stamp (digital signature)
An ECDSA signature in XAdES form over the document hash and signing properties, made with a registered device key and a ZATCA-issued certificate.
The stamp proves two things: the document came from a device its owner registered with ZATCA, and it has not changed since. Hashing is SHA-256, signing is ECDSA with a 256-bit key, and the signature is enveloped XAdES at level B-B.
The signature holds two references: the document hash after the transforms, and the hash of the SignedProperties block, which carries the signing time, the certificate digest, its issuer and serial number. SignedInfo is then signed, and the signature and certificate are attached.
A simplified document is stamped by the seller's device before hand-over. A standard document is stamped by ZATCA's platform at clearance; if the seller stamps it too, the platform adds a second stamp. The QR code is excluded from the signature.
ZATCA's texts are not fully aligned: the Security standard's table lists SigningCertificateV2, a signature policy and the full certificate chain, and its illustrative certificate profile says P-256, while the official examples and tools use secp256k1 (the OpenSSL commands in the technical guidelines).
In JooDax
BuiltThe programs stamp with a secp256k1 key (k256) and write the signed-properties block in the exact form ZATCA's validator accepts, with certificate and properties digests as base64 of the hex string. They differ from the Security standard's table in: version-1 SigningCertificate, no signature policy or data-object properties, only the signing certificate attached, and the second reference's Type (xmldsig#SignatureProperties instead of 01903#SignedProperties). Step 5 of the technical guidelines describes the properties hash as base64 of the bytes after removing spaces, whereas the programs hash a block with frozen indentation and encode the hex text. ZATCA's validator accepted this form in the proof phase.
crates/jdx-einvoice-sa/src/xml.rs
Steps
- Compute the document hash (see the invoice hash page).
- Sign the hash with the device private key using ECDSA.
- Compute the certificate digest and fill the signed properties: signing time, digest, issuer and serial number.
- Hash the signed properties.
- Fill UBLExtensions with the signature, certificate and both references, and add cac:Signature and the QR block.
Questions and answers
Does the stamp sign the whole file?
It covers the whole document except the QR block and the stamp block itself.
Related pages
- KSA-15 Cryptographic stamp
- KSA-13 Previous invoice hash (PIH)
- KSA-14 QR code
- BR-KSA-28 · The signature information ID in the stamp must be urn:oasis:names:specification:ubl:signature:1.
- BR-KSA-29 · The referenced signature ID and signature ID must be urn:oasis:names:specification:ubl:signature:Invoice.
- BR-KSA-30 · The signature method must be urn:oasis:names:specification:ubl:dsig:enveloped:xades.
- BR-KSA-60 · The cryptographic stamp is mandatory on simplified documents and their notes.
Related concepts
- The invoice hash: how it is computedA SHA-256 fingerprint of the document after removing the stamp and QR blocks and canonicalizing it, written in base64; the stamp and the chain rest on it.
- Onboarding a device and its CSIDHow an invoicing device obtains its stamping certificate from ZATCA: key, certificate request, OTP, compliance checks, then the production certificate.
- XML canonicalization (C14N 1.1) before hashingTurning XML text into one standard form before hashing, so the same document gives the same fingerprint on every system.
E-invoicing in Saudi Arabia (FATOORA)
Sources
- Security Features Implementation Standards to the E-Invoicing resolution dated 2023-05-19 (v1.2) — ZATCA
- E-invoicing Detailed Technical Guidelines (vVersion 2) — ZATCA
- الضوابط والمتطلبات والمواصفات الفنية والقواعد الإجرائية اللازمة لتنفيذ أحكام لائحة الفوترة الإلكترونية (قرار المحافظ رقم 62738 وتاريخ 1443/11/23هـ) (vfile dated 20230519 (decision 62738)) — ZATCA
- Electronic Invoice XML Implementation Standard to the E-Invoicing resolution dated 2023-05-19 (v1.2) — ZATCA
Checked on: 4 November 2026. What concerns JooDax is taken from the programs’ own code.