Last active
August 19, 2022 10:16
-
-
Save tanvirstreame/f1295d0393c8d366c44a2842962acfe0 to your computer and use it in GitHub Desktop.
RSA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generate private.pem | |
openssl genrsa -out private.pem 512 | |
// Generate public.pem | |
openssl rsa -in private.pem -pubout > public.pem | |
// Encrypt | |
openssl rsautl -in text.txt -out secret.enc -pubin -inkey public.pem -encrypt | |
// Decrypt | |
openssl rsautl -in secret.enc -out secret.dec -inkey private.pem -decrypt | |
//PCKS1 padding sign file | |
openssl dgst -sha1 -sign private.pem -out sha1.sign text.txt | |
// Verify signature | |
openssl dgst -sha1 -verify public.pem -signature sha1.sign text.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment