Context
We are using the ZATCA Fatoora Java SDK (3.4.1) to sign invoices via:
com.gazt.einvoicing.signing.service.SigningService
- The private key works fine in the Fatoora CLI.
- When the same key is used explicitly in Java, signing fails.
Private Key Instructions inside SDK
- File:
Data/Certificates/ec-secp256k1-priv-key.pem - Algorithm: EC secp256k1
- Format: Raw key only (without PEM headers/footers)
-----BEGIN EC PRIVATE KEY----- -----END EC PRIVATE KEY-----
Behavior Observed
Fatoora CLI
fatoora -sign -invoice Standard_Invoice.xml -signedInvoice Standard_Invoice_signed.xml
- Works successfully.
- Logs:
2025-10-28 01:31:46,272 [INFO] InvoiceSigningService - invoice has been signed successfully
2025-10-28 01:31:46,273 [INFO] InvoiceSigningService - *** INVOICE HASH = VL2jbK+A9E8eGmBkAPpgtI04YjyjRe+KE+v4zPjd8R4=
Java SDK
-
Using the key via InputStream, signing fails.
-
Error:
2025-10-27 17:46:05,079 [http-nio-9095-exec-7] ERROR c.s.e.s.ServiceHome - Exception: org.bouncycastle.openssl.PEMException: unable to convert key pair: null
Key Examples
A. Generic key that works in Java
- First 50 chars: MHQCAQEEIIAfwgRIdi8IAgGfXWP/rh6QhYX0Pv8vCwB/70TSQ
B. Generated key using Fatoora SDK (fails in Java)
- First 50 chars: MIGNAgEAMBAGByqGSM49AgEGBSuBBAAKBHYwdAIBAQQgYrv2Gx
We are not changing anything in the generated key from ZATCA Fatoora CSID generated private key.
Is there anything we are missing or does the private key generated through ZATCA Fatoora commands need some treatment to be used in JAVA.