3

I have to submit CSR in pem format.

I have generated CSR using OpenSSL but got stuck in converting it into PEM format.

I have to obtain example - csr.pem from example.csr. How it can be done?

garethTheRed
  • 1,997
  • 13
  • 20
vikas pandit
  • 39
  • 1
  • 1
  • 2
  • Please do not generate multiple accounts just to ask the [same question](https://stackoverflow.com/q/56207946/238704) over and over. This is an abuse of stackoverflow. – President James K. Polk May 20 '19 at 15:14

1 Answers1

3

OpenSSL creates CSRs in PEM format by default.

If you generated the CSR without the -outform option, the CSR will already be in PEM format.

If you did use the -outform DER option, you can convert with:

openssl req -inform DER -in <original CSR file> -out <converted CSR file>

The .pem file extension is just a name. If the file is in PEM format, simply change the extension on the file from .csr to .pem.

garethTheRed
  • 1,997
  • 13
  • 20
  • The .csr starts with `-----BEGIN CERTIFICATE REQUEST-----` and is thus not recognized by programs like NGINX which expect `-----BEGIN CERTIFICATE-----`. – Marc Feb 17 '20 at 15:45
  • @Marc - that's expected. The first is a request, the latter a certificate. You convert your request to a certificate by having a Certification Authority certify the request for you. – garethTheRed Feb 17 '20 at 16:04
  • Yep, I was being impatient and hoping I could just remove " REQUEST" and use the .csr as an unsigned .pem until it was signed. No luck however - Nginx did not like it. Can you convert a .csr to an unsigned certificate (.pem)? – Marc Feb 17 '20 at 16:34
  • 2
    @Marc - if it's not signed, it's not a certificate :-). You can self-sign a request though. – garethTheRed Feb 17 '20 at 17:55