How to create a local CA certificate and subordinate CA using OpenSSL
search cancel

How to create a local CA certificate and subordinate CA using OpenSSL

book

Article ID: 166329

calendar_today

Updated On:

Products

ProxySG Software - SGOS

Issue/Introduction

Note: All commands are tested against OpenSSL 0.9.8r 8 Feb 2011 using Cygwin on a Windows 7 OS.

1. Create a new CA (private key/keyring and public key/certificate):

openssl req -new -x509 -days 3560 -extensions v3_ca -keyout caprivkey.pem -out cacert.pem -config /usr/ssl/openssl.cnf


Explanation of commands:

reqRequest
-new x509Create a new x509 keypair
-days 3560Validity = ten years
-extensions v3_caMake this request a CA certificate (root CA)
-keyout caprivkey.pemOutput private key to "caprivkey.pem"
-out cacert.pemOutput public key (certificate) to "cacert.pem"
-config /usr/ssl/openssl.cnfUse the config file given (optional command)


2. Create a new subordinate CA private key:

openssl genrsa -out mysubca.key 1024


3. Create a new CSR from the CA private key:

openssl req -new -key mysubca.key -out mysubreq.csr


4. Use the CA certificate (item #1) to sign the CSR (item #3) as a subordinate CA:

openssl ca -extensions v3_ca -days 365 -out mysubcert.cer -policy policy_anything -in mysubreq.csr


Explanation of commands:

caThis will be a CA certificate
-extensions v3_caAdd the CA certificate (signing) attribute to the certificate
-days 365Validity = one year
-out mysubcert.cerName the signed subordinate CA as "mysubcert.cer"
-policy policy_anythingAllow the "organization" field of the root CA to be different than the signed subordinate CA
-in mysubreq.csrThe name of the CSR created in item #3