please note that signing invoices from your side only required on B2C invoices, in B2B invoices ZATCA will sign it.
you can validate the invoices from SDK through this command :
fatoora -validate -invoice [invoice file name]
If you are still receving the same signing error please follow the below steps while making sure you got the latests version of SDK installed:
1- get your CSR config file ready with all of the required inputs, then open the command line interface in the CSR config file path and type this command to generate the CSR and private key for simulation :
Fatoora -csr -csrconfig [file name]
Note: simulation and production are independent environments, so if you want to generate a CSR for simulation please make sure to put the flag -sim
2- get your OTP from FATOORA portal that’s associated with the VAT number you have put in the CSR config file.
3- after submitting your CSR & generated OTP in the compliance CSID API, it will return you a security binarytoken, take this value and decode it using base64, and the output is the X.509 certifecate.
4- after getting your X.509 certiecate & private key, please go to the Certificates folder in SDK by following this path “SDK folder\data\Certificates”
5- after going to Certificates in the follwed path above, you will find 2 files:
first file is cert.pem : you are requested to replace the X.509 cert value here, so copy and paste your X.509 cert. (make sure that the pasted value is already a decoded security binarytoken using base64 decoder).
second file is ec-secp256k1-priv-key.pem: you are requested to replace the value of your generated private key here. just copy your generated private key and paste it here.
6- now you will be able to sign your B2C invoices with your certificate, by using this command:
fatoora -sign -invoice [invoice file name]
and this is how sucessfully you can sign your B2C invoices for compliance checks, after getting your invoices signed you can go to the next step which is compliance checks (compliance invoice API), and submit your invoices there to obtain the production CSID\Certificate.
then you can validate the signed invoices using SDK with the mentioned command above.
please do not hesitate to reach out if you have any further questions.
thank you,