"OpenSSL" Signing Maria's CSR
This section provides a tutorial example on how to use 'OpenSSL' to sign a CSR (Certificate Signing Request) generated by 'keytool' with CA's private key.
When I got Maria's CSR (Certificate Signing Request), maria.csr,
I can sign it with my CA private key with the "openssl x509 -req" command
as shown in the command session below:
C:\herong>openssl x509 -req -in maria.csr -CA herong.crt
-CAkey herong.key -out maria.crt -days 365
-CAcreateserial -CAserial herong.seq
Loading 'screen' into random state - done
subject=/C=AT/ST=Maria State/L=Maria City/O=Maria Company
/OU=Maria Unit/CN=Maria Teresa
Getting CA Private Key
Enter pass phrase for herong.key: keypass
Cool. CSR generated by "keytool" is compatible with "OpenSSL". Here are some notes on what I did:
- "openssl x509 -req" command signs a CSR (Certificate Sign Request) with my private key and public key certificate.
- "-req" option specifies the entry in the keystore file where to get the key pair.
- "-in maria.csr" option specifies the CSR file received from someone else.
- "-CA herong.crt" option specifies my public key certificate file.
- "-CAkey herong.key" option specifies my private key file. Password will be prompted.
- "-days 365" option specifies that the signed certificate is good for 365 days, about 1 year.
- "-out maria.crt" option specifies the file name to store Maria's public key certificate signed by me.
- "-CAcreateserial" option tells "OpenSSL" to created a serial number file, if it has not been created.
The serial number value will start with 1. It will be inserted into the resulting certificate.
- "-CAserial herong.seq" option specifies the serial number file name.
- "type maria.crt" command displays the content of "maria.crt".
Do you want to see some detail information about Maria's public key certificate?
Try this command "openssl x509":
C:\herong>openssl x509 -in maria.crt -noout -text
Version: 1 (0x0)
Serial Number: 1 (0x1)
Signature Algorithm: md5WithRSAEncryption
Issuer: C=HY, ST=HY State, L=HY City, O=HY Company,
OU=HY Unit, CN=Herong Yang/emailAddress=herongyang.com
Not Before: Apr 1:57:05 2007 GMT
Not After : Mar 31 17:57:05 2008 GMT
Subject: C=AT, ST=Maria State, L=Maria City,
O=Maria Company, OU=Maria Unit, CN=Maria Teresa
Subject Public Key Info:
Public Key Algorithm: dsaEncryption
DSA Public Key:
Signature Algorithm: md5WithRSAEncryption
The detailed information of the certificate seems to be good.
The issuer is me, Herong Yang. The subject is Maria Teresa.
The expiration is one year later.
What needs to happen next are:
- I need to return the signed certificate of Maria's public key back to the Maria.
She can give this certificate to other people now and tell them that it is signed by Herong Yang.
- I need to give a copy of my CA self-signed public key certificate to Maria also.
She can use my certificate to verify my signature on her certificate.
- Maria needs to import both certificates into her keystore file. See the next section for details.
Table of Contents
About This Book
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
"keytool" and "keystore" from JDK
►"OpenSSL" Signing CSR Generated by "keytool"
"OpenSSL" Acting as a CA (Certificate Authority)
"OpenSSL" Generating CA's Private Key
"OpenSSL" Self-Signing CA's Public Key
"keytool" Generating Maria's Private Key
"keytool" Generating Maria's CSR
►"OpenSSL" Signing Maria's CSR
"OpenSSL" Managing Serial Numbers when Signing CSR
"keytool" Importing CA's Own Certificate
""keytool" Importing Maria's Certificate Signed by CA
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
Full Version in PDF/EPUB