Created
December 5, 2012 23:27
-
-
Save DustinD2/4220480 to your computer and use it in GitHub Desktop.
This is a sample openssl bash script to create a matching RSA key pair and create a signed sha1 digest of the script itself using the private key. The digest is then verified against the public key.
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
#!/bin/bash | |
#create our key pairs | |
openssl genrsa -out private.pem 2048 | |
openssl rsa -in private.pem -pubout -out public.pem | |
#sign and verify | |
openssl dgst -sha1 -sign private.pem -out "$0".sha1 $0 | |
openssl dgst -sha1 -verify public.pem -signature "$0".sha1 $0 | |
#purposely not cleaning up after the program. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment