Generate a RSA Private Key

openssl genrsa -out privkey.pem

Generate a RSA Public Key

openssl rsa -in privkey.pem -pubout > publkey.pem

Generate a Certificate Request(need this to self signed a certificate)

openssl req -out my_test_certificate.csr -key privkey.pem -new

Generate a Certificate(Contains our Public Key)

openssl req -x509 -key privkey.pem -in my_test_certificate.csr -out my_test_certificate.crt -days 365

Generate a Personal Information Key(Contains our Private key)

openssl pkcs12 -export -in my_test_certificate.crt -inkey privkey.pem -out personal_info.pfx

.crt and .pfx are recognized formats for windows so for safe keeping you can store your keys in the machine key store. 

 Encryption is done with the public key, decryption done with the private key

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.