1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

* keybox-blob.c (x509_email_kludge): New.

(_keybox_create_x509_blob): Insert an extra email address if the
subject's DN has an email part.
* keybox-defs.h: Added the xtoi_2 and digitp macros.
This commit is contained in:
Werner Koch 2001-12-14 20:48:07 +00:00
parent 6d27c940b2
commit 134d401a4e
4 changed files with 52 additions and 19 deletions

View file

@ -773,21 +773,29 @@ _keybox_create_pgp_blob (KEYBOXBLOB *r_blob, KBNODE keyblock)
static char *
x509_email_kludge (const char *name)
{
#if 0
if (!strncmp (name, "1.2.840.113549.1.9.1=#", 22)
&& hexdigitp (name+22) && hexdigitp (name+23))
{ /* this looks pretty much like an email address in the
subjects DN we use this to add an additional user ID
entry. This way, openSSL generated keys get a nicer and
usable listing */
char *buf = NULL;
/* FIXME */
const unsigned char *p;
unsigned char *buf;
int n;
return buf;
}
#endif
return NULL;
if (strncmp (name, "1.2.840.113549.1.9.1=#", 22))
return NULL;
/* This looks pretty much like an email address in the subject's DN
we use this to add an additional user ID entry. This way,
openSSL generated keys get a nicer and usable listing */
name += 22;
for (n=0, p=name; hexdigitp (p) && hexdigitp (p+1); p +=2, n++)
;
if (*p != '#' || !n)
return NULL;
buf = xtrymalloc (n+3);
if (!buf)
return NULL; /* oops, out of core */
*buf = '<';
for (n=1, p=name; *p != '#'; p +=2, n++)
buf[n] = xtoi_2 (p);
buf[n++] = '>';
buf[n] = 0;
return buf;
}