OpenSSL "rsautl -decrypt" - Decryption with RSA Private Key

Q

How to decrypt a file with the RSA private key using OpenSSL "rsautl" command? I received a file that is encrypted with my RSA public key.

✍: FYIcenter.com

A

If you receive a file encrypted with your RSA public key and want to decrypt the file with your RSA private key, you can use the OpenSSL "rsault -decrypt" command as shown below:

C:\Users\fyicenter>\local\openssl\openssl.exe
OpenSSL> rsautl -decrypt -inkey my_rsa.key -in cipher.txt -out decipher.txt
OpenSSL> exit

C:\Users\fyicenter>type decipher.txt
The quick brown fox jumped over the lazy dog.

Options used in the "rsautl" command are:

  • "-decrypt" - Decrypt the input data with RSA keys.
  • "-inkey my_rsa_pub.key" - Read RSA key, the private key, from the given file.
  • "-in cipher.txt" - Read input data, the cipher text, from the given file.
  • "-out decipher.txt" - Save output data, the decipher text, to the given file.

 

OpenSSL "rsautl" Command for RSA Keys

⇒⇒OpenSSL Tutorials

2017-06-11, 997👍, 0💬