In my hopes to use
ssh-agent to generate a signature as password I implicitly assumed a deterministic signature. DSA is however supposed to take random value
k for signing. However that randomness is merely required for preventing attackers from obtaining the private key from the signatures of different messages. I used this Python script (slightly modified the output) to obtain the signature of a test message. However even after reconnecting or restarting the
ssh-agent (OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007 from msysgit 1.7.11), the signature of that message remains the same. But is this a behaviour I can rely on or could this change randomly e.g. when using a different
In my hopes to use
I do not observe this behaviour here. I use
ssh-agent from the
openssh-client package of Ubuntu 12.04, i.e. "OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012". I modified the Python script to select my DSA key instead of my RSA key (did you do the same ?) and I get, as expected, randomized signatures (no need to even restart
ssh-agent, two successive signatures are distinct).
It is theoretically possible to make deterministic DSA signatures through a process known as derandomization, which basically means that the random value k is no longer generated randomly, but with a deterministic PRNG seeded with both the message to be signed (or its hash) and a secret key (which can be the DSA private key itself, or a symmetric key stored along the DSA private key, if there is room fur such an extra key). There are a few subtleties to mind, because the k value must be selected with unpredictable uniform randomness. There is a draft RFC on that subject, but it is still quite new: I wrote the first version on March 2011. I am not aware of any other standardization effort on derandomization of DSA or ECDSA. Usually, when a DSA signature system appears to be deterministic, it is because of a very serious flaw in the random number generator (such as happened to Sony for the ECDSA signatures used in PS3 software).
Are you sure you are really using a DSA key ? A DSA signature has length 40 bytes in SSH (two 160-bit integers, since SHA-1 is used as hash function), whereas a RSA signature will be larger (128 bytes for a 1024-bit RSA key).