--batch --gen-key error with "Key-Type: default"

Mikael Nordfeldth mmn at hethane.se
Tue Jul 30 00:40:40 CEST 2013


2013-07-26 13:08, Werner Koch skrev:
> On Fri, 26 Jul 2013 12:12, mmn at hethane.se said:
> 
>> Nevertheless, is there any interest in making gnupg 1.x support the
>> 'default' algorithm feature?
> No. [...]
> 
> However, if it is a simple change, I would accept it, anyway.  In master
> this was commit 49b00ffd.

Something like the attached patch? I made it the same defaults as gnupg2
has (RSA-2048). The code is almost entirely copied from 49b00ffd. It
applies cleanly to gnupg-1.4.14 and current state of STABLE-BRANCH-1-4

The only thing I haven't added was a changelog entry explaining the
differences like the changelog entry for 49b00ffd:

       * keygen.c (DEFAULT_STD_ALGO, DEFAULT_STD_KEYSIZE): New.
       (ask_keysize): Use new macro.
       (gen_rsa): Set default size if NBITS is 0.
       (get_parameter_algo): Add algo name "default".  Add arg R_DEFAULT.
       (proc_parameter_file): Process default flag.


Essentially the only thing (except for some line layouts and
indentations) I had to modify to fit gnupg1.x was the algorithm
numerical ID mapping macro (#define DEFAULT_STD_ALGO  is set to
PUBKEY_ALGO_RSA instead of GCRY_PK_RSA, both equaling numeric 1 for RSA)

checks/tests run as they should. Keep note though that I am not the most
experienced C developer and I encourage others to verify the patch as I
may have missed some small detail in difference between gnupg and
gnupg2. But I made sure at least that there are no left over unchanged
get_parameter_algo calls or anything.

-- 
Mikael Nordfeldth
http://blog.mmn-o.se/
Xmpp/mail: mmn at hethane.se
-------------- next part --------------
A non-text attachment was scrubbed...
Name: default_key_type_backport_from_gnupg2_to_gnupg1.patch
Type: text/x-patch
Size: 9549 bytes
Desc: not available
URL: </pipermail/attachments/20130730/3262f3cb/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 553 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20130730/3262f3cb/attachment.sig>


More information about the Gnupg-users mailing list