tpm.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (C) 2010-2012 Free Software Foundation, Inc.
  3. *
  4. * Author: Nikos Mavrogiannopoulos
  5. *
  6. * This file is part of GnuTLS.
  7. *
  8. * The GnuTLS is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public License
  10. * as published by the Free Software Foundation; either version 2.1 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>
  20. *
  21. */
  22. #ifndef __GNUTLS_TPM_H
  23. #define __GNUTLS_TPM_H
  24. #include <gnutls/gnutls.h>
  25. #include <gnutls/x509.h>
  26. /* *INDENT-OFF* */
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* *INDENT-ON* */
  31. struct tpm_key_list_st;
  32. typedef struct tpm_key_list_st *gnutls_tpm_key_list_t;
  33. #define GNUTLS_TPM_KEY_SIGNING (1<<1)
  34. #define GNUTLS_TPM_REGISTER_KEY (1<<2)
  35. #define GNUTLS_TPM_KEY_USER (1<<3)
  36. /**
  37. * gnutls_tpmkey_fmt_t:
  38. * @GNUTLS_TPMKEY_FMT_RAW: The portable data format.
  39. * @GNUTLS_TPMKEY_FMT_DER: An alias for the raw format.
  40. * @GNUTLS_TPMKEY_FMT_CTK_PEM: A custom data format used by some TPM tools.
  41. *
  42. * Enumeration of different certificate encoding formats.
  43. */
  44. typedef enum {
  45. GNUTLS_TPMKEY_FMT_RAW = 0,
  46. GNUTLS_TPMKEY_FMT_DER = GNUTLS_TPMKEY_FMT_RAW,
  47. GNUTLS_TPMKEY_FMT_CTK_PEM = 1
  48. } gnutls_tpmkey_fmt_t;
  49. int
  50. gnutls_tpm_privkey_generate(gnutls_pk_algorithm_t pk,
  51. unsigned int bits,
  52. const char *srk_password,
  53. const char *key_password,
  54. gnutls_tpmkey_fmt_t format,
  55. gnutls_x509_crt_fmt_t pub_format,
  56. gnutls_datum_t * privkey,
  57. gnutls_datum_t * pubkey, unsigned int flags);
  58. void gnutls_tpm_key_list_deinit(gnutls_tpm_key_list_t list);
  59. int gnutls_tpm_key_list_get_url(gnutls_tpm_key_list_t list,
  60. unsigned int idx, char **url,
  61. unsigned int flags);
  62. int gnutls_tpm_get_registered(gnutls_tpm_key_list_t * list);
  63. int gnutls_tpm_privkey_delete(const char *url, const char *srk_password);
  64. /* *INDENT-OFF* */
  65. #ifdef __cplusplus
  66. }
  67. #endif
  68. /* *INDENT-ON* */
  69. #endif