Algorithm preferences

Huels, Ralf KSV
Tue Mar 13 10:26:02 2001

As changing the prefs seems to be near FAQ status and I didn't find much on
subject in the FAQ list, I attempted a brief write-up. 

If there aren't too many errors, Nils may use this for the FAQ list.
There is one thing I don't quite recall and am too lazy to research in the 
archive: is it possible to change the prefs on an existing key by removing
and re-creating a self-signature or some other similar manoeuvre?


Q: What is the list of preferred algorithms?

A: The list of preferred algorithms is a list of cypher, hash and
algorithms coded into the self-signature of a key on key generation. The
is used by software encrypting a document with your public key to determine
which algorithms to use. Basically it tells other people what algorithms you
are able to handle. The GnuPG default at the time of this writing (gpg
is RIJNDAEL, TWOFISH, CAST5 and BLOWFISH for cipher algorithms, RMD160 and
for hash algorithms and ZLIB and ZIP for compression algorithms.

Q: How can I change the default preferred algorithm list?

A: Currently (gpg 1.0.4), the default is hard-wired into the GnuPG source
You'll have to change g10/keygen.c and recompile. The function you'll have
change is keygen_add_std_prefs, which contains the following code:

    buf[2] = CIPHER_ALGO_CAST5;
    build_sig_subpkt( sig, SIGSUBPKT_PREF_SYM, buf, 4 );

    buf[0] = DIGEST_ALGO_RMD160;
    buf[1] = DIGEST_ALGO_SHA1;
    build_sig_subpkt( sig, SIGSUBPKT_PREF_HASH, buf, 2 );

    buf[0] = 2;
    buf[1] = 1;
    build_sig_subpkt( sig, SIGSUBPKT_PREF_COMPR, buf, 2 );

The constants used to denote the algorithms are defined in include/cipher.h
Configuring the preference lists through run-time options and possibly even
editing the list on existing keys is planned for future versions.

Ralf Hüls                                                  Bismarckplatz
KSV Kreditschutz-Vereinigung GmbH                           44866 Bochum
Score-Consult                                         Tel. 02327/9114-28                                 Fax. 02327/8 40 27