forked from google/hiba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
certificates.h
48 lines (38 loc) · 1.53 KB
/
certificates.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* Copyright 2021 The HIBA Authors
*
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file or at
* https://developers.google.com/open-source/licenses/bsd
*/
#ifndef _CERTIFICATES_H
#define _CERTIFICATES_H
#include <stdint.h>
#include "extensions.h"
#include "sshkey.h"
struct hibacert;
/* Creator for hibacert.
* Result must be freed with hibacert_free. */
struct hibacert *hibacert_new();
/* Destructor for hibacert */
void hibacert_free(struct hibacert *cert);
/* Parse HIBA extensions out of a SSH certificate passed a sshkey.
* The struct hibacert must already be allocated and the sshkey
* will be owned by the hibacert. */
int hibacert_parse(struct hibacert *cert, struct sshkey *key);
/* Return a pointer to the sshkey_cert contained by the hibacert.
* The ownership remains in the hibacert. */
struct sshkey_cert *hibacert_cert(const struct hibacert *cert);
/* Return a pointer to an array of hibaexts contained in the hibacert.
* The array's ownership remains in the hibacert. */
int hibacert_hibaexts(const struct hibacert *cert, struct hibaext ***exts,
int *len);
#ifdef HIBA_INTERNAL
/* Construct a hiba certificate from an extension.
* The struct hibacert must already be allocated and the hibaext
* will be owned by the hibacert; */
int hibacert_from_ext(struct hibacert *cert, struct hibaext *ext,
const char *principal, u_int64_t validity,
u_int64_t serial);
#endif /* HIBA_INTERNAL */
#endif /* _CERTIFICATES_H */