Card Size Selection

Werner Koch wk at gnupg.org
Tue May 25 19:23:58 CEST 2010


On Tue, 25 May 2010 17:17, nicholas.cole at gmail.com said:

> If I select key size '2048', the size of key 2 is changed to 1024
> automatically (with the message 'gpg: size of key 2 changed to 1024
> bits').

Yeah, that is a bug.  1.4.10 uses this code to create the backup key:

  rc = generate_raw_key (algo, 1024, timestamp,
                         &sk_unprotected, &sk_protected);

Here the v1 card is still hardwired.  In 2.0.x we use this code

  /* Get the size of the key directly from the card.  */
  {
    struct agent_card_info_s info;
    
    memset (&info, 0, sizeof info);
    if (!agent_scd_getattr ("KEY-ATTR", &info)
        && info.key_attr[1].algo)
      nbits = info.key_attr[1].nbits;
    else
      nbits = 1024; /* All pre-v2.0 cards.  */
    agent_release_card_info (&info);
  }

  /* Create a key of this size in memory.  */
  rc = generate_raw_key (algo, nbits, timestamp,
                         &sk_unprotected, &sk_protected);


This needs to be fixed (bug#1230).


Thanks,

   Werner


-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gnupg-devel mailing list