- Use dsaparam to generate DSA parameters(p, q, g), used to generate keys (possibly several keys):
openssl dsaparam 1024 > dsaparam.pem
- Generate key file (contains private and public key):
openssl gendsa dsaparam.pem -out dsa_key.pem
Or, if the parameters p,q,g weren't precomputed (step 1):
openssl dsaparam -noout -out dsa_key.pem -genkey 1024
- Extract public key
openssl.exe dsa -in dsa_key.pem -pubout -out dsa_pub_key.pem
- Generate sha1 hash of a file.
openssl dgst -sha1 foo.txt | awk '{print $2}' > foo.txt.sha1
- Sign the hash
openssl dgst -dss1 -sign dsa_key.pem text.txt.sha1 >foo.txt.sig
- Verify the signature (using public key)
openssl dgst -dss1 -verify dsa_pub_key.pem -signature foo.txt.sig foo.txt.sha1
Links:
hi
ReplyDeletehi:)
ReplyDeleteI agree that OpenSSL is cryptography library with lots of useful features and functions moreover it is available free as its opensource.I never needed to use it but today I was given an assignment that needed me to use it.Your steps helped me a lot so thanks for writing.
ReplyDelete