aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/main.h1
-rw-r--r--g10/misc.c17
-rw-r--r--g10/photoid.c11
3 files changed, 24 insertions, 5 deletions
diff --git a/g10/main.h b/g10/main.h
index 6876e0a95..8d29071ff 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -109,6 +109,7 @@ struct expando_args
byte imagetype;
int validity_info;
const char *validity_string;
+ const byte *namehash;
};
char *pct_expando(const char *string,struct expando_args *args);
diff --git a/g10/misc.c b/g10/misc.c
index 82a13aa9a..43ea0d2e3 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -648,6 +648,23 @@ pct_expando(const char *string,struct expando_args *args)
}
break;
+ case 'U': /* z-base-32 encoded user id hash. */
+ if (args->namehash)
+ {
+ char *tmp = zb32_encode (args->namehash, 8*20);
+ if (tmp)
+ {
+ if (idx + strlen (tmp) < maxlen)
+ {
+ strcpy (ret+idx, tmp);
+ idx += strlen (tmp);
+ }
+ xfree (tmp);
+ done = 1;
+ }
+ }
+ break;
+
case 'c': /* signature count from card, if any. */
if(idx+10<maxlen)
{
diff --git a/g10/photoid.c b/g10/photoid.c
index 615837e2e..517fa21d7 100644
--- a/g10/photoid.c
+++ b/g10/photoid.c
@@ -297,11 +297,12 @@ show_photos(const struct user_attribute *attrs,
u32 len;
u32 kid[2]={0,0};
- memset(&args,0,sizeof(args));
- args.pk=pk;
- args.sk=sk;
- args.validity_info=get_validity_info(pk,uid);
- args.validity_string=get_validity_string(pk,uid);
+ memset (&args, 0, sizeof(args));
+ args.pk = pk;
+ args.validity_info = get_validity_info (pk, uid);
+ args.validity_string = get_validity_string (pk, uid);
+ namehash_from_uid (uid);
+ args.namehash = uid->namehash;
if(pk)
keyid_from_pk(pk,kid);