openssl-rsa+example

=OpenSSL and RSA Example= Main Menu


 * OpenSSL Commands Used Below:**
 * genrsa - generate RSA private key
 * rsa - RSA key processing tool
 * rsautl - used to sign, verify, encrypt, and decrypt using RSA

Install OpenSSL on CentOS
OpenSSL is typically installed on CentOS by default. The following will install the software if necessary:
 * **yum install openssl**

Configure OpenSSL on CentOS
> **cd /etc/pki/CA** > **mkdir certs** > **mkdir crl** > **mkdir newcerts** > **touch index.txt** > **echo '01' > serial** > **echo '01' > crlnumber** > **cp /etc/pki/tls/openssl.cnf openssl.cnf** >> from **dir = ../../CA # Where everything is kept** >> to **dir =. # Where everything is kept** >> from **certificate = $dir/cacert.pem # The CA certificate** >> to **certificate = $dir/certs/ca.crt # The CA certificate** >> from **private_key = $dir/private/cakey.pem# The private key** >> to **private_key = $dir/private/ca.key # The private key** > **chmod 0600 openssl.cnf**
 * 1) Change working directory to **/etc/pki/CA**
 * 1) Create a foloder to hold the Certificates
 * 1) Create a folder to hold the Certificate Revocation List
 * 1) Create a folder to hold the Server Certificates in PEM (unencrypted) format
 * 1) Create a file that holds the database of certificates
 * 1) Create a file that holds the next certificate serial number
 * 1) Create a file that holds the next Certificate Revocation List serial number
 * 1) Make a copy the systems default openssl configuration file for our use
 * 1) Edit the **/etc/pki/CA/openssl.cnf**file making the following changes
 * 2) Change following line
 * 1) Change following line
 * 1) Change following line
 * 1) Make the **/etc/pki/CA/openssl.cnf** file not world readable

RSA Example

 * **Create a 2048-bit RSA key pair**


 * **Store private key as //private.key// and public key as //public.key//**


 * **public.key**


 * **private.key**


 * **Create text file containing full name**


 * **Encrypt //input.txt// file and save as //input.rsa//**


 * **Cannot open encrypted file**


 * **Decrypt //input.rsa// file**


 * **Extract p, q, n, e, and d from public/private key pair**

@http://www.openssl.org/ @http://www.openssl.org/docs/HOWTO/keys.txt @http://www.linuxjournal.com/article/6826 @http://www.devco.net/archives/2006/02/13/public_-_private_key_encryption_using_openssl.php @http://www.vidarholen.net/contents/blog/?p=24 @http://en.wikipedia.org/wiki/RSA
 * Resources**