What Is a Certificate Signing Request? How to Check a CSR
Read a certificate signing request, verify its signature, check requested DNS names, and compare the public key without sending your private key.
- tls
- certificates
- https
- guide
A certificate signing request (CSR) is a signed request containing a public key, a subject name, and optional attributes. A certificate authority can use those fields when it issues a certificate. A CSR carries no private key. Before sending one, confirm that the request is intact, that it asks for the names your service needs, and that your service still has the corresponding key.
Read the request before uploading it
Suppose your staging service answers at api.example.test and status.example.test. Your colleague sent you a PEM request named service.csr. Use OpenSSL's req command to inspect the PKCS #10 request locally.
- Run
openssl req -in service.csr -noout -verify. This verifies the request's own signature. Stop if verification fails or OpenSSL cannot read the file. - Run
openssl req -in service.csr -noout -text. FindSubject,Public Key Algorithm, andRequested Extensions. - Under
Subject Alternative Name, look forDNS:api.example.testandDNS:status.example.test. If only the first name appears, the request as written does not ask for the second. Correct the request or check how the issuer's order adds identifiers before you submit it.
The request signature proves that the requester could sign with the private key associated with the public key in that request. The signature does not prove that the requester controls the DNS names. PKCS #10 describes request signing separately from the authority's decision to issue. A public certificate may also require a separate domain validation step.
Compare the public parts of the two files
On the machine that is supposed to hold the key, extract the request's public key with openssl req -in service.csr -noout -pubkey > csr-public.pem. Then extract the public part of the local key with openssl pkey -in service.key -pubout -out local-public.pem. Both commands must succeed before you compare the files. Run cmp csr-public.pem local-public.pem. Successful comparison means the exported public keys are byte-for-byte equal. If they differ, locate the correct key or regenerate the request for the key you intend to deploy.
The -pubout switch is important. The exported file is for comparing public keys. Leave the original service.key in the system that manages it. For non-exportable keys, use your key manager's public-key export and compare that output. Do not move a private key into an online decoder to perform this step.
Check the issued certificate again
Save the request and its key reference together. When the certificate arrives, compare its public key with the intended key and inspect its issued DNS names and validity period. The certificate authority controls the final certificate fields, so a correct CSR does not make those later checks redundant. After installation, check the certificate served by the endpoint, since a correct certificate file on disk does not establish what a client receives.
