Blob


1 /*
2 * Copyright (c) 2021, 2023, 2024 Omar Polo <op@omarpolo.com>
3 * Copyright (c) 2019 Renaud Allard <renaud@allard.it>
4 * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
5 * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
6 * Copyright (c) 2008 Reyk Floeter <reyk@openbsd.org>
7 *
8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 */
21 struct iri;
23 /* client certificate */
24 struct ccert {
25 char *host;
26 char *port;
27 char *path;
28 char *cert;
30 #define CERT_OK 0x00
31 #define CERT_TEMP 0x01
32 #define CERT_TEMP_DEL 0x02
33 int flags;
34 };
36 struct cstore {
37 struct ccert *certs;
38 size_t len;
39 size_t cap;
40 };
42 extern struct cstore cert_store;
43 extern char **identities;
45 int certs_init(const char *);
46 const char *ccert(const char *);
47 const char *cert_for(struct iri *, int *);
48 int cert_save_for(const char *, struct iri *, int);
49 int cert_delete_for(const char *, struct iri *, int);
50 int cert_open(const char *);
51 int cert_new(const char *, const char *, int);