krl.h revision 248613
113901Salanb/*
217343Snaoto * Copyright (c) 2012 Damien Miller <djm@mindrot.org>
313901Salanb *
413901Salanb * Permission to use, copy, modify, and distribute this software for any
513901Salanb * purpose with or without fee is hereby granted, provided that the above
613901Salanb * copyright notice and this permission notice appear in all copies.
713901Salanb *
813901Salanb * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
913901Salanb * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1013901Salanb * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1113901Salanb * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1213901Salanb * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1313901Salanb * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1413901Salanb * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1513901Salanb */
1613901Salanb
1713901Salanb/* $OpenBSD: krl.h,v 1.2 2013/01/18 00:24:58 djm Exp $ */
1813901Salanb
1913901Salanb#ifndef _KRL_H
2013901Salanb#define _KRL_H
2113901Salanb
2213901Salanb/* Functions to manage key revocation lists */
2313901Salanb
2413901Salanb#define KRL_MAGIC		"SSHKRL\n\0"
2513901Salanb#define KRL_FORMAT_VERSION	1
2613901Salanb
2717343Snaoto/* KRL section types */
2813901Salanb#define KRL_SECTION_CERTIFICATES	1
2913901Salanb#define KRL_SECTION_EXPLICIT_KEY	2
30#define KRL_SECTION_FINGERPRINT_SHA1	3
31#define KRL_SECTION_SIGNATURE		4
32
33/* KRL_SECTION_CERTIFICATES subsection types */
34#define KRL_SECTION_CERT_SERIAL_LIST	0x20
35#define KRL_SECTION_CERT_SERIAL_RANGE	0x21
36#define KRL_SECTION_CERT_SERIAL_BITMAP	0x22
37#define KRL_SECTION_CERT_KEY_ID		0x23
38
39struct ssh_krl;
40
41struct ssh_krl *ssh_krl_init(void);
42void ssh_krl_free(struct ssh_krl *krl);
43void ssh_krl_set_version(struct ssh_krl *krl, u_int64_t version);
44void ssh_krl_set_sign_key(struct ssh_krl *krl, const Key *sign_key);
45void ssh_krl_set_comment(struct ssh_krl *krl, const char *comment);
46int ssh_krl_revoke_cert_by_serial(struct ssh_krl *krl, const Key *ca_key,
47    u_int64_t serial);
48int ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl, const Key *ca_key,
49    u_int64_t lo, u_int64_t hi);
50int ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl, const Key *ca_key,
51    const char *key_id);
52int ssh_krl_revoke_key_explicit(struct ssh_krl *krl, const Key *key);
53int ssh_krl_revoke_key_sha1(struct ssh_krl *krl, const Key *key);
54int ssh_krl_revoke_key(struct ssh_krl *krl, const Key *key);
55int ssh_krl_to_blob(struct ssh_krl *krl, Buffer *buf, const Key **sign_keys,
56    u_int nsign_keys);
57int ssh_krl_from_blob(Buffer *buf, struct ssh_krl **krlp,
58    const Key **sign_ca_keys, u_int nsign_ca_keys);
59int ssh_krl_check_key(struct ssh_krl *krl, const Key *key);
60int ssh_krl_file_contains_key(const char *path, const Key *key);
61
62#endif /* _KRL_H */
63
64