aboutsummaryrefslogtreecommitdiffstats
path: root/g10/passphrase.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--g10/passphrase.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/g10/passphrase.c b/g10/passphrase.c
index 7a3a394b5..4302075b7 100644
--- a/g10/passphrase.c
+++ b/g10/passphrase.c
@@ -673,35 +673,41 @@ agent_get_passphrase ( u32 *keyid, int mode, const char *tryagain_text,
const char *algo_name = pubkey_algo_to_string ( pk->pubkey_algo );
const char *timestr;
char *maink;
- const char *fmtstr;
if ( !algo_name )
algo_name = "?";
-
- fmtstr = _(" (main key ID %08lX)");
- maink = m_alloc ( strlen (fmtstr) + 20 );
+
+#define KEYIDSTRING _(" (main key ID %s)")
+
+ maink = m_alloc ( strlen (KEYIDSTRING) + keystrlen() + 20 );
if( keyid[2] && keyid[3] && keyid[0] != keyid[2]
&& keyid[1] != keyid[3] )
- sprintf( maink, fmtstr, (ulong)keyid[3] );
+ sprintf( maink, KEYIDSTRING, keystr(&keyid[2]) );
else
*maink = 0;
uid = get_user_id ( keyid, &uidlen );
timestr = strtimestamp (pk->timestamp);
- fmtstr = _("You need a passphrase to unlock the"
- " secret key for user:\n"
- "\"%.*s\"\n"
- "%u-bit %s key, ID %08lX, created %s%s\n" );
- atext = m_alloc ( 100 + strlen (fmtstr)
- + uidlen + 15 + strlen(algo_name) + 8
+
+#undef KEYIDSTRING
+
+#define PROMPTSTRING _("You need a passphrase to unlock the secret" \
+ " key for user:\n" \
+ "\"%.*s\"\n" \
+ "%u-bit %s key, ID %s, created %s%s\n" )
+
+ atext = m_alloc ( 100 + strlen (PROMPTSTRING)
+ + uidlen + 15 + strlen(algo_name) + keystrlen()
+ strlen (timestr) + strlen (maink) );
- sprintf (atext, fmtstr,
+ sprintf (atext, PROMPTSTRING,
uidlen, uid,
- nbits_from_pk (pk), algo_name, (ulong)keyid[1], timestr,
+ nbits_from_pk (pk), algo_name, keystr(&keyid[0]), timestr,
maink );
m_free (uid);
m_free (maink);
-
+
+#undef PROMPTSTRING
+
{
size_t dummy;
fingerprint_from_pk( pk, fpr, &dummy );