OpenSSL – Generate a RSA Key and Keystore

I will show you how to generate the following files using OpenSSL.

  • Private Key
  • Certificate Signing Request
  • X.509 Certificate/Public Key
  • PKCS12 Keystore

Generate the Private Key with 1024 key size – test.key

  • openssl genrsa -out test.key 1024


Generate the Certificate Signing Request – test.csr

  • openssl req -new -key test.key -out test.csr


Generate the X.509 Certificate/Public Key which has 365 effective days – test.cert

  • openssl x509 –req –days 365 -in test.csr -signkey test.key -sha1 –out test.cert


Generate the PKCS12 Keystore – text.p12

  • openssl pkcs12 -name test -export -in test.cert -inkey test.key -out test.p12


Done =)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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