I have to encrypt a hash, eg:2c1400f69867571ab4e60d3b8f01e0b17c7be89e321f91f8a07cd39eeba202e2using the RSA algorithm by using a public key(eg: mykey.key) that was already provided to me. How do I go about doing this. I see sites telling me to use openssl, but I'm not sure how to go about this.Can anyone assist me?EDIT : I tried doing thisI created a file and push the hash in it by doing thisecho 2c1400f69867571ab4e60d3b8f01e0b17c7be89e321f91f8a07cd39eeba202e2 >file.txtthen followed by thisopenssl rsautl -inkey mykey.key -pubin -encrypt -in file.txt > file.txt.encwhen I tried to open file.txt.enc on notepad, i got this:ciphertext output http://i62.tinypic.com/imrmoh.pngNot sure if this is a successful encryption as I need the ciphertext result in binary format.
Encrypt a hash using RSA
encryption;openssl
Try:$ cat file.txt | openssl rsautl -encrypt -pubin -inkey mykey.key > secret.txtcat secret.txt}[4Or)fr_# more binary data here...and then:$ cat secret.txt | openssl rsautl -decrypt -inkey myprivatekey.key2c1400f69867571ab4e60d3b8f01e0b17c7be89e321f91f8a07cd39eeba202e2Both keys should be in PEM format.