Skip to content

Instantly share code, notes, and snippets.

@zacharyvoase
Created June 24, 2011 11:32
Show Gist options
  • Save zacharyvoase/1044611 to your computer and use it in GitHub Desktop.
Save zacharyvoase/1044611 to your computer and use it in GitHub Desktop.
DSA signing using openssl CLI
openssl dsaparam 1024 < /dev/random > dsa_param.pem
openssl gendsa dsa_param.pem -out dsa_priv.pem
openssl dsa -in dsa_priv.pem -pubout -out dsa_pub.pem
# DSA system now made up of: dsa_param.pem, dsa_pub.pem, dsa_priv.pem
echo "foobar" > foo.txt
openssl sha1 < foo.txt > foo.txt.sha1
openssl dgst -dss1 -sign dsa_priv.pem foo.txt.sha1 > foo.txt.sig
openssl dgst -dss1 -verify dsa_pub.pem -signature foo.txt.sig foo.txt.sha1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment