Creating a Certificate Path with OpenSSL

This section provides a tutorial example on how to create multiple certificates to form a certificate path for testing purpose.

Here is a testing scenario I followed to generate some certificates with different issuers and subjects. See previous notes if you have trouble generating keys and signing certificates.

1. Generating a self-signed certificate for Herong, herong.crt:

>echo Generating keys for Herong
>openssl genrsa -des3 -out herong_rsa.key
...

>echo Generating a self-signed certificate for Herong
>openssl req -new -key herong_rsa.key -x509 -out herong.crt 
   -config openssl.cnf
...

2. Generating a certificate for John and signed by Herong, john.crt:

>echo Generating keys for John
>openssl genrsa -des3 -out john_rsa.key
...

>echo Generating a certificate signing request for John
>openssl req -new -key john_rsa.key -out john.csr -config openssl.cnf
...

>echo Signing a John's request by Herong's key
>openssl x509 -req -in john.csr -CA herong.crt -CAkey herong_rsa.key
   -out john.crt -set_serial 3
...

3. Generating a certificate for Bill and signed by John, bill.crt:

>echo Generating keys for Bill
>openssl genrsa -des3 -out bill_rsa.key
...

>echo Generating a certificate signing request for Bill
>openssl req -new -key bill_rsa.key -out bill.csr -config openssl.cnf
...

>echo Signing a Bill's request by John's key
>openssl x509 -req -in bill.csr -CA john.crt -CAkey john_rsa.key 
   -out bill.crt -set_serial 7
...

4. Generating a certificate for Tom and signed by Bill, tom.crt:

>echo Generating keys for Tom
>openssl genrsa -des3 -out tom_rsa.key
...

>echo Generating a certificate signing request for Bill
>openssl req -new -key tom_rsa.key -out tom.csr -config openssl.cnf
...

>echo Signing a Tom's request by Bill's key
>openssl x509 -req -in tom.csr -CA bill.crt -CAkey bill_rsa.key 
   -out tom.crt -set_serial 11
...

Ok. 4 certificates are enough to do some interesting tests with the "openssl verify" command. See the next section for testing result.

Last update: 2013.

Table of Contents

 About This Book

 Cryptography Terminology

 Cryptography Basic Concepts

 Introduction to AES (Advanced Encryption Standard)

 Introduction to DES Algorithm

 DES Algorithm - Illustrated with Java Programs

 DES Algorithm Java Implementation

 DES Algorithm - Java Implementation in JDK JCE

 DES Encryption Operation Modes

 DES in Stream Cipher Modes

 PHP Implementation of DES - mcrypt

 Blowfish - 8-Byte Block Cipher

 Secret Key Generation and Management

 Cipher - Secret Key Encryption and Decryption

 Introduction of RSA Algorithm

 RSA Implementation using java.math.BigInteger Class

 Introduction of DSA (Digital Signature Algorithm)

 Java Default Implementation of DSA

 Private key and Public Key Pair Generation

 PKCS#8/X.509 Private/Public Encoding Standards

 Cipher - Public Key Encryption and Decryption

 MD5 Mesasge Digest Algorithm

 SHA1 Mesasge Digest Algorithm

 OpenSSL Introduction and Installation

 OpenSSL Generating and Managing RSA Keys

 OpenSSL Managing Certificates

 OpenSSL Generating and Signing CSR

OpenSSL Validating Certificate Path

 What Is a Certification Path?

 Certification Path Validation Rules

Creating a Certificate Path with OpenSSL

 Validating a Certificate Path with OpenSSL

 "keytool" and "keystore" from JDK

 "OpenSSL" Signing CSR Generated by "keytool"

 Migrating Keys from "keystore" to "OpenSSL" Key Files

 Certificate X.509 Standard and DER/PEM Formats

 Migrating Keys from "OpenSSL" Key Files to "keystore"

 Using Certificates in IE (Internet Explorer)

 Using Certificates in Firefox

 Using Certificates in Google Chrome

 Outdated Tutorials

 References

 PDF Printing Version