Openssl Generate Csr With Extended Key Usage
The basicConstraints, keyUsage and extended key usage extensions are now used instead. Acceptable values for nsCertType are: client, server, email, objsign, reserved, sslCA, emailCA, objCA. ARBITRARY EXTENSIONS. If an extension is not supported by the OpenSSL code then it must be encoded using the arbitrary extension format. My program has the following flow: a client sends a CSR to server, the server sends back a client certificate and after that the client communicates with the server to a path that requires a certificate signed by the server (the client certificate) My questions are: I've set clientAuth extended key usage in the generated client certificate. The following sections describe how to use OpenSSL to generate a CSR for a single host name. If you want to generate a CSR for multiple host names, we recommend using the Cloud Control Panel or the MyRackspace Portal. Install OpenSSL. Check whether OpenSSL is installed by using the following command: CentOS® and Red Hat® Enterprise Linux®.
| # Define where to store the generated certs and metadata. |
| DIR='$(pwd)/tls' |
| # Optional: Ensure the target directory exists and is empty. |
| rm -rf '${DIR}' |
| mkdir -p '${DIR}' |
| # Create the openssl configuration file. This is used for both generating |
| # the certificate as well as for specifying the extensions. It aims in favor |
| # of automation, so the DN is encoding and not prompted. |
| cat >'${DIR}/openssl.cnf'<<EOF |
| [req] |
| default_bits = 2048 |
| encrypt_key = no # Change to encrypt the private key using des3 or similar |
| default_md = sha256 |
| prompt = no |
| utf8 = yes |
| # Speify the DN here so we aren't prompted (along with prompt = no above). |
| distinguished_name = req_distinguished_name |
| # Extensions for SAN IP and SAN DNS |
| req_extensions = v3_req |
| # Be sure to update the subject to match your organization. |
| [req_distinguished_name] |
| C = US |
| ST = California |
| L = The Cloud |
| O = Demo |
| CN = My Certificate |
| # Allow client and server auth. You may want to only allow server auth. |
| # Link to SAN names. |
| [v3_req] |
| basicConstraints = CA:FALSE |
| subjectKeyIdentifier = hash |
| keyUsage = digitalSignature, keyEncipherment |
| extendedKeyUsage = clientAuth, serverAuth |
| subjectAltName = @alt_names |
| # Alternative names are specified as IP.# and DNS.# for IP addresses and |
| # DNS accordingly. |
| [alt_names] |
| IP.1 = 1.2.3.4 |
| DNS.1 = my.dns.name |
| EOF |
| # Create the certificate authority (CA). This will be a self-signed CA, and this |
| # command generates both the private key and the certificate. You may want to |
| # adjust the number of bits (4096 is a bit more secure, but not supported in all |
| # places at the time of this publication). |
| # |
| # To put a password on the key, remove the -nodes option. |
| # |
| # Be sure to update the subject to match your organization. |
| openssl req |
| -new |
| -newkey rsa:2048 |
| -days 120 |
| -nodes |
| -x509 |
| -subj '/C=US/ST=California/L=The Cloud/O=My Company CA' |
| -keyout '${DIR}/ca.key' |
| -out '${DIR}/ca.crt' |
| # |
| # For each server/service you want to secure with your CA, repeat the |
| # following steps: |
| # |
| # Generate the private key for the service. Again, you may want to increase |
| # the bits to 4096. |
| openssl genrsa -out '${DIR}/my-service.key' 2048 |
| # Generate a CSR using the configuration and the key just generated. We will |
| # give this CSR to our CA to sign. |
| openssl req |
| -new -key '${DIR}/my-service.key' |
| -out '${DIR}/my-service.csr' |
| -config '${DIR}/openssl.cnf' |
| # Sign the CSR with our CA. This will generate a new certificate that is signed |
| # by our CA. |
| openssl x509 |
| -req |
| -days 120 |
| -in '${DIR}/my-service.csr' |
| -CA '${DIR}/ca.crt' |
| -CAkey '${DIR}/ca.key' |
| -CAcreateserial |
| -extensions v3_req |
| -extfile '${DIR}/openssl.cnf' |
| -out '${DIR}/my-service.crt' |
| # (Optional) Verify the certificate. |
| openssl x509 -in '${DIR}/my-service.crt' -noout -text |
| # Here is a sample response (truncate): |
| # |
| # Certificate: |
| # Signature Algorithm: sha256WithRSAEncryption |
| # Issuer: C = US, ST = California, L = The Cloud, O = My Organization CA |
| # Subject: C = US, ST = California, L = The Cloud, O = Demo, CN = My Certificate |
| # # .. |
| # X509v3 extensions: |
| # X509v3 Basic Constraints: |
| # CA:FALSE |
| # X509v3 Subject Key Identifier: |
| # 36:7E:F0:3D:93:C6:ED:02:22:A9:3D:FF:18:B6:63:5F:20:52:6E:2E |
| # X509v3 Key Usage: |
| # Digital Signature, Key Encipherment |
| # X509v3 Extended Key Usage: |
| # TLS Web Client Authentication, TLS Web Server Authentication |
| # X509v3 Subject Alternative Name: |
| # IP Address:1.2.3.4, DNS:my.dns.name |
| # |
OpenSSL CSR Wizard
Our OpenSSL CSR Wizard is the fastest way to create your CSR for Apache (or any platform) using OpenSSL.
Fill in the details, click GenerateOffice 2016 product keygen. , then paste your customized OpenSSL CSR command in to your terminal.
Note: After 2015, certificates for internal names will no longer be trusted.
Common Name (Server Name) The fully qualified domain name that clients will use to reach your server. For example, to secure https://www.example.com, your common name must be www.example.com or *.example.com for a wildcard certificate. Although less common, you may also enter the public IP address of your server. Department (optional) You can leave this field blank. This is the department within your organization that you want to appear on the certificate. It will be listed in the certificate's subject as Organizational Unit, or 'OU'. Common examples: Web Administration, Web Security, or Marketing City The city where your organization is legally located. State or Province The state or province where your organization is legally located. Country We guessed your country based on your IP address, but if we guessed wrong, please choose the correct country. If your country does not appear in this list, there is a chance we cannot issue certificates to organizations in your country. Organization name The exact legal name of your organization, (e.g., DigiCert, Inc.) If you do not have a legal registered organization name, you should enter your own full name here. Key RSA Key sizes smaller than 2048 are considered unsecure. Now just copy and paste this command into a terminal session on your server. Your CSR will be written to ###FILE###.csr. |
After you've created a Certificate Signing Request (CSR) and ordered your certificate, you still need to install the SSL certificate on your server.
For instructions on how to install SSL certificates, see SSL Certificate Installation Instructions & Tutorials.
Where do I paste this command?

