X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/tripe/blobdiff_plain/56814747afb31322dab18e9ba157fea18dd9428c..110d564e1b2a4d97b99cc34e1481fa6279ad9695:/keymgmt.c diff --git a/keymgmt.c b/keymgmt.c index 55a188bb..54a31b0b 100644 --- a/keymgmt.c +++ b/keymgmt.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: keymgmt.c,v 1.2 2001/06/19 22:07:09 mdw Exp $ + * $Id: keymgmt.c,v 1.3 2001/06/22 19:40:36 mdw Exp $ * * Key loading and storing * @@ -29,6 +29,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: keymgmt.c,v $ + * Revision 1.3 2001/06/22 19:40:36 mdw + * Support expiry of other peers' public keys. + * * Revision 1.2 2001/06/19 22:07:09 mdw * Cosmetic fixes. * @@ -233,21 +236,26 @@ void km_init(const char *priv, const char *pub, const char *tag) * * Arguments: @const char *tag@ = public key tag to load * @dh_pub *kpub@ = where to put the public key + * @time_t *t_exp@ = where to put the expiry time * * Returns: Zero if OK, nonzero if it failed. * * Use: Fetches a public key from the keyring. */ -int km_getpubkey(const char *tag, dh_pub *kpub) +int km_getpubkey(const char *tag, dh_pub *kpub, time_t *t_exp) { key_packstruct kps[DH_PUBFETCHSZ]; key_packdef *kp; + key *k; dh_pub dp; int e; kp = key_fetchinit(dh_pubfetch, kps, &dp); - e = key_fetchbyname(kp, kf_pub, tag); + if ((k = key_bytag(kf_pub, tag)) == 0) + e = KERR_NOTFOUND; + else + e = key_fetch(kp, k); key_fetchdone(kp); if (e) { a_warn("error loading public key `%s': %s", tag, key_strerror(e)); @@ -272,6 +280,7 @@ int km_getpubkey(const char *tag, dh_pub *kpub) kpub->dp.q = MP_COPY(dp.dp.q); kpub->dp.g = MP_COPY(dp.dp.g); kpub->y = MP_COPY(dp.y); + *t_exp = k->exp; return (0); }