Dear Support Team,
I am facing a ZATCA Phase 2 e-invoicing validation issue related to XML digital signature and signed properties hashing, and I need guidance on how to correct it.
Summary of the Issue
-
Invoice XML is generated correctly and passes XSD, EN, KSA, and QR validations
-
The issue occurs only at the signature level
-
ZATCA API and Fatoora SDK both report invalid SignedProperties hashing
-
As a result, PIH validation also fails
ZATCA API Error
From ZATCA API response:
Invalid signed properties hashing, SignedProperties with id='xadesSignedProperties'
Fatoora SDK Validation Result (Java SDK 3.4.8)
When validating the same XML using:
fatoora generate -invoice 311218730900003_20260106_9.xml -validate
I receive the following errors:
[SIGNATURE] validation result : FAILED
CODE : xadesSignedPropertiesDigestValue
MESSAGE : wrong xadesSignedPropertiesDigestValue
CODE : signatureValue
MESSAGE : wrong signature Value
[PIH] validation result : FAILED
CODE : KSA-13
MESSAGE : PIH is inValid
What Is Working Correctly
-
XML structure (UBL 2.1)

-
Invoice data and totals

-
QR code generation

-
Certificate is loaded and used

-
Invoice hash is generated

Where the Problem Seems to Be
Based on the errors, the problem appears to be related to XAdES signing, specifically:
-
Canonicalization of
<xades:SignedProperties> -
Digest calculation for SignedProperties
-
Reference URI or ID mismatch
-
SignatureValue calculated over incorrect canonical data
-
PIH calculated using an incorrect final invoice hash
Because the SignedProperties digest is wrong, the signature becomes invalid, and consequently the PIH hash also fails validation.
What I Need Help With
I would appreciate guidance on the correct method to generate and sign XAdES SignedProperties, specifically:
-
Correct canonicalization method required by ZATCA (C14N type)
-
Exact structure and required attributes for
<xades:SignedProperties> -
How to correctly calculate:
-
xadesSignedPropertiesDigestValue -
SignatureValue -
PIH based on the signed invoice
-
-
Common mistakes to avoid when signing invoices programmatically
If possible, a sample reference implementation or step-by-step signing flow would be extremely helpful.
Environment Details
-
Invoice Type: B2C (Simplified)
-
SDK Used for Validation: ZATCA Fatoora Java SDK 3.4.8
-
Implementation Language: PHP
-
OS: **Windows (XAMPP)
but i make this xml using php and codeigniter
i get this error and tell me how i set that
**
My integration date is limited plz reponse as soon as possible
Thank you for your time and support. I am very close to completion and only need help correcting the signature and signed properties hashing to become fully compliant.
Best regards
Ali