mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-08 12:44:23 +01:00
Provide a useful pinentry prompt.
This commit is contained in:
parent
5b341a9a47
commit
03d34be425
@ -1,3 +1,9 @@
|
|||||||
|
2010-04-27 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* passphrase.c (gpg_format_keydesc): New.
|
||||||
|
* pubkey-enc.c (get_it): Use it.
|
||||||
|
* sign.c (do_sign): Use it.
|
||||||
|
|
||||||
2010-04-26 Werner Koch <wk@g10code.com>
|
2010-04-26 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* keygen.c (keygen_set_std_prefs): Explicitly include Z0 in the
|
* keygen.c (keygen_set_std_prefs): Explicitly include Z0 in the
|
||||||
|
@ -195,6 +195,9 @@ void set_next_passphrase( const char *s );
|
|||||||
char *get_last_passphrase(void);
|
char *get_last_passphrase(void);
|
||||||
void next_to_last_passphrase(void);
|
void next_to_last_passphrase(void);
|
||||||
|
|
||||||
|
char *gpg_format_keydesc (PKT_public_key *pk, int escaped);
|
||||||
|
|
||||||
|
|
||||||
/*-- getkey.c --*/
|
/*-- getkey.c --*/
|
||||||
void cache_public_key( PKT_public_key *pk );
|
void cache_public_key( PKT_public_key *pk );
|
||||||
void getkey_disable_caches(void);
|
void getkey_disable_caches(void);
|
||||||
|
@ -683,3 +683,57 @@ passphrase_to_dek (u32 *keyid, int pubkey_algo,
|
|||||||
s2k, mode, tryagain_text, NULL, NULL,
|
s2k, mode, tryagain_text, NULL, NULL,
|
||||||
canceled);
|
canceled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return an allocated utf-8 string describing the key PK. IF ESCAPED
|
||||||
|
is true spaces and control characters are percent or plus
|
||||||
|
escaped. */
|
||||||
|
char *
|
||||||
|
gpg_format_keydesc (PKT_public_key *pk, int escaped)
|
||||||
|
{
|
||||||
|
char *uid;
|
||||||
|
size_t uidlen;
|
||||||
|
const char *algo_name;
|
||||||
|
const char *timestr;
|
||||||
|
char *orig_codeset;
|
||||||
|
char *maink;
|
||||||
|
char *desc;
|
||||||
|
|
||||||
|
algo_name = gcry_pk_algo_name (pk->pubkey_algo);
|
||||||
|
if (!algo_name)
|
||||||
|
algo_name = "?";
|
||||||
|
timestr = strtimestamp (pk->timestamp);
|
||||||
|
uid = get_user_id (pk->keyid, &uidlen);
|
||||||
|
|
||||||
|
orig_codeset = i18n_switchto_utf8 ();
|
||||||
|
|
||||||
|
if (pk->main_keyid[2] && pk->main_keyid[3]
|
||||||
|
&& pk->keyid[0] != pk->main_keyid[2]
|
||||||
|
&& pk->keyid[1] != pk->main_keyid[3])
|
||||||
|
maink = xtryasprintf (_(" (main key ID %s)"), keystr (pk->main_keyid));
|
||||||
|
else
|
||||||
|
maink = NULL;
|
||||||
|
|
||||||
|
desc = xtryasprintf (_("Please enter the passphrase to unlock the"
|
||||||
|
" secret key for the OpenPGP certificate:\n"
|
||||||
|
"\"%.*s\"\n"
|
||||||
|
"%u-bit %s key, ID %s,\n"
|
||||||
|
"created %s%s.\n"),
|
||||||
|
(int)uidlen, uid,
|
||||||
|
nbits_from_pk (pk), algo_name,
|
||||||
|
keystr (pk->keyid), timestr,
|
||||||
|
maink?maink:"" );
|
||||||
|
xfree (maink);
|
||||||
|
xfree (uid);
|
||||||
|
|
||||||
|
i18n_switchback (orig_codeset);
|
||||||
|
|
||||||
|
if (escaped)
|
||||||
|
{
|
||||||
|
char *tmp = percent_plus_escape (desc);
|
||||||
|
xfree (desc);
|
||||||
|
desc = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
@ -196,7 +196,7 @@ get_it (PKT_pubkey_enc *enc, DEK *dek, PKT_public_key *sk, u32 *keyid)
|
|||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
/* Decrypt. */
|
/* Decrypt. */
|
||||||
desc = xtrystrdup ("FIXME: Format a description");
|
desc = gpg_format_keydesc (sk, 1);
|
||||||
err = agent_pkdecrypt (NULL, keygrip, desc, s_data, &frame, &nframe);
|
err = agent_pkdecrypt (NULL, keygrip, desc, s_data, &frame, &nframe);
|
||||||
xfree (desc);
|
xfree (desc);
|
||||||
gcry_sexp_release (s_data);
|
gcry_sexp_release (s_data);
|
||||||
|
@ -313,13 +313,10 @@ do_sign (PKT_public_key *pksk, PKT_signature *sig,
|
|||||||
char *desc;
|
char *desc;
|
||||||
gcry_sexp_t s_sigval;
|
gcry_sexp_t s_sigval;
|
||||||
|
|
||||||
/* FIXME: desc = gpgsm_format_keydesc (cert); */
|
desc = gpg_format_keydesc (pksk, 1);
|
||||||
desc = xtrystrdup ("FIXME: Format a description");
|
|
||||||
|
|
||||||
err = agent_pksign (NULL/*ctrl*/, hexgrip, desc,
|
err = agent_pksign (NULL/*ctrl*/, hexgrip, desc,
|
||||||
dp, gcry_md_get_algo_dlen (mdalgo), mdalgo,
|
dp, gcry_md_get_algo_dlen (mdalgo), mdalgo,
|
||||||
&s_sigval);
|
&s_sigval);
|
||||||
|
|
||||||
xfree (desc);
|
xfree (desc);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user