RSA (Rivest Shamir Adleman)
Last modified: 2023-02-21
RSA is a public-key cryptosystem that is widely used for secure data transmission.
Decrypt
openssl pkeyutl -decrypt -in ciphertext -inkey private-key.pem
Encrypt
openssl pkeyutl -encrypt -in plain.txt -inkey public-key.pem -pubin
Generate a Keypair
Generate a Private Key
# genrsa: Generate an RSA private key
openssl genrsa -out private-key.pem 2048
Generate a Public Key
We use the private key which was generated in the previous section.
openssl rsa -in private-key.pem -pubout -out public-key.pem
View the Prime Number
openssl rsa -in private-key.pem -text -noout
Diffie-Hellman Exchange
openssl dhparam -out dhparams.pem 2048
View the Prime Number
openssl dhparam -in dhparams.pem -text -noout