Cryptography Tutorials - Herong's Tutorial Examples - v5.42, by Herong Yang
Generating New RSA Key Pairs
This section provides a tutorial example on how to generate a new pair of RSA priviate key and public key using the OpenSSL command line tool.
RSA is an asymmetric encryption algorithm developed in 1977 that use a pair of private key and public key. RSA is the initials of the developers of the RSA algorithm: Ron Rivest, Adi Shamir, and Leonard Adleman. Today, RSA is probably the most used the encryption algorithm for the Internet communication.
Here is how to use OpenSSL to generate a new pair of RSA private key and public key:
herong> openssl genrsa -out herong_rsa.key Loading 'screen' into random state - done Generating RSA private key, 512 bit long modulus ..++++++++++++ ................++++++++++++ e is 65537 (0x10001) herong> more herong_rsa.key -----BEGIN RSA PRIVATE KEY----- MIIBOwIBAAJBANoK3b+0NV1xrFLjsKFPLrxMReu3ezPxLjDWjktakq9gDGM5WUvI CSENry/M1h2AhxGSxQluy4b1ynzBGWeO320CAwEAAQJAbQQn0NSKJflSvnLG+i/7 3vuHrg4j1FmOza5IoNZdJr9DyESMC+prebZkAFM2EW+ZLZy2JiEIqdDz79VAVRzs ZQIhAPBvHYEWxCIcSYn8aG7o2lyY5/EB1gvwgAfSdWFlemUDAiEA6CijmKOX1WRd KPf9g52Tpxk4TZzdjIpcbvYR7znIZs8CIBDxI3kXK5bju2LXwFwgWFKyC5X19Sk+ NydV8yN7zRYVAiEAni7CeUhONfmyeC2wsLL3Xg2TDV7qnc3QeVJ0mdl3MIUCIQCo o0AdFXm789FfHuB+mVIKNtBLTAQNaMuXz6lXl7Ib7Q== -----END RSA PRIVATE KEY-----
Note that:
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
Viewing Components of RSA Keys
OpenSSL Generating and Signing CSR
OpenSSL Validating Certificate Path
"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"