You can run this command wherever you have OpenSSL available—most likely on your server, but you can also run it on your own computer since macOS comes with OpenSSL installed. Just make sure you keep track of your private key file after you create your CSR; you'll need that private key to install your certificate.
What happens when I run this command?
OpenSSL creates both your private key and your certificate signing request, and saves them to two files: your_common_name.key, and your_common_name.csr. You can then copy the contents of the CSR file and paste it into the CSR text box in our order form.
What kind of certificate should I buy?
If you want an SSL certificate for Apache, your best options are Standard certificates and Wildcard certificates.
A DigiCert Wildcard can protect all server names on your domain (e.g., *.example.com,). Our unlimited server license lets you protect all your servers for just one price. Many of our customers save thousands of dollars per year by using a DigiCert Wildcard certificate.
| Per Year Pricing | ||||
|---|---|---|---|---|
| 2 Years | $653 per year | ($1,307) | (You Save 10%) | |
| 1 Year | $688 | |||
Standard certificates are able to protect one server name (e.g., mail.example.com). If you only need SSL for one hostname, a Standard certificate will work perfectly.
| Per Year Pricing | ||||
|---|---|---|---|---|
| 2 Years | $207 per year | ($414) | (You Save 10%) | |
| 1 Year | $218 | |||
What If I Need Subject Alternative Names?
Multi-Domain (SAN) certificates allow you to assign multiple host names—known as Subject Alternative Names or SANs—in one certificate.
Using OpenSSL to Add Subject Alternative Names to a CSR is a complicated task. Our advice is to skip the hassle, use your most important server name as the Common Name in the CSR, and then specify the other names during the order process. Our Multi-Domain (SAN) certificate ordering process allows you to specify all the names you need without making you include them in the CSR.
You can also use OpenSSL to create a certificate request for your code signing certificate.
Si desea información en español a Hacer un CSR Utilizando OpenSSL.
X509v3 Extended Key Usage
Related:
Openssl Create Key And Csr
- Learn more about what our Wildcard certificate can do for you.
- We also have a similar CSR Tool for Exchange 2007.



