* gpgme.h (GpgmeAttr): Add values for issuer and chaining.

* key.h (gpgme_key_s): Add issuer and chaining elements for X509.
* keylist.c (keylist_colon_handler): Store them.
* key.c	(gpgme_key_release): Free them.
(gpgme_key_get_as_xml,gpgme_key_get_string_attr): Print them.
This commit is contained in:
Werner Koch 2002-03-28 17:43:02 +00:00
parent dd2cb388a9
commit aa20d6a45a
6 changed files with 110 additions and 59 deletions

2
NEWS
View File

@ -2,6 +2,8 @@
case, symmetric encryption is performed. Note that this requires a
passphrase from the user.
* More information is returned for X.509 certificates.
* Interface changes relative to the 0.3.4 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gpgme_op_encrypt EXTENDED: Symmetric encryption possible

View File

@ -1,3 +1,11 @@
2002-03-28 Werner Koch <wk@gnupg.org>
* gpgme.h (GpgmeAttr): Add values for issuer and chaining.
* key.h (gpgme_key_s): Add issuer and chaining elements for X509.
* keylist.c (keylist_colon_handler): Store them.
* key.c (gpgme_key_release): Free them.
(gpgme_key_get_as_xml,gpgme_key_get_string_attr): Print them.
2002-03-26 Werner Koch <wk@gnupg.org>
* Makefile.am (libgpgme_la_SOURCES): Add mutex.h

View File

@ -161,7 +161,10 @@ typedef enum
GPGME_ATTR_CAN_SIGN = 22,
GPGME_ATTR_CAN_CERTIFY = 23,
GPGME_ATTR_KEY_EXPIRED = 24,
GPGME_ATTR_KEY_DISABLED = 25
GPGME_ATTR_KEY_DISABLED = 25,
GPGME_ATTR_SERIAL = 26,
GPGME_ATTR_ISSUER = 27,
GPGME_ATTR_CHAINID = 28
}
GpgmeAttr;

View File

@ -352,6 +352,9 @@ gpgme_key_release ( GpgmeKey key )
u2 = u->next;
xfree (u);
}
xfree (key->issuer_serial);
xfree (key->issuer_name);
xfree (key->chain_id);
xfree (key);
}
@ -684,6 +687,12 @@ gpgme_key_get_as_xml ( GpgmeKey key )
add_tag_and_uint (d, "len", key->keys.key_len );
add_tag_and_time (d, "created", key->keys.timestamp );
add_tag_and_time (d, "expire", key->keys.expires_at );
if (key->issuer_serial)
add_tag_and_string (d, "serial", key->issuer_serial);
if (key->issuer_name)
add_tag_and_string (d, "issuer", key->issuer_name);
if (key->chain_id)
add_tag_and_string (d, "chainid", key->chain_id);
_gpgme_data_append_string (d, " </mainkey>\n");
/* Now the user IDs. */
@ -691,7 +700,8 @@ gpgme_key_get_as_xml ( GpgmeKey key )
one_uid_as_xml (d,u);
/* and now the subkeys */
for (k=key->keys.next; k; k = k->next ) {
for (k=key->keys.next; k; k = k->next )
{
_gpgme_data_append_string (d, " <subkey>\n");
if ( k->secret )
_gpgme_data_append_string ( d, " <secret/>\n");
@ -850,6 +860,15 @@ gpgme_key_get_string_attr ( GpgmeKey key, GpgmeAttr what,
if (k)
val = capabilities_to_string (k);
break;
case GPGME_ATTR_SERIAL:
val = key->issuer_serial;
break;
case GPGME_ATTR_ISSUER:
val = key->issuer_name;
break;
case GPGME_ATTR_CHAINID:
val = key->chain_id;
break;
}
return val;
}
@ -970,5 +989,3 @@ gpgme_key_get_ulong_attr ( GpgmeKey key, GpgmeAttr what,
}
return val;
}

View File

@ -59,6 +59,9 @@ struct gpgme_key_s {
unsigned int ref_count;
unsigned int secret:1;
unsigned int x509:1;
char *issuer_serial; /* malloced string used only with X.509 */
char *issuer_name; /* ditto */
char *chain_id; /* ditto */
struct subkey_s keys;
struct user_id_s *uids;
};

View File

@ -304,13 +304,23 @@ keylist_colon_handler (GpgmeCtx ctx, char *line)
key->keys.expires_at = parse_timestamp (p);
break;
case 8: /* X.509 serial number */
/* fixme: store it */
if (rectype == RT_CRT)
{
key->issuer_serial = xtrystrdup (p);
if (!key->issuer_serial)
ctx->error = mk_error (Out_Of_Core);
}
break;
case 9: /* ownertrust */
break;
case 10: /* not used for gpg due to --fixed-list-mode option
but gpgsm stores the issuer name */
/* fixme: store issuer name */
if (rectype == RT_CRT)
{
key->issuer_name = xtrystrdup (p);
if (!key->issuer_name)
ctx->error = mk_error (Out_Of_Core);
}
break;
case 11: /* signature class */
break;
@ -394,6 +404,14 @@ keylist_colon_handler (GpgmeCtx ctx, char *line)
if (!key->keys.fingerprint)
ctx->error = mk_error (Out_Of_Core);
}
break;
case 13: /* gpgsm chain ID (take only the first one)*/
if (!key->chain_id && *p)
{
key->chain_id = xtrystrdup (p);
if (!key->chain_id)
ctx->error = mk_error (Out_Of_Core);
}
pend = NULL; /* that is all we want */
break;
}