1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-28 15:57:03 +01:00

* keyedit.c (sign_uids): If --expert it set, allow re-signing a uid to

promote a v3 self-sig to a v4 one.  This essentially deletes the old v3
self-sig and replaces it with a v4 one.
This commit is contained in:
David Shaw 2002-05-07 04:27:40 +00:00
parent 50c9a5bd25
commit 2e56b988c8
3 changed files with 66 additions and 23 deletions

View File

@ -1,5 +1,9 @@
2002-05-07 David Shaw <dshaw@jabberwocky.com> 2002-05-07 David Shaw <dshaw@jabberwocky.com>
* keyedit.c (sign_uids): If --expert it set, allow re-signing a
uid to promote a v3 self-sig to a v4 one. This essentially
deletes the old v3 self-sig and replaces it with a v4 one.
* packet.h, parse-packet.c (parse_key), getkey.c * packet.h, parse-packet.c (parse_key), getkey.c
(merge_keys_and_selfsig, merge_selfsigs_main): a v3 key with a v4 (merge_keys_and_selfsig, merge_selfsigs_main): a v3 key with a v4
self-sig must never let the v4 self-sig express a key expiration self-sig must never let the v4 self-sig express a key expiration

View File

@ -1049,10 +1049,10 @@ merge_keys_and_selfsig( KBNODE keyblock )
} }
} }
if(pk->expiredate==0 || pk->expiredate>pk->max_expiredate) if(pk && (pk->expiredate==0 || pk->expiredate>pk->max_expiredate))
pk->expiredate=pk->max_expiredate; pk->expiredate=pk->max_expiredate;
if(sk->expiredate==0 || sk->expiredate>sk->max_expiredate) if(sk && (sk->expiredate==0 || sk->expiredate>sk->max_expiredate))
sk->expiredate=sk->max_expiredate; sk->expiredate=sk->max_expiredate;
} }
} }

View File

@ -374,6 +374,28 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
uidnode->pkt->pkt.user_id->len, uidnode->pkt->pkt.user_id->len,
0); 0);
/* It's a v3 self-sig. Make it into a v4 self-sig? */
if(node->pkt->pkt.signature->version<4 && selfsig)
{
tty_printf(_("The self-signature on \"%s\"\n"
"is a PGP 2.x-style signature.\n"),user);
/* Note that the regular PGP2 warning below
still applies if there are no v4 sigs on
this key at all. */
if(opt.expert)
if(cpr_get_answer_is_yes("sign_uid.v4_promote_okay",
_("Do you want to promote "
"it to an OpenPGP self-"
"signature? (y/N) ")))
{
force_v4=1;
node->flag|=NODFLG_DELSIG;
continue;
}
}
if(!node->pkt->pkt.signature->flags.exportable && !local) if(!node->pkt->pkt.signature->flags.exportable && !local)
{ {
/* It's a local sig, and we want to make a /* It's a local sig, and we want to make a
@ -381,7 +403,7 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
tty_printf(_("Your current signature on \"%s\"\n" tty_printf(_("Your current signature on \"%s\"\n"
"is a local signature.\n"),user); "is a local signature.\n"),user);
if(cpr_get_answer_is_yes("sign_uid.promote_okay", if(cpr_get_answer_is_yes("sign_uid.local_promote_okay",
_("Do you want to promote " _("Do you want to promote "
"it to a full exportable " "it to a full exportable "
"signature? (y/N) "))) "signature? (y/N) ")))
@ -558,6 +580,22 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
m_free(p); p = NULL; m_free(p); p = NULL;
tty_printf("\"\n"); tty_printf("\"\n");
if(selfsig)
{
tty_printf(_("\nThis will be a self-signature.\n"));
if( local )
tty_printf(
_("\nWarning: the signature will not be marked "
"as non-exportable.\n"));
if( nonrevocable )
tty_printf(
_("\nWarning: the signature will not be marked "
"as non-revocable.\n"));
}
else
{
if( local ) if( local )
tty_printf( tty_printf(
_("\nThe signature will be marked as non-exportable.\n")); _("\nThe signature will be marked as non-exportable.\n"));
@ -580,6 +618,7 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
tty_printf(_("\nI have checked this key very carefully.\n")); tty_printf(_("\nI have checked this key very carefully.\n"));
break; break;
} }
}
tty_printf("\n"); tty_printf("\n");
@ -642,7 +681,7 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
} }
} }
/* Delete any local sigs that got promoted */ /* Delete any sigs that got promoted */
for( node=keyblock; node; node = node->next ) for( node=keyblock; node; node = node->next )
if( node->flag & NODFLG_DELSIG) if( node->flag & NODFLG_DELSIG)
delete_kbnode(node); delete_kbnode(node);