# Invalid CSR error when try to obtain CCSID

**URL:** <https://zatca1.discourse.group/t/invalid-csr-error-when-try-to-obtain-ccsid/5997>\
**Category:** Onboarding, renewal and revocation\
**Created:** [February 25, 2025, 12:07pm UTC](https://zatca1.discourse.group/t/invalid-csr-error-when-try-to-obtain-ccsid/5997 "2025-02-25T12:07:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![wanderson.oliveira](https://avatars.discourse-cdn.com/v4/letter/w/ed8c4c/32.png) [@wanderson.oliveira](https://zatca1.discourse.group/u/wanderson.oliveira)\
**Post date:** [February 25, 2025, 12:07pm UTC](https://zatca1.discourse.group/t/invalid-csr-error-when-try-to-obtain-ccsid/5997/1 "2025-02-25T12:07:34Z")

</div>

I am trying to onboard a new device and I am getting the error “The provided Certificate Signing Request (CSR) is invalid.”  
The CSR encoded is “LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQk5UQ0Iyd0lC  
QURCVE1Rc3dDUVlEVlFRR0V3SlRRVEVWTUJNR0ExVUVDd3dNVW1sNVlXUWdRbkpo  
Ym1ObwpNUkF3RGdZRFZRUUtEQWREYjI1MGIzTnZNUnN3R1FZRFZRUUREQkphUVZS  
RFFTMURiMlJsTFZOcFoyNXBibWN3ClZqQVFCZ2NxaGtqT1BRSUJCZ1VyZ1FRQUNn  
TkNBQVIrWTR3NFhHdEF3NGl6ZWVNS0w3a0FtRzVBVFVOc0p4VncKeXRqa0RYc0ls  
ZE5iSVJrQko2UmNLaWE2U1dXcGpGaElFblRhTHZhbnNSNkRIa1NyUFBQbm9Da3dK  
d1lKS29aSQpodmNOQVFrT01Sb3dHREFKQmdOVkhSTUVBakFBTUFzR0ExVWREd1FF  
QXdJRjREQUtCZ2dxaGtqT1BRUURBZ05KCkFEQkdBaUVBMWxTRDNEU1ZydzJEKzZa  
TGVZVnFqcnhuK1ZhdGthdTNiUElKaFVodXpMOENJUUM5TTFKWGdsb2QKN2wzSG9u  
RjdxRE9rTi9rT3R0RDg2T1RXdVcvTTVkQmo3UT09Ci0tLS0tRU5EIENFUlRJRklD  
QVRFIFJFUVVFU1QtLS0tLQo=”

I also trying using Postman but got the same issue. Please can you help to solve this issue?

---

<div class="post-metadata">

**Author:** ![idaoud](https://avatars.discourse-cdn.com/v4/letter/i/f9ae1b/32.png) [@idaoud](https://zatca1.discourse.group/u/idaoud)\
**Post date:** [February 25, 2025, 2:02pm UTC](https://zatca1.discourse.group/t/invalid-csr-error-when-try-to-obtain-ccsid/5997/2 "2025-02-25T14:02:53Z")

</div>

Dear @wanderson.oliveira

Thanks for reaching out, Welcome to our community.

To provide comprehensive support as usual, can I kindly ask you to mention all the steps that you followed from the first step to generate the CSR?

Thanks,  
Ibrahem Daoud.

---

<div class="post-metadata">

**Author:** ![wanderson.oliveira](https://avatars.discourse-cdn.com/v4/letter/w/ed8c4c/32.png) [@wanderson.oliveira](https://zatca1.discourse.group/u/wanderson.oliveira)\
**Post date:** [February 26, 2025, 7:58am UTC](https://zatca1.discourse.group/t/invalid-csr-error-when-try-to-obtain-ccsid/5997/3 "2025-02-26T07:58:09Z")

</div>

Hello thank you for the reply.  
We are trying to on board the Dynamics 365 F&O and we are trying to run the PowerShell script described here: [Onboarding for electronic invoicing in Saudi Arabia - Finance | Dynamics 365 | Microsoft Learn](https://learn.microsoft.com/en-us/dynamics365/finance/localizations/mea/gs-e-invoicing-sa-onboarding?wt.mc_id=knwlserAPI_inproduct_copilotstudio#onboarding-process)

I trying to run the script like: .\OnboardingScript.ps1 -action getComplianceCSID -otp 123345 -csrconfig .\csr\_config.txt

The CSR config file is like that (email and UID replaced here for security purpose):  
oid\_section=OIDs  
[OIDs]  
certificateTemplateName=1.3.6.1.4.1.311.20.2  
[req]  
default\_bits=2048  
emailAddress=xxx  
req\_extensions=v3\_req  
x509\_extensions=v3\_ca  
prompt=no  
default\_md=sha 256  
req\_extensions=req\_ext  
distinguished\_name=dn  
[dn]  
C=SA  
OU=Riyad Branch  
O=Contoso  
CN=ZATCA-Code-Signing  
[v3\_req]  
basicConstraints=CA:FALSE  
keyUsage=digitalSignature,nonRepudiation,keyEncipherment  
[req\_ext]  
certificateTemplateName=ASN1:PRINTABLESTRING:PREZATCA-Code-Signing  
subjectAltName=dirName:alt\_names  
[alt\_names]  
SN=1-TST|2-TST|3-f9946a15-58db-404e-a868-1abccca82de3  
UID=xxx  
title=1100  
registeredAddress=MyAddress  
businessCategory=Industry

When we run the script, always gets the error: “The provided Certificate Signing Request (CSR) is invalid.”

Please, can you help us how to solve this?

---

<div class="post-metadata">

**Author:** ![idaoud](https://avatars.discourse-cdn.com/v4/letter/i/f9ae1b/32.png) [@idaoud](https://zatca1.discourse.group/u/idaoud)\
**Post date:** [February 26, 2025, 8:18am UTC](https://zatca1.discourse.group/t/invalid-csr-error-when-try-to-obtain-ccsid/5997/4 "2025-02-26T08:18:40Z")

</div>

Morning @wanderson.oliveira

Can I kindly ask you to try the below template using the facility information?

> oid\_section = OIDs  
> [OIDs]  
> certificateTemplateName = 1.3.6.1.4.1.311.20.2  
> [req]  
> default\_bits = 2048  
> emailAddress =   
> req\_extensions = v3\_req  
> x509\_extensions = v3\_ca  
> prompt = no  
> default\_md = sha256  
> req\_extensions = req\_ext  
> distinguished\_name = dn  
> [dn]  
> C=SA  
> OU=  
> O=  
> CN=  
> [v3\_req]  
> basicConstraints = CA:FALSE  
> keyUsage = digitalSignature, nonRepudiation, keyEncipherment  
> [req\_ext]  
> certificateTemplateName=ASN1:PRINTABLESTRING:PREZATCA-Code-Signing  
> subjectAltName = dirName:alt\_names  
> [alt\_names]  
> SN=1-zaid1|2-TST|3-ed22f1d8-e6a2-1118-9b58-d9a8f11e445f  
> UID=  
> title=1100  
> registeredAddress=ss  
> businessCategory=

Please let me know if it works.

Thanks,  
Ibrahem Daoud.

---

<div class="post-metadata">

**Author:** ![wanderson.oliveira](https://avatars.discourse-cdn.com/v4/letter/w/ed8c4c/32.png) [@wanderson.oliveira](https://zatca1.discourse.group/u/wanderson.oliveira)\
**Post date:** [February 27, 2025, 9:36am UTC](https://zatca1.discourse.group/t/invalid-csr-error-when-try-to-obtain-ccsid/5997/5 "2025-02-27T09:36:52Z")

</div>

Unfortunately it doesn’t work.  
I took your file, filled in the email and and UID (VAT number - 3xxx3) and got the error when the script tried to generate the certificate. So I believe the OU, O and CN needs to be filled in. I filled in OU = company name, O = company name and CN = ZATCA-Code-Signing, but got the same initial error that The provided Certificate Signing Request (CSR) is invalid.

Please, can you suggest something else that I should change in the file to make it valid?

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/zatca1/original/1X/f245aece0ee474d54efdb9ceb7d5155d360f05b8.png)

---

<div class="post-metadata">

**Author:** ![idaoud](https://avatars.discourse-cdn.com/v4/letter/i/f9ae1b/32.png) [@idaoud](https://zatca1.discourse.group/u/idaoud)\
**Post date:** [February 27, 2025, 9:55am UTC](https://zatca1.discourse.group/t/invalid-csr-error-when-try-to-obtain-ccsid/5997/6 "2025-02-27T09:55:04Z")

</div>

Dear @wanderson.oliveira

Thanks for replying,

No worries can I kindly ask you to reach out to our support team via the below mail, mentioning all the details and steps with some screenshots, for our investigation and will schedule one to one meeting if needed.

SP mail: [sp\_support@zatca.gov.sa](mailto:sp_support@zatca.gov.sa)

Thanks,  
Ibrahem Daoud.

---

<div class="post-metadata">

**Author:** ![wanderson.oliveira](https://avatars.discourse-cdn.com/v4/letter/w/ed8c4c/32.png) [@wanderson.oliveira](https://zatca1.discourse.group/u/wanderson.oliveira)\
**Post date:** [March 5, 2025, 8:43am UTC](https://zatca1.discourse.group/t/invalid-csr-error-when-try-to-obtain-ccsid/5997/7 "2025-03-05T08:43:32Z")

</div>

Hello @idaoud I have sent the email as requested on 28/02 but until now I don’t receive any response. Please, can you check with the team?

---

<div class="post-metadata">

**Author:** ![idaoud](https://avatars.discourse-cdn.com/v4/letter/i/f9ae1b/32.png) [@idaoud](https://zatca1.discourse.group/u/idaoud)\
**Post date:** [March 5, 2025, 4:28pm UTC](https://zatca1.discourse.group/t/invalid-csr-error-when-try-to-obtain-ccsid/5997/8 "2025-03-05T16:28:17Z")

</div>

Dear @wanderson.oliveira

Thank you for your patience. Could you please share the email you used to reach out to them?

Thanks,  
Ibrahem Daoud.

---

<div class="post-metadata">

**Author:** ![wanderson.oliveira](https://avatars.discourse-cdn.com/v4/letter/w/ed8c4c/32.png) [@wanderson.oliveira](https://zatca1.discourse.group/u/wanderson.oliveira)\
**Post date:** [March 6, 2025, 2:27pm UTC](https://zatca1.discourse.group/t/invalid-csr-error-when-try-to-obtain-ccsid/5997/9 "2025-03-06T14:27:31Z")

</div>

My email is [wanderson.oliveiradasilva@kpmg.co.uk](mailto:wanderson.oliveiradasilva@kpmg.co.uk). I’ve attached the certificate files generated, so I am not sure if my e-mail was blocked because of that. Please, can you check?
