Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm looking for a Linux/Unix command-line tool to create a DSA signature from a given file/data and a private key

I know about the xmlsec1 tool from: http://www.aleksey.com/xmlsec/

But I would like something simpler. The openssl tool doesn't appear to have this function. It seems that OpenSSL provides this function as a developer library, but not as a tool.

Thanks!

share|improve this question
add comment

3 Answers

It's done with "openssl dgst" - not the most obvious place to put it...

Found in:

http://www.myelin.co.nz/post/2005/5/23/

openssl dsaparam 1024 < /dev/random > dsaparam.pem

openssl gendsa dsaparam.pem -out dsa_priv.pem

openssl dsa -in dsa_priv.pem -pubout -out dsa_pub.pem

echo "foobar" > foo.txt

sha1sum < foo.txt | awk '{print $1}' > foo.sha1

openssl dgst -dss1 -sign dsa_priv.pem foo.sha1 > sigfile.bin

openssl dgst -dss1 -verify dsa_pub.pem -signature sigfile.bin foo.sha1

share|improve this answer
add comment

Have you looked at:

share|improve this answer
    
Yes, these manage the keys, but don't encrypt/decrypt. –  mparaz Jan 9 '11 at 8:44
add comment

Do you want to create a signature for a file such that the integrity of that file can be verified? I think you're looking for Gnu Privacy Guard (GnuPG).

gpg --output filename.sig --detach-sig filename

This creates a signature file, filename.sig, based on the original, filename, that can be verified with

gpg --verify filename.sig filename
share|improve this answer
    
Was looking for something simpler, just using the DSA private key without GPG infrastructure, but let me see if this will do. –  mparaz Jan 9 '11 at 8:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.