diff options
Diffstat (limited to '')
| -rw-r--r-- | gpgme/ChangeLog | 6 | ||||
| -rw-r--r-- | gpgme/key.c | 9 | ||||
| -rw-r--r-- | gpgme/key.h | 61 | ||||
| -rw-r--r-- | gpgme/keylist.c | 5 | 
4 files changed, 48 insertions, 33 deletions
| diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 58f09c62..9979a330 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,9 @@ +2002-02-28  Werner Koch  <[email protected]> + +	* 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  <[email protected]>  	* rungpg.h (_gpgme_gpg_op_keylist_ext): New prototype. diff --git a/gpgme/key.c b/gpgme/key.c index 3bd3b56e..25d6a5db 100644 --- a/gpgme/key.c +++ b/gpgme/key.c @@ -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-- )              ; diff --git a/gpgme/key.h b/gpgme/key.h index 597dd0c7..9503d551 100644 --- a/gpgme/key.h +++ b/gpgme/key.h @@ -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); diff --git a/gpgme/keylist.c b/gpgme/keylist.c index 55d427d2..1bcda34e 100644 --- a/gpgme/keylist.c +++ b/gpgme/keylist.c @@ -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; | 
