* key.h (subkey_s): New member expires_at.

* keylist.c (keylist_colon_handler): Set it here
* key.c (gpgme_key_get_as_xml,gpgme_key_get_ulong_attr): Return it.
This commit is contained in:
Werner Koch 2002-02-28 09:53:56 +00:00
parent cb18fe8dd6
commit 0857c5cfdd
4 changed files with 48 additions and 33 deletions

View File

@ -1,3 +1,9 @@
2002-02-28 Werner Koch <wk@gnupg.org>
* key.h (subkey_s): New member expires_at.
* keylist.c (keylist_colon_handler): Set it here
* key.c (gpgme_key_get_as_xml,gpgme_key_get_ulong_attr): Return it.
2002-02-27 Marcus Brinkmann <marcus@g10code.de> 2002-02-27 Marcus Brinkmann <marcus@g10code.de>
* rungpg.h (_gpgme_gpg_op_keylist_ext): New prototype. * rungpg.h (_gpgme_gpg_op_keylist_ext): New prototype.

View File

@ -683,7 +683,7 @@ gpgme_key_get_as_xml ( GpgmeKey key )
add_tag_and_uint (d, "algo", key->keys.key_algo ); add_tag_and_uint (d, "algo", key->keys.key_algo );
add_tag_and_uint (d, "len", key->keys.key_len ); add_tag_and_uint (d, "len", key->keys.key_len );
add_tag_and_time (d, "created", key->keys.timestamp ); add_tag_and_time (d, "created", key->keys.timestamp );
/*add_tag_and_time (d, "expires", key->expires );*/ add_tag_and_time (d, "expire", key->keys.expires_at );
_gpgme_data_append_string (d, " </mainkey>\n"); _gpgme_data_append_string (d, " </mainkey>\n");
/* Now the user IDs. */ /* Now the user IDs. */
@ -709,6 +709,7 @@ gpgme_key_get_as_xml ( GpgmeKey key )
add_tag_and_uint (d, "algo", k->key_algo ); add_tag_and_uint (d, "algo", k->key_algo );
add_tag_and_uint (d, "len", k->key_len ); add_tag_and_uint (d, "len", k->key_len );
add_tag_and_time (d, "created", k->timestamp ); add_tag_and_time (d, "created", k->timestamp );
add_tag_and_time (d, "expire", k->expires_at );
_gpgme_data_append_string (d, " </subkey>\n"); _gpgme_data_append_string (d, " </subkey>\n");
} }
_gpgme_data_append_string ( d, "</GnupgKeyblock>\n" ); _gpgme_data_append_string ( d, "</GnupgKeyblock>\n" );
@ -904,6 +905,12 @@ gpgme_key_get_ulong_attr ( GpgmeKey key, GpgmeAttr what,
if (k) if (k)
val = k->timestamp < 0? 0L:(unsigned long)k->timestamp; val = k->timestamp < 0? 0L:(unsigned long)k->timestamp;
break; break;
case GPGME_ATTR_EXPIRE:
for (k=&key->keys; k && idx; k=k->next, idx-- )
;
if (k)
val = k->expires_at < 0? 0L:(unsigned long)k->expires_at;
break;
case GPGME_ATTR_VALIDITY: case GPGME_ATTR_VALIDITY:
for (u=key->uids; u && idx; u=u->next, idx-- ) for (u=key->uids; u && idx; u=u->next, idx-- )
; ;

View File

@ -43,6 +43,7 @@ struct subkey_s {
char keyid[16+1]; char keyid[16+1];
char *fingerprint; /* malloced hex digits */ char *fingerprint; /* malloced hex digits */
time_t timestamp; /* -1 for invalid, 0 for not available */ time_t timestamp; /* -1 for invalid, 0 for not available */
time_t expires_at; /* 0 for does not expires */
}; };
struct gpgme_key_s { struct gpgme_key_s {

View File

@ -300,7 +300,8 @@ keylist_colon_handler (GpgmeCtx ctx, char *line)
case 6: /* timestamp (seconds) */ case 6: /* timestamp (seconds) */
key->keys.timestamp = parse_timestamp (p); key->keys.timestamp = parse_timestamp (p);
break; break;
case 7: /* valid for n days */ case 7: /* expiration time (seconds) */
key->keys.expires_at = parse_timestamp (p);
break; break;
case 8: /* X.509 serial number */ case 8: /* X.509 serial number */
/* fixme: store it */ /* fixme: store it */
@ -345,7 +346,7 @@ keylist_colon_handler (GpgmeCtx ctx, char *line)
case 6: /* timestamp (seconds) */ case 6: /* timestamp (seconds) */
sk->timestamp = parse_timestamp (p); sk->timestamp = parse_timestamp (p);
break; break;
case 7: /* valid for n days */ case 7: /* expiration time (seconds) */
break; break;
case 8: /* reserved (LID) */ case 8: /* reserved (LID) */
break; break;