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 17296781Sdes/* $OpenBSD: krl.h,v 1.5 2015/12/30 23:46:14 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 39295367Sdesstruct sshkey; 40295367Sdesstruct sshbuf; 41248613Sdesstruct ssh_krl; 42248613Sdes 43248613Sdesstruct ssh_krl *ssh_krl_init(void); 44248613Sdesvoid ssh_krl_free(struct ssh_krl *krl); 45248613Sdesvoid ssh_krl_set_version(struct ssh_krl *krl, u_int64_t version); 46295367Sdesint ssh_krl_set_comment(struct ssh_krl *krl, const char *comment); 47295367Sdesint ssh_krl_revoke_cert_by_serial(struct ssh_krl *krl, 48295367Sdes const struct sshkey *ca_key, u_int64_t serial); 49295367Sdesint ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl, 50295367Sdes const struct sshkey *ca_key, u_int64_t lo, u_int64_t hi); 51295367Sdesint ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl, 52295367Sdes const struct sshkey *ca_key, const char *key_id); 53295367Sdesint ssh_krl_revoke_key_explicit(struct ssh_krl *krl, const struct sshkey *key); 54295367Sdesint ssh_krl_revoke_key_sha1(struct ssh_krl *krl, const struct sshkey *key); 55295367Sdesint ssh_krl_revoke_key(struct ssh_krl *krl, const struct sshkey *key); 56295367Sdesint ssh_krl_to_blob(struct ssh_krl *krl, struct sshbuf *buf, 57295367Sdes const struct sshkey **sign_keys, u_int nsign_keys); 58295367Sdesint ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp, 59295367Sdes const struct sshkey **sign_ca_keys, size_t nsign_ca_keys); 60295367Sdesint ssh_krl_check_key(struct ssh_krl *krl, const struct sshkey *key); 61295367Sdesint ssh_krl_file_contains_key(const char *path, const struct sshkey *key); 62248613Sdes 63248613Sdes#endif /* _KRL_H */ 64248613Sdes 65