Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 Damien Miller <djm@mindrot.org> |
| 3 | * |
| 4 | * Permission to use, copy, modify, and distribute this software for any |
| 5 | * purpose with or without fee is hereby granted, provided that the above |
| 6 | * copyright notice and this permission notice appear in all copies. |
| 7 | * |
| 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | */ |
| 16 | |
djm@openbsd.org | 6ec7457 | 2020-04-03 02:26:56 +0000 | [diff] [blame] | 17 | /* $OpenBSD: krl.h,v 1.8 2020/04/03 02:26:56 djm Exp $ */ |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 18 | |
| 19 | #ifndef _KRL_H |
| 20 | #define _KRL_H |
| 21 | |
| 22 | /* Functions to manage key revocation lists */ |
| 23 | |
| 24 | #define KRL_MAGIC "SSHKRL\n\0" |
| 25 | #define KRL_FORMAT_VERSION 1 |
| 26 | |
| 27 | /* KRL section types */ |
| 28 | #define KRL_SECTION_CERTIFICATES 1 |
| 29 | #define KRL_SECTION_EXPLICIT_KEY 2 |
| 30 | #define KRL_SECTION_FINGERPRINT_SHA1 3 |
| 31 | #define KRL_SECTION_SIGNATURE 4 |
djm@openbsd.org | 9405c62 | 2018-09-12 01:21:34 +0000 | [diff] [blame] | 32 | #define KRL_SECTION_FINGERPRINT_SHA256 5 |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 33 | |
| 34 | /* KRL_SECTION_CERTIFICATES subsection types */ |
| 35 | #define KRL_SECTION_CERT_SERIAL_LIST 0x20 |
| 36 | #define KRL_SECTION_CERT_SERIAL_RANGE 0x21 |
| 37 | #define KRL_SECTION_CERT_SERIAL_BITMAP 0x22 |
| 38 | #define KRL_SECTION_CERT_KEY_ID 0x23 |
| 39 | |
djm@openbsd.org | 74de254 | 2014-12-04 01:49:59 +0000 | [diff] [blame] | 40 | struct sshkey; |
| 41 | struct sshbuf; |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 42 | struct ssh_krl; |
| 43 | |
| 44 | struct ssh_krl *ssh_krl_init(void); |
| 45 | void ssh_krl_free(struct ssh_krl *krl); |
| 46 | void ssh_krl_set_version(struct ssh_krl *krl, u_int64_t version); |
djm@openbsd.org | 74de254 | 2014-12-04 01:49:59 +0000 | [diff] [blame] | 47 | int ssh_krl_set_comment(struct ssh_krl *krl, const char *comment); |
| 48 | int ssh_krl_revoke_cert_by_serial(struct ssh_krl *krl, |
| 49 | const struct sshkey *ca_key, u_int64_t serial); |
| 50 | int ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl, |
| 51 | const struct sshkey *ca_key, u_int64_t lo, u_int64_t hi); |
| 52 | int ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl, |
| 53 | const struct sshkey *ca_key, const char *key_id); |
| 54 | int ssh_krl_revoke_key_explicit(struct ssh_krl *krl, const struct sshkey *key); |
djm@openbsd.org | 9405c62 | 2018-09-12 01:21:34 +0000 | [diff] [blame] | 55 | int ssh_krl_revoke_key_sha1(struct ssh_krl *krl, const u_char *p, size_t len); |
| 56 | int ssh_krl_revoke_key_sha256(struct ssh_krl *krl, const u_char *p, size_t len); |
djm@openbsd.org | 74de254 | 2014-12-04 01:49:59 +0000 | [diff] [blame] | 57 | int ssh_krl_revoke_key(struct ssh_krl *krl, const struct sshkey *key); |
| 58 | int ssh_krl_to_blob(struct ssh_krl *krl, struct sshbuf *buf, |
djm@openbsd.org | 4f7a56d | 2019-06-21 04:21:04 +0000 | [diff] [blame] | 59 | struct sshkey **sign_keys, u_int nsign_keys); |
djm@openbsd.org | 74de254 | 2014-12-04 01:49:59 +0000 | [diff] [blame] | 60 | int ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp, |
djm@openbsd.org | e7fd952 | 2015-01-13 19:04:35 +0000 | [diff] [blame] | 61 | const struct sshkey **sign_ca_keys, size_t nsign_ca_keys); |
djm@openbsd.org | 74de254 | 2014-12-04 01:49:59 +0000 | [diff] [blame] | 62 | int ssh_krl_check_key(struct ssh_krl *krl, const struct sshkey *key); |
| 63 | int ssh_krl_file_contains_key(const char *path, const struct sshkey *key); |
djm@openbsd.org | 6ec7457 | 2020-04-03 02:26:56 +0000 | [diff] [blame] | 64 | int krl_dump(struct ssh_krl *krl, FILE *f); |
Damien Miller | f3747bf | 2013-01-18 11:44:04 +1100 | [diff] [blame] | 65 | |
| 66 | #endif /* _KRL_H */ |
| 67 | |