1 /* vim: set tabstop=8 shiftwidth=4 softtabstop=4 expandtab smarttab colorcolumn=80: */
2 /*
3  * Copyright (c) 2020 Red Hat, Inc.
4  * Author: Sergio Correia <scorreia@redhat.com>
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #pragma once
21 
22 #include <jansson.h>
23 #include <stddef.h>
24 
25 struct tang_keys_info {
26     /* Arrays. */
27     json_t* m_keys;               /* Regular keys. */
28     json_t* m_rotated_keys;       /* Rotated keys. */
29 
30     json_t* m_payload;            /* Payload made of regular keys capable of
31                                    * either signing+verifying or deriving new
32                                    * keys. */
33 
34     json_t* m_sign;               /* Set of signing keys made from regular
35                                      keys. */
36 
37     size_t m_keys_count;          /* Number of regular keys. */
38     size_t m_rotated_keys_count;  /* Number of rotated keys. */
39 };
40 
41 void cleanup_tang_keys_info(struct tang_keys_info**);
42 void free_tang_keys_info(struct tang_keys_info*);
43 struct tang_keys_info* read_keys(const char* /* jwkdir */);
44 json_t* find_jws(struct tang_keys_info* /* tki */, const char* /* thp */);
45 json_t* find_jwk(struct tang_keys_info* /* tki */, const char* /* thp */);
46