Cryptography Tutorials - Herong's Tutorial Examples - v5.42, by Herong Yang
"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:
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 Signature ok 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 herong> more maria.crt -----BEGIN CERTIFICATE----- MIIEGTCCAwECAQIwDQYJKoZIhvcNAQEEBQAwgZMxCzAJBgNVBAYTAkhZ... ... k7R7Q4bN2eDWX9eiUid6VuJefLx3S1HlyVLwBlR1t4zqUZUeZxVEhqf6... -----END CERTIFICATE-----
Cool. CSR generated by "keytool" is compatible with "OpenSSL". Here are some notes on what I did:
Do you want to see some detail information about Maria's public key certificate? Try this command "openssl x509":
herong> openssl x509 -in maria.crt -noout -text Certificate: Data: 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 Validity 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: pub: 0a:aa:91:a7:4e:36:39:4b:95:5e:fb:99:... ... 79:30:3a:fe:40:38:71:71 P: 00:fd:7f:53:81:1d:75:12:29:52:df:4a:... ... f2:22:03:19:9d:d1:48:01:c7 Q: 00:97:60:50:8f:15:23:0b:cc:b2:92:b9:... 84:0b:f0:58:1c:f5 G: 00:f7:e1:a0:85:d6:9b:3d:de:cb:bc:ab:... ... 25:64:01:4c:3b:fe:cf:49:2a Signature Algorithm: md5WithRSAEncryption 00:9e:25:92:ce:33:b1:00:fc:a1:ef:b8:70:d9:97:aa:... ... fa:c0:68:6c
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:
Table of Contents
Introduction to AES (Advanced Encryption Standard)
DES Algorithm - Illustrated with Java Programs
DES Algorithm Java Implementation
DES Algorithm - Java Implementation in JDK JCE
DES Encryption Operation Modes
PHP Implementation of DES - mcrypt
Blowfish - 8-Byte Block Cipher
Secret Key Generation and Management
Cipher - Secret Key Encryption and Decryption
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
OpenSSL Introduction and Installation
OpenSSL Generating and Managing RSA Keys
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"