Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:00:17

0001 /*
0002  * Copyright (C) 2010-2012 Free Software Foundation, Inc.
0003  *
0004  * Author: Nikos Mavrogiannopoulos
0005  *
0006  * This file is part of GnuTLS.
0007  *
0008  * The GnuTLS is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU Lesser General Public License
0010  * as published by the Free Software Foundation; either version 2.1 of
0011  * the License, or (at your option) any later version.
0012  *
0013  * This library is distributed in the hope that it will be useful, but
0014  * WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * Lesser General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU Lesser General Public License
0019  * along with this program.  If not, see <https://www.gnu.org/licenses/>
0020  *
0021  */
0022 
0023 #ifndef GNUTLS_TPM_H
0024 #define GNUTLS_TPM_H
0025 
0026 #include <gnutls/gnutls.h>
0027 #include <gnutls/x509.h>
0028 
0029 #ifdef __cplusplus
0030 extern "C" {
0031 #endif
0032 
0033 struct tpm_key_list_st;
0034 typedef struct tpm_key_list_st *gnutls_tpm_key_list_t;
0035 
0036 #define GNUTLS_TPM_KEY_SIGNING (1 << 1)
0037 #define GNUTLS_TPM_REGISTER_KEY (1 << 2)
0038 #define GNUTLS_TPM_KEY_USER (1 << 3)
0039 
0040 /**
0041  * gnutls_tpmkey_fmt_t:
0042  * @GNUTLS_TPMKEY_FMT_RAW: The portable data format.
0043  * @GNUTLS_TPMKEY_FMT_DER: An alias for the raw format.
0044  * @GNUTLS_TPMKEY_FMT_CTK_PEM: A custom data format used by some TPM tools.
0045  *
0046  * Enumeration of different certificate encoding formats.
0047  */
0048 typedef enum {
0049     GNUTLS_TPMKEY_FMT_RAW = 0,
0050     GNUTLS_TPMKEY_FMT_DER = GNUTLS_TPMKEY_FMT_RAW,
0051     GNUTLS_TPMKEY_FMT_CTK_PEM = 1
0052 } gnutls_tpmkey_fmt_t;
0053 
0054 int gnutls_tpm_privkey_generate(gnutls_pk_algorithm_t pk, unsigned int bits,
0055                 const char *srk_password,
0056                 const char *key_password,
0057                 gnutls_tpmkey_fmt_t format,
0058                 gnutls_x509_crt_fmt_t pub_format,
0059                 gnutls_datum_t *privkey, gnutls_datum_t *pubkey,
0060                 unsigned int flags);
0061 
0062 void gnutls_tpm_key_list_deinit(gnutls_tpm_key_list_t list);
0063 int gnutls_tpm_key_list_get_url(gnutls_tpm_key_list_t list, unsigned int idx,
0064                 char **url, unsigned int flags);
0065 int gnutls_tpm_get_registered(gnutls_tpm_key_list_t *list);
0066 int gnutls_tpm_privkey_delete(const char *url, const char *srk_password);
0067 
0068 #ifdef __cplusplus
0069 }
0070 #endif
0071 
0072 #endif /* GNUTLS_TPM_H */