# CREATE A SECRET (FILE) # mon_info_privee.txt # mon_info_publique.txt # mon_image.jpg # DIGEST image.jpg echo "IMAGE DIGEST" cat mon_image.jpg | openssl dgst -md5 # ENCODE echo "IMAGE DIGEST" cat mon_image.jpg | openssl enc -base64 > mon_image.jpg.base64 #DECODE echo "IMAGE DECODE" cat son_image.jpg.base64 | openssl enc -base64 > son_image.jpg # GENERATE RSA KEY echo "RSA PRIV KEY GEN" openssl genrsa > ma_clef_priv_rsa.pem echo ma_clef_rsa.pem # PUBLIC KEY echo "RSA PUB KEY GEN" openssl rsa -in ma_clef_priv_rsa.pem -pubout > ma_clef_pub_rsa.pem echo ma_clef_pub_rsa.pem # SIGN file openssl rsautl -sign -in mon_info_publique.txt -inkey ma_clef_priv_rsa.pem | openssl enc -base64 > mon_info_publique_signature.txt # VERIFY signature cat mon_info_publique_signature.txt | openssl base64 -d | openssl rsautl -verify -inkey ma_clef_pub_rsa.pem -pubin # ENCRYPT openssl rsautl -encrypt -pubin -inkey ma_clef_pub_rsa.pem -in mon_info_privee.txt -out mon_info_privee.txt.rsa # DECRYPT openssl rsautl -decrypt -inkey ma_clef_priv_rsa.pem -in mon_info_privee.txt.rsa