Certificate Signing Request (CSR)
A Certificate Signing Request (CSR) is a block of encoded text that an organization or individual submits to a Certificate Authority (CA) to apply for a digital certificate. The CSR is a critical part of the public key infrastructure (PKI) process, as it establishes the identity of the applicant and includes the information the CA needs to issue a secure and verifiable certificate.
CSRs are typically generated on the server or device that will use the certificate. During the CSR generation process, a public-private key pair is created. The private key remains secure and confidential on the server, while the CSR includes the public key and identity information (e.g., domain name, organization, location). Once the CA validates the information, it issues a digital certificate that can be used for secure communications such as HTTPS.
Why CSR is Important
The CSR ensures the authenticity of a digital certificate. It enables a trusted third party (the CA) to verify your identity and bind your public key to that identity. The issued certificate allows users and devices to trust encrypted connections to your service.
Information Included in a CSR
- Common Name (CN): Usually the fully qualified domain name (FQDN) of your website
- Organization (O): Legal name of your organization
- Organizational Unit (OU): Department within the organization
- City/Locality (L): City where your organization is located
- State/Province (S): State where your organization is located
- Country (C): Two-letter ISO code of the country
- Public Key: Part of the key pair generated on your server
How to Generate a CSR
The most common way to generate a CSR is using OpenSSL:
openssl req -new -newkey rsa:2048 -nodes -keyout domain.key -out domain.csr
This command will generate a new 2048-bit RSA private key and create a CSR file. The private key (domain.key) must be kept secure.
CSR Format
CSRs are usually saved in PEM format and look something like this:
-----BEGIN CERTIFICATE REQUEST-----
MIIC...Base64 Encoded Data...
-----END CERTIFICATE REQUEST-----
You can open the CSR in any text editor to verify its contents or submit it to a CA during the SSL certificate application process.
CSR Validation and Certificate Issuance
Once submitted, the CA uses the information in the CSR to validate your request. For Domain Validation (DV), this usually involves email or DNS-based domain verification. For Organization Validation (OV) or Extended Validation (EV), additional documentation and verification steps are required.
If everything checks out, the CA signs your certificate using its private key and sends it back to you. You then install this certificate on your web server alongside your private key to enable encrypted connections.
CSR in Automation
With the rise of DevOps and automated deployments, many systems now generate CSRs programmatically. Let's Encrypt and other modern CAs support fully automated issuance via protocols like ACME, which generates CSRs behind the scenes. These automation workflows reduce manual handling and ensure timely renewal of certificates.
Security Best Practices
- Always generate the CSR on the system that will use the certificate—never send your private key over the internet.
- Use at least a 2048-bit key for RSA encryption or a modern ECC curve for stronger security.
- Protect your private key with file permissions and, if necessary, encryption.
- Keep CSR files confidential until the certificate is issued.
Common Mistakes to Avoid
- Submitting a CSR with incorrect Common Name (e.g., omitting “www” when needed)
- Sending a private key to the CA (this should never be done)
- Using expired or weak encryption algorithms
- Failing to secure the private key or losing it before certificate installation
Conclusion
A Certificate Signing Request (CSR) is the gateway to acquiring a trusted digital certificate. It includes all the information needed to prove your identity and bind that identity to a public key. Whether you are manually creating certificates or automating issuance at scale, understanding the CSR process is essential for secure and trustworthy communications. By properly generating, validating, and securing CSRs, organizations can establish robust encryption practices and build user confidence in their digital services.