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:

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

herong> echo Generating a self-signed certificate for Herong
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:

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

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

herong> echo Signing a John's request by Herong's key
herong> 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:

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

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

herong> echo Signing a Bill's request by John's key
herong> 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:

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

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

herong> echo Signing a Tom's request by Bill's key
herong> 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.

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

 Using Certificates in Google Chrome

 Using Certificates in Firefox

 Archived Tutorials

 References

 Full Version in PDF/EPUB