2013-01-18 00:44:04 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2012 Damien Miller <djm@mindrot.org>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2023-07-17 03:57:21 +00:00
|
|
|
/* $OpenBSD: krl.h,v 1.9 2023/07/17 03:57:21 djm Exp $ */
|
2013-01-18 00:44:04 +00:00
|
|
|
|
|
|
|
#ifndef _KRL_H
|
|
|
|
#define _KRL_H
|
|
|
|
|
|
|
|
/* Functions to manage key revocation lists */
|
|
|
|
|
|
|
|
#define KRL_MAGIC "SSHKRL\n\0"
|
|
|
|
#define KRL_FORMAT_VERSION 1
|
|
|
|
|
|
|
|
/* KRL section types */
|
|
|
|
#define KRL_SECTION_CERTIFICATES 1
|
|
|
|
#define KRL_SECTION_EXPLICIT_KEY 2
|
|
|
|
#define KRL_SECTION_FINGERPRINT_SHA1 3
|
|
|
|
#define KRL_SECTION_SIGNATURE 4
|
2018-09-12 01:21:34 +00:00
|
|
|
#define KRL_SECTION_FINGERPRINT_SHA256 5
|
2023-07-17 03:57:21 +00:00
|
|
|
#define KRL_SECTION_EXTENSION 255
|
2013-01-18 00:44:04 +00:00
|
|
|
|
|
|
|
/* KRL_SECTION_CERTIFICATES subsection types */
|
|
|
|
#define KRL_SECTION_CERT_SERIAL_LIST 0x20
|
|
|
|
#define KRL_SECTION_CERT_SERIAL_RANGE 0x21
|
|
|
|
#define KRL_SECTION_CERT_SERIAL_BITMAP 0x22
|
|
|
|
#define KRL_SECTION_CERT_KEY_ID 0x23
|
2023-07-17 03:57:21 +00:00
|
|
|
#define KRL_SECTION_CERT_EXTENSION 0x39
|
2013-01-18 00:44:04 +00:00
|
|
|
|
2014-12-04 01:49:59 +00:00
|
|
|
struct sshkey;
|
|
|
|
struct sshbuf;
|
2013-01-18 00:44:04 +00:00
|
|
|
struct ssh_krl;
|
|
|
|
|
|
|
|
struct ssh_krl *ssh_krl_init(void);
|
|
|
|
void ssh_krl_free(struct ssh_krl *krl);
|
|
|
|
void ssh_krl_set_version(struct ssh_krl *krl, u_int64_t version);
|
2014-12-04 01:49:59 +00:00
|
|
|
int ssh_krl_set_comment(struct ssh_krl *krl, const char *comment);
|
|
|
|
int ssh_krl_revoke_cert_by_serial(struct ssh_krl *krl,
|
|
|
|
const struct sshkey *ca_key, u_int64_t serial);
|
|
|
|
int ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl,
|
|
|
|
const struct sshkey *ca_key, u_int64_t lo, u_int64_t hi);
|
|
|
|
int ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl,
|
|
|
|
const struct sshkey *ca_key, const char *key_id);
|
|
|
|
int ssh_krl_revoke_key_explicit(struct ssh_krl *krl, const struct sshkey *key);
|
2018-09-12 01:21:34 +00:00
|
|
|
int ssh_krl_revoke_key_sha1(struct ssh_krl *krl, const u_char *p, size_t len);
|
|
|
|
int ssh_krl_revoke_key_sha256(struct ssh_krl *krl, const u_char *p, size_t len);
|
2014-12-04 01:49:59 +00:00
|
|
|
int ssh_krl_revoke_key(struct ssh_krl *krl, const struct sshkey *key);
|
|
|
|
int ssh_krl_to_blob(struct ssh_krl *krl, struct sshbuf *buf,
|
2019-06-21 04:21:04 +00:00
|
|
|
struct sshkey **sign_keys, u_int nsign_keys);
|
2014-12-04 01:49:59 +00:00
|
|
|
int ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp,
|
2015-01-13 19:04:35 +00:00
|
|
|
const struct sshkey **sign_ca_keys, size_t nsign_ca_keys);
|
2014-12-04 01:49:59 +00:00
|
|
|
int ssh_krl_check_key(struct ssh_krl *krl, const struct sshkey *key);
|
|
|
|
int ssh_krl_file_contains_key(const char *path, const struct sshkey *key);
|
2020-04-03 02:26:56 +00:00
|
|
|
int krl_dump(struct ssh_krl *krl, FILE *f);
|
2013-01-18 00:44:04 +00:00
|
|
|
|
|
|
|
#endif /* _KRL_H */
|
|
|
|
|