keys.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #pragma once
  20. #include <jansson.h>
  21. #include <stddef.h>
  22. struct tang_keys_info {
  23. /* Arrays. */
  24. json_t* m_keys; /* Regular keys. */
  25. json_t* m_rotated_keys; /* Rotated keys. */
  26. json_t* m_payload; /* Payload made of regular keys capable of
  27. * either signing+verifying or deriving new
  28. * keys. */
  29. json_t* m_sign; /* Set of signing keys made from regular
  30. keys. */
  31. size_t m_keys_count; /* Number of regular keys. */
  32. size_t m_rotated_keys_count; /* Number of rotated keys. */
  33. };
  34. void cleanup_tang_keys_info(struct tang_keys_info**);
  35. void free_tang_keys_info(struct tang_keys_info*);
  36. struct tang_keys_info* read_keys(const char* /* jwkdir */);
  37. json_t* find_jws(struct tang_keys_info* /* tki */, const char* /* thp */);
  38. json_t* find_jwk(struct tang_keys_info* /* tki */, const char* /* thp */);