CSR and Private key generation

Dears,

I have two questions

1- When I try to generate csr from sdk cli using this command

fatoora -sim -csr -csrConfig config.properties -privateKey privateKey.pem -generatedCsr csr.pem  

it will generate the private key with the name I provided but the csr will be generated with the default name

2- To sign the invoices in sdk I should put the path of the certificate in config.json
How can I get my certificate to put it in the sdk to start signing the invoices

  1. for the first command please use it like this:
    fatoora -sim -csr -csrConfig config.properties
    also the CSR and private key are not generated with the extension “.pem”
    it’s only the certificate which can be found in SDK/Data/Certificates folder.

  2. the certificate used to sign the invoices is the one returned from Production CSID API.
    you will get token decode that and put the decoded string in the cert.pem file found in SDK/Data/Certificates and you are ready to sign your invoices.
    using command Fatoora -sign -invoice [invoice.xml]

Regards,

Thanks for your reply

regarding the first point what should I do to generate csr and private key files with custom names like csr and privateKey
in the documentation it says but -privateKey -generatedCsr
if i use them together it will only name the private key (first in order) and will generate the csr with the default name

yes it will be generated with the default name. then you can rename it with whatever you want.

Regards,

But there will be more private key if we using as cloud .right ?
so what will be the solution?
how can we find the private key if we dont know the exact name.

while I generate the CSR from sdk with below command
fatoora -sim -csr -csrConfig MER123_csr-config.properties -generatedCsr MER123_csr.csr -privatekey MER123_private.key
the private key is generated some random number not as we expected.

@kiaziz do you find any solutions?

1 Like

@itujar_it @kiaziz

have you found a solution to this for cloud case?

We are now using Java libraries instead of using fatoora command to generate CSR, CSID, and privateKey.

i use this comment fatoora -sim -csr -csrConfig config.properties
where is csr …? and key …?

Should be in the directory where you ran the command

what is Erorr…?

Just read the response, you will see what is [ERROR]

image

Csr configuration file not found…this correct…?

thank you bro it’s create Csr

1 Like

bro same step for Signing and Generating Invoice Hash…?

Actually you can specify the file name and where the csr and private key will be created.

Like this

PS C:\tmp> fatoora generateCsr -csr -nonprod -csrConfig "C:\zatca-einvoicing-sdk-238-R3.3.6\Data\Input\csr-config-example-EN.properties" -privateKey "c:\tmp\cert\PrivateKey.pem" -generatedCsr "c:\tmp\cert\taxpayer.csr"

how do create qr code …?

@itujar_it Which Java library are you using?

I am facing issue in my cloud application when detailing with multiple onboarding.

MacOs
ZatcaSDK
fatoora -csr -sim -csrConfig csr-config-2.properties
created 2 files with pk/csr with names which generated by sdk

fatoora -csr -sim -csrConfig csr-config-2.properties -generatedCsr keys/csr-2
created PK with name, generated by sdk
created CSR in keys/csr-2

fatoora -csr -sim -csrConfig csr-config-2.properties -privateKey keys/pk-2
created CSR with name, generated by sdk
created PK in keys/pk-2

Here all fine. But I can’t use it together

fatoora -csr -sim -csrConfig csr-config-2.properties -generatedCsr keys/csr-2 -privateKey keys/pk-2
generated PK in a way like I didn’t specified it, but CSR where i specified it

In case if I swap them in place:
fatoora -csr -sim -csrConfig csr-config-2.properties -privateKey keys/pk-2 -generatedCsr keys/csr-2
generated CSR in a way like I didn’t specified it, but PK where i specified it

So last one is actually getting ignored

How can I handle it ?

I have the same problem . . . PLZ can you guide me hot to solve it

Dear @KHALID_SHOKRY,

please create a new ticket (topic) with providing the required & supporting details.

Regards,