* 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>
* 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, "len", key->keys.key_len );
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");
/* 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, "len", k->key_len );
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, "</GnupgKeyblock>\n" );
@ -904,6 +905,12 @@ gpgme_key_get_ulong_attr ( GpgmeKey key, GpgmeAttr what,
if (k)
val = k->timestamp < 0? 0L:(unsigned long)k->timestamp;
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:
for (u=key->uids; u && idx; u=u->next, idx-- )
;

View File

@ -27,39 +27,40 @@
#include "context.h"
struct subkey_s {
struct subkey_s *next;
unsigned int secret:1;
struct {
unsigned int revoked:1 ;
unsigned int expired:1 ;
unsigned int disabled:1 ;
unsigned int invalid:1 ;
unsigned int can_encrypt:1;
unsigned int can_sign:1;
unsigned int can_certify:1;
} flags;
unsigned int key_algo;
unsigned int key_len;
char keyid[16+1];
char *fingerprint; /* malloced hex digits */
time_t timestamp; /* -1 for invalid, 0 for not available */
struct subkey_s *next;
unsigned int secret:1;
struct {
unsigned int revoked:1 ;
unsigned int expired:1 ;
unsigned int disabled:1 ;
unsigned int invalid:1 ;
unsigned int can_encrypt:1;
unsigned int can_sign:1;
unsigned int can_certify:1;
} flags;
unsigned int key_algo;
unsigned int key_len;
char keyid[16+1];
char *fingerprint; /* malloced hex digits */
time_t timestamp; /* -1 for invalid, 0 for not available */
time_t expires_at; /* 0 for does not expires */
};
struct gpgme_key_s {
struct {
unsigned int revoked:1 ;
unsigned int expired:1 ;
unsigned int disabled:1 ;
unsigned int invalid:1 ;
unsigned int can_encrypt:1;
unsigned int can_sign:1;
unsigned int can_certify:1;
} gloflags;
unsigned int ref_count;
unsigned int secret:1;
unsigned int x509:1;
struct subkey_s keys;
struct user_id_s *uids;
struct {
unsigned int revoked:1 ;
unsigned int expired:1 ;
unsigned int disabled:1 ;
unsigned int invalid:1 ;
unsigned int can_encrypt:1;
unsigned int can_sign:1;
unsigned int can_certify:1;
} gloflags;
unsigned int ref_count;
unsigned int secret:1;
unsigned int x509:1;
struct subkey_s keys;
struct user_id_s *uids;
};
void _gpgme_key_cache_init (void);

View File

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