How to Determine Digest Algorithm

Patrick Brunschwig patrick at mozilla-enigmail.org
Wed Dec 20 17:40:41 CET 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Shaw wrote:
> On Tue, Dec 19, 2006 at 09:33:25AM +0100, Patrick Brunschwig wrote:
>> I'm trying to find a good way to determine the digest algorithm that
>> GnuPG uses for a signed message. My problem is this: for PGP/MIME signed
>> messages, I need to know the algorithm before the message is created.
>> Therefore I create a signed dummy message, and extract from it the hash
>> algorithm. However, the problem is that this requires the user to type
>> the passphrase twice, which I would like to avoid.
> 
> What mutt does for this is to make the signature first and grab the
> digest algorithm from that to make the micalg field.  Does that method
> not work given the way Enigmail ties into the mail code?

Unfortunately not, or at least not without a major rewrite of a large part.

>> Is there a better way to determine the hash algorithm without actually
>> creating a signed message?
> 
> At the moment, not really, but it's not impossible to add a way to ask
> GPG the question "if you were going to make a signature, which hash
> algorithm would you use".

That would be nice for the future, but I think in short term, I'll find
a way to cache the passphrase for the 2nd call to gpg.

- -Patrick
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEVAwUBRYlniHcOpHodsOiwAQJs5AgAhoi2EwjaaXgYqlk8eOLRkSZEw851Gveq
UvizHDfDGJzZliGGD92l+xypE3Wqt6EvvsXVQQkrkTv4J5eXODosn5w5gvbswryn
IYBCSUq2pTl22uZqxXpalE+1ouXaFJpEA4lmwZyP0LOP/0bbBt/1GPGSYAEZHWPq
VEw4EaPtEZJaM+ZakCX03V11Cx4QM8SRD0Wz4Trfqu6YDkE/azEUZyFXNEzp0K8a
JoLTwtDROdRLN5qck+hFWjNjtovppTV0RnUCjccGGIV56qV8OHgLRhXA6I9z0UuL
NMxxRlvP0HAWg90Hic7tM7Py+/9FaqiEWXknVRUCTIgelgL1lapHJA==
=cOMp
-----END PGP SIGNATURE-----




More information about the Gnupg-devel mailing list