1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-10 13:04:23 +01:00

* keygen.c (do_add_key_flags): Don't set the certify flag for subkeys.

(ask_algo): Provide key flags for DSA, Elgamal_e, and Elgamal subkeys.
(generate_keypair): Provide key flags for the default DSA/Elgamal keys.
This commit is contained in:
David Shaw 2003-07-16 03:09:15 +00:00
parent c7698f6cb3
commit 5d65681eb6
2 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2003-07-15 David Shaw <dshaw@jabberwocky.com>
* keygen.c (do_add_key_flags): Don't set the certify flag for
subkeys.
(ask_algo): Provide key flags for DSA, Elgamal_e, and Elgamal
subkeys.
(generate_keypair): Provide key flags for the default DSA/Elgamal
keys.
2003-07-04 David Shaw <dshaw@jabberwocky.com> 2003-07-04 David Shaw <dshaw@jabberwocky.com>
* misc.c (pct_expando): Minor performance tweak. Don't bother to * misc.c (pct_expando): Minor performance tweak. Don't bother to

View File

@ -137,7 +137,12 @@ do_add_key_flags (PKT_signature *sig, unsigned int use)
buf[0] = 0; buf[0] = 0;
if (use & PUBKEY_USAGE_SIG) if (use & PUBKEY_USAGE_SIG)
buf[0] |= 0x01 | 0x02; {
if(sig->sig_class==0x18)
buf[0] |= 0x02; /* Don't set the certify flag for subkeys */
else
buf[0] |= 0x01 | 0x02;
}
if (use & PUBKEY_USAGE_ENC) if (use & PUBKEY_USAGE_ENC)
buf[0] |= 0x04 | 0x08; buf[0] |= 0x04 | 0x08;
build_sig_subpkt (sig, SIGSUBPKT_KEY_FLAGS, buf, 1); build_sig_subpkt (sig, SIGSUBPKT_KEY_FLAGS, buf, 1);
@ -996,15 +1001,18 @@ ask_algo (int addmode, unsigned int *r_usage)
_("Create anyway? "))) _("Create anyway? ")))
{ {
algo = PUBKEY_ALGO_ELGAMAL; algo = PUBKEY_ALGO_ELGAMAL;
*r_usage = PUBKEY_USAGE_ENC | PUBKEY_USAGE_SIG;
break; break;
} }
} }
else if( algo == 3 && addmode ) { else if( algo == 3 && addmode ) {
algo = PUBKEY_ALGO_ELGAMAL_E; algo = PUBKEY_ALGO_ELGAMAL_E;
*r_usage = PUBKEY_USAGE_ENC;
break; break;
} }
else if( algo == 2 ) { else if( algo == 2 ) {
algo = PUBKEY_ALGO_DSA; algo = PUBKEY_ALGO_DSA;
*r_usage = PUBKEY_USAGE_SIG;
break; break;
} }
else else
@ -2005,6 +2013,11 @@ generate_keypair( const char *fname )
strcpy( r->u.value, "1024" ); strcpy( r->u.value, "1024" );
r->next = para; r->next = para;
para = r; para = r;
r = m_alloc_clear( sizeof *r + 20 );
r->key = pKEYUSAGE;
strcpy( r->u.value, "sign" );
r->next = para;
para = r;
algo = PUBKEY_ALGO_ELGAMAL_E; algo = PUBKEY_ALGO_ELGAMAL_E;
r = m_alloc_clear( sizeof *r + 20 ); r = m_alloc_clear( sizeof *r + 20 );
@ -2012,6 +2025,11 @@ generate_keypair( const char *fname )
sprintf( r->u.value, "%d", algo ); sprintf( r->u.value, "%d", algo );
r->next = para; r->next = para;
para = r; para = r;
r = m_alloc_clear( sizeof *r + 20 );
r->key = pSUBKEYUSAGE;
strcpy( r->u.value, "encrypt" );
r->next = para;
para = r;
} }
else { else {
r = m_alloc_clear( sizeof *r + 20 ); r = m_alloc_clear( sizeof *r + 20 );