gpgme: gpgme_op_sign '[User ID hint missing]' in passphrase callback

Werner Koch wk at
Mon Jun 25 23:43:06 CEST 2001

 || On Fri, 22 Jun 2001 09:54:13 -0400 (EDT)
 || Bart Trojanowski <bart at> wrote: 

 bt> So I should be able to use this last line to query gpgme for the name
 bt> associated with the key, right?  Can this be done from within the
 bt> passphrase callback.  Do I need a second context?

Here is what I do in Sylpheed.  Not very sophisticated but you get the

static gint 
linelen (const gchar *s)
    gint i;

    for (i = 0; *s && *s != '\n'; s++, i++)

    return i;

static GtkWidget *
create_description (const gchar *desc)
    const gchar *cmd=NULL, *uid=NULL, *info=NULL;
    gchar *buf;
    GtkWidget *label;

    cmd = desc;
    uid = strchr (cmd, '\n');
    if (uid) {
        info = strchr (++uid, '\n');
        if (info )

    if (!uid)
        uid = _("[no user id]");
    if (!info)
        info = "";

    buf = g_strdup_printf (_("%sPlease enter the passphrase for:\n\n"
                           "  %.*s  \n"
                           !strncmp (cmd, "TRY_AGAIN", 9 ) ?
                           _("Bad passphrase! Try again...\n\n") : "",
                           linelen (uid), uid, linelen (info), info);

    label = gtk_label_new (buf);
    g_free (buf);

    return label;

Werner Koch        Omnis enim res, quae dando non deficit, dum habetur
g10 Code GmbH      et non datur, nondum habetur, quomodo habenda est.
Privacy Solutions                                        -- Augustinus

More information about the Gnupg-devel mailing list