Openssl decryption using a public key

Issue

I need to decrypt a file which is encrypted using a private key. I have a public key which I can use to decrypt this file. How can I do this. I did:

openssl rsautl -in file -inkey key.pem

But this is not working. This shows the error as:

unable to load Private Key
3074128072:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:696:Expecting: ANY PRIVATE KEY

Solution

Public keys cannot be used to decrypt, they can only be used to encrypt and to verify the encryption signature.

Answered By – Ignacio Vazquez-Abrams

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published