diff -r 889dfa7eace0 -r 68d27bdf49c9 ssl/conversion.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssl/conversion.txt Fri Jul 18 15:48:34 2014 +0200 @@ -0,0 +1,29 @@ +http://superuser.com/questions/576506/how-to-use-ssh-rsa-public-key-to-encrypt-a-text +http://goodworkaround.com/node/17 + +OpenSSH -> OpenSSL +================== + + * Pubkey conversion: + + ssh-keygen -f ~/.ssh/id_rsa.pub -e -m pkcs8 > /tmp/id_rsa.pub.pem + + +OpenSSL operations +================== + + * Encryption: + + openssl rsautl -encrypt -pubin -inkey /tmp/id_rsa.pub.pem > /tmp/c.txt + + * Decryption: + + openssl rsautl -decrypt -inkey ~/.ssh/id_rsa -in /tmp/c.txt + + * Signing: + + openssl dgst -sha1 -sign ~/.ssh/id_rsa file.txt > file.txt.sig + + * Verification: + + openssl dgst -sha1 -verify /tmp/id_rsa.pub.pem -signature file.txt.sig file.txt