2 * Copyright (C) 2010-2012 Free Software Foundation, Inc.
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GnuTLS.
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.
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.
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/>
23 #ifndef __GNUTLS_TPM_H
24 #define __GNUTLS_TPM_H
26 #include <gnutls/gnutls.h>
27 #include <gnutls/x509.h>
35 struct tpm_key_list_st
;
36 typedef struct tpm_key_list_st
*gnutls_tpm_key_list_t
;
38 #define GNUTLS_TPM_KEY_SIGNING (1<<1)
39 #define GNUTLS_TPM_REGISTER_KEY (1<<2)
40 #define GNUTLS_TPM_KEY_USER (1<<3)
43 * gnutls_tpmkey_fmt_t:
44 * @GNUTLS_TPMKEY_FMT_RAW: The portable data format.
45 * @GNUTLS_TPMKEY_FMT_DER: An alias for the raw format.
46 * @GNUTLS_TPMKEY_FMT_CTK_PEM: A custom data format used by some TPM tools.
48 * Enumeration of different certificate encoding formats.
51 GNUTLS_TPMKEY_FMT_RAW
= 0,
52 GNUTLS_TPMKEY_FMT_DER
= GNUTLS_TPMKEY_FMT_RAW
,
53 GNUTLS_TPMKEY_FMT_CTK_PEM
= 1
54 } gnutls_tpmkey_fmt_t
;
57 gnutls_tpm_privkey_generate(gnutls_pk_algorithm_t pk
,
59 const char *srk_password
,
60 const char *key_password
,
61 gnutls_tpmkey_fmt_t format
,
62 gnutls_x509_crt_fmt_t pub_format
,
63 gnutls_datum_t
* privkey
,
64 gnutls_datum_t
* pubkey
, unsigned int flags
);
66 void gnutls_tpm_key_list_deinit(gnutls_tpm_key_list_t list
);
67 int gnutls_tpm_key_list_get_url(gnutls_tpm_key_list_t list
,
68 unsigned int idx
, char **url
,
70 int gnutls_tpm_get_registered(gnutls_tpm_key_list_t
* list
);
71 int gnutls_tpm_privkey_delete(const char *url
, const char *srk_password
);