How To Create RSA Public and Private Key?

RSS
FACEBOOK
FACEBOOK
PINTEREST
PINTEREST
LINKEDIN
INSTAGRAM

RSA is an algorithm used for Cryptography. It was patented until 2000 in USA (not whole world) where now it can be used freely. RSA has a lot of usage examples but it is mainly used for encryption of small pieces of data like key and Digital signatures. RSA is based integer factorization problem. As it is known that asymmetric ciphers are very slow against symmetric ciphers. So it is used with symmetric cipher like AES to secure bulk data. Using with AES and RSA together named hybrid usage. Here are some practical RSA tools to manage.

Create Key

In order to manage RSA key we need to create it firstly. we specify the output type where it is file named t1.key and the size of the key with 2048. We used verb genrsa with OpenSSL. By default keys are created in PEM format as it shown with file command.

Create Key

Create Key

Convert Pem into Der

Formats are used to encode created RSA key and save into a file. Pem is common format but sometime you need to use DER format. Here is how it can be done. We specify input form and output form with inform and outform parameters and than show existing file with in and created file wirh out. Then we check file as we see that data as file typr because of the binary type. Der is not encoded base64 like pem format.

LEARN MORE  How To Setup SSH Keys

Encrypting RSA Key with AES

Private keys are very sensitive if we transmit it over insecure places we should encrypt it with symmetric keys. Here we use AES with 128 bit key and we set encrypted RSA key file with out parameter. Or while generating the RSA key pair it can be encrypted too.

Encrypting RSA Key with AES

Encrypting RSA Key with AES

List/Show Public Key

A public key in a RSA key pair can be viewed or exported. Below we view with pubout parameter the public key. If we give -out against -text the public key will be written to the file.

List/Show Public Key

List/Show Public Key

RSS
FACEBOOK
FACEBOOK
PINTEREST
PINTEREST
LINKEDIN
INSTAGRAM

Leave a Reply

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

Enjoy this blog? Please spread the word :)