cert-private.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. *
  3. * Embedded Linux library
  4. *
  5. * Copyright (C) 2018 Intel Corporation. All rights reserved.
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. */
  22. struct asn1_oid;
  23. struct l_certchain *certchain_new_from_leaf(struct l_cert *leaf);
  24. void certchain_link_issuer(struct l_certchain *chain, struct l_cert *ca);
  25. const uint8_t *cert_get_extension(struct l_cert *cert,
  26. const struct asn1_oid *ext_id,
  27. bool *out_critical, size_t *out_len);
  28. struct l_key *cert_key_from_pkcs8_private_key_info(const uint8_t *der,
  29. size_t der_len);
  30. struct l_key *cert_key_from_pkcs8_encrypted_private_key_info(const uint8_t *der,
  31. size_t der_len,
  32. const char *passphrase);
  33. struct l_key *cert_key_from_pkcs1_rsa_private_key(const uint8_t *der,
  34. size_t der_len);
  35. struct cert_pkcs12_hash {
  36. enum l_checksum_type alg;
  37. unsigned int len;
  38. unsigned int u;
  39. unsigned int v;
  40. struct asn1_oid oid;
  41. };
  42. uint8_t *cert_pkcs12_pbkdf(const char *password,
  43. const struct cert_pkcs12_hash *hash,
  44. const uint8_t *salt, size_t salt_len,
  45. unsigned int iterations, uint8_t id,
  46. size_t key_len);
  47. struct l_cipher *cert_cipher_from_pkcs_alg_id(const uint8_t *id_asn1,
  48. size_t id_asn1_len,
  49. const char *password,
  50. bool *out_is_block);