/* -*-c-*-
*
- * $Id: key.h,v 1.8 2001/02/03 11:57:38 mdw Exp $
+ * $Id: key.h,v 1.11 2004/04/08 01:36:15 mdw Exp $
*
* Simple key management
*
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: key.h,v $
- * Revision 1.8 2001/02/03 11:57:38 mdw
- * Allow creating keyfiles with no file attached.
- *
- * Revision 1.7 2000/12/06 20:33:27 mdw
- * Make flags be macros rather than enumerations, to ensure that they're
- * unsigned.
- *
- * Revision 1.6 2000/06/17 11:27:43 mdw
- * Add key fetching interface.
- *
- * Revision 1.5 2000/02/12 18:55:40 mdw
- * Make it all compile properly.
- *
- * Revision 1.4 2000/02/12 18:21:02 mdw
- * Overhaul of key management (again).
- *
- * Revision 1.3 1999/12/22 15:47:48 mdw
- * Major key-management revision.
- *
- * Revision 1.2 1999/12/10 23:29:48 mdw
- * Change header file guard names.
- *
- * Revision 1.1 1999/09/03 08:41:12 mdw
- * Initial import.
- *
- */
-
#ifndef CATACOMB_KEY_H
#define CATACOMB_KEY_H
# include "key-data.h"
#endif
+#ifndef CATACOMB_GHASH_H
+# include "ghash.h"
+#endif
+
#ifndef CATACOMB_MP_H
# include "mp.h"
#endif
KERR_BADPASS = -10, /* Error decrypting locked key */
KERR_WRONGTYPE = -11, /* Key has incorrect type */
KERR_NOTFOUND = -12, /* Key couldn't be found */
+ KERR_BADATTR = -13, /* Malformed attribute name */
KERR_MAX /* Largest possible error */
};
extern int key_delete(key_file */*f*/, key */*k*/);
+/* --- @key_expired@ --- *
+ *
+ * Arguments: @key *k@ = pointer to key block
+ *
+ * Returns: Zero if the key is OK, nonzero if it's expired.
+ */
+
+int key_expired(key */*k*/);
+
/* --- @key_expire@ --- *
*
* Arguments: @key_file *f@ = pointer to file block
extern int key_used(key_file */*f*/, key */*k*/, time_t /*t*/);
+/* --- @key_fingerprint@ --- *
+ *
+ * Arguments: @key *k@ = the key to fingerprint
+ * @ghash *h@ = the hash to use
+ * @const key_filter *kf@ = filter to apply
+ *
+ * Returns: Nonzero if the key slightly matched the filter.
+ *
+ * Use: Updates the hash context with the key contents.
+ */
+
+extern int key_fingerprint(key */*k*/, ghash */*h*/,
+ const key_filter */*kf*/);
+
/*----- Setting and reading attributes ------------------------------------*/
/* --- @key_chkident@ --- *