issues while generating the CSR and signing

Dear Team,

We are one of the IT solution providers in Saudi Arabia, currently working on building a Node.js microservice to process invoices (both B2B & B2C) in compliance with ZATCA Phase 2 specifications.

We are facing issues while generating the CSR and signing the invoice. Below are the steps we followed and the issues encountered:

Steps Followed:

Downloaded the .NET version of the SDK from the sandbox portal. As per the guidelines, we updated the config file and generated the privateKey.key and cert.pem files.

Copied the cert.pem file to https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance to generate the Binary Token and Secret Key.

Using the sample invoice, we generated UBL 2.1 XML with Node.js.

Attempted to sign the XML using the Binary Token (from step 2) and the private key (from step 1).

Issue:

We are encountering a “private key not found” error during signing.

Analysis shows the SDK generates a .key file instead of a .pem file.

We attempted to convert the .key file to .pem using custom programming, but the signing process still fails with the same error.

Could you please provide the necessary steps or guidance to correctly generate the CSR and private key using Node.js, or any recommended approach to properly convert and use the .key file for signing?

We are currently stuck at CSR generation and private key usage, and any help would be greatly appreciated.

Thank you, nageswar