1248613Sdes/*
2248613Sdes * Copyright (c) 2012 Damien Miller <djm@mindrot.org>
3248613Sdes *
4248613Sdes * Permission to use, copy, modify, and distribute this software for any
5248613Sdes * purpose with or without fee is hereby granted, provided that the above
6248613Sdes * copyright notice and this permission notice appear in all copies.
7248613Sdes *
8248613Sdes * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9248613Sdes * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10248613Sdes * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11248613Sdes * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12248613Sdes * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13248613Sdes * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14248613Sdes * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15248613Sdes */
16248613Sdes
17248613Sdes/* $OpenBSD: krl.h,v 1.2 2013/01/18 00:24:58 djm Exp $ */
18248613Sdes
19248613Sdes#ifndef _KRL_H
20248613Sdes#define _KRL_H
21248613Sdes
22248613Sdes/* Functions to manage key revocation lists */
23248613Sdes
24248613Sdes#define KRL_MAGIC		"SSHKRL\n\0"
25248613Sdes#define KRL_FORMAT_VERSION	1
26248613Sdes
27248613Sdes/* KRL section types */
28248613Sdes#define KRL_SECTION_CERTIFICATES	1
29248613Sdes#define KRL_SECTION_EXPLICIT_KEY	2
30248613Sdes#define KRL_SECTION_FINGERPRINT_SHA1	3
31248613Sdes#define KRL_SECTION_SIGNATURE		4
32248613Sdes
33248613Sdes/* KRL_SECTION_CERTIFICATES subsection types */
34248613Sdes#define KRL_SECTION_CERT_SERIAL_LIST	0x20
35248613Sdes#define KRL_SECTION_CERT_SERIAL_RANGE	0x21
36248613Sdes#define KRL_SECTION_CERT_SERIAL_BITMAP	0x22
37248613Sdes#define KRL_SECTION_CERT_KEY_ID		0x23
38248613Sdes
39248613Sdesstruct ssh_krl;
40248613Sdes
41248613Sdesstruct ssh_krl *ssh_krl_init(void);
42248613Sdesvoid ssh_krl_free(struct ssh_krl *krl);
43248613Sdesvoid ssh_krl_set_version(struct ssh_krl *krl, u_int64_t version);
44248613Sdesvoid ssh_krl_set_sign_key(struct ssh_krl *krl, const Key *sign_key);
45248613Sdesvoid ssh_krl_set_comment(struct ssh_krl *krl, const char *comment);
46248613Sdesint ssh_krl_revoke_cert_by_serial(struct ssh_krl *krl, const Key *ca_key,
47248613Sdes    u_int64_t serial);
48248613Sdesint ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl, const Key *ca_key,
49248613Sdes    u_int64_t lo, u_int64_t hi);
50248613Sdesint ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl, const Key *ca_key,
51248613Sdes    const char *key_id);
52248613Sdesint ssh_krl_revoke_key_explicit(struct ssh_krl *krl, const Key *key);
53248613Sdesint ssh_krl_revoke_key_sha1(struct ssh_krl *krl, const Key *key);
54248613Sdesint ssh_krl_revoke_key(struct ssh_krl *krl, const Key *key);
55248613Sdesint ssh_krl_to_blob(struct ssh_krl *krl, Buffer *buf, const Key **sign_keys,
56248613Sdes    u_int nsign_keys);
57248613Sdesint ssh_krl_from_blob(Buffer *buf, struct ssh_krl **krlp,
58248613Sdes    const Key **sign_ca_keys, u_int nsign_ca_keys);
59248613Sdesint ssh_krl_check_key(struct ssh_krl *krl, const Key *key);
60248613Sdesint ssh_krl_file_contains_key(const char *path, const Key *key);
61248613Sdes
62248613Sdes#endif /* _KRL_H */
63248613Sdes
64