openssl genrsa -out privkey.pem 1024You can create an encrypted key by adding the -des3 option.
openssl req -new -key privkey.pem -out certreq.csr( This is also the type of CSR you would create to send to a root CA for them to sign for you. )
openssl x509 -req -days 3650 -in certreq.csr -signkey privkey.pem -out newcert.pem
vi /etc/ssl/openssl.cnf /usr/lib/ssl/misc/CA.pl -newcaYour copy of openssl.cnf and CA.pl may be located elsewhere.
openssl req -new -x509 -key privkey.pem -out cert.pem
cat cert.pem privkey.pem | openssl x509 -x509toreq -signkey privkey.pem -out certreq.csr
openssl ca -in certreq.csr -out newcert.pem rm -f certreq.csr
( openssl x509 -in newcert.pem; cat privkey.pem ) > server.pem ln -s server.pem `openssl x509 -hash -noout -in server.pem`.0 # dot-zero( The server.pem is a PEM file that can be used by apache along with the hash file. )
openssl req -noout -text -in certreq.csrYou can view the contents of a certificate with:
openssl x509 -noout -text -in newcert.pemYou can display the MD5 fingerprint of a certificate with:
openssl x509 -fingerprint -noout -in newcert.pemYou can verify that your private key, CSR, and signed cert match by comparing:
openssl rsa -noout -modulus -in privkey.pem |openssl md5 openssl req -noout -modulus -in certreq.csr |openssl md5 openssl x509 -noout -modulus -in newcert.pem |openssl md5