File indexing completed on 2025-01-18 10:00:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #ifndef GNUTLS_PKCS12_H
0024 #define GNUTLS_PKCS12_H
0025
0026 #include <gnutls/x509.h>
0027
0028 #ifdef __cplusplus
0029 extern "C" {
0030 #endif
0031
0032
0033
0034 struct gnutls_pkcs12_int;
0035 typedef struct gnutls_pkcs12_int *gnutls_pkcs12_t;
0036
0037 struct gnutls_pkcs12_bag_int;
0038 typedef struct gnutls_pkcs12_bag_int *gnutls_pkcs12_bag_t;
0039
0040 int gnutls_pkcs12_init(gnutls_pkcs12_t *pkcs12);
0041 void gnutls_pkcs12_deinit(gnutls_pkcs12_t pkcs12);
0042 int gnutls_pkcs12_import(gnutls_pkcs12_t pkcs12, const gnutls_datum_t *data,
0043 gnutls_x509_crt_fmt_t format, unsigned int flags);
0044 int gnutls_pkcs12_export(gnutls_pkcs12_t pkcs12, gnutls_x509_crt_fmt_t format,
0045 void *output_data, size_t *output_data_size);
0046 int gnutls_pkcs12_export2(gnutls_pkcs12_t pkcs12, gnutls_x509_crt_fmt_t format,
0047 gnutls_datum_t *out);
0048
0049 int gnutls_pkcs12_get_bag(gnutls_pkcs12_t pkcs12, int indx,
0050 gnutls_pkcs12_bag_t bag);
0051 int gnutls_pkcs12_set_bag(gnutls_pkcs12_t pkcs12, gnutls_pkcs12_bag_t bag);
0052
0053 int gnutls_pkcs12_generate_mac(gnutls_pkcs12_t pkcs12, const char *pass);
0054 int gnutls_pkcs12_generate_mac2(gnutls_pkcs12_t pkcs12,
0055 gnutls_mac_algorithm_t mac, const char *pass);
0056 int gnutls_pkcs12_verify_mac(gnutls_pkcs12_t pkcs12, const char *pass);
0057
0058 int gnutls_pkcs12_bag_decrypt(gnutls_pkcs12_bag_t bag, const char *pass);
0059 int gnutls_pkcs12_bag_encrypt(gnutls_pkcs12_bag_t bag, const char *pass,
0060 unsigned int flags);
0061
0062 int gnutls_pkcs12_bag_enc_info(gnutls_pkcs12_bag_t bag, unsigned int *schema,
0063 unsigned int *cipher, void *salt,
0064 unsigned int *salt_size,
0065 unsigned int *iter_count, char **oid);
0066 int gnutls_pkcs12_mac_info(gnutls_pkcs12_t pkcs12, unsigned int *mac,
0067 void *salt, unsigned int *salt_size,
0068 unsigned int *iter_count, char **oid);
0069
0070 #define GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED 1
0071 int gnutls_pkcs12_simple_parse(gnutls_pkcs12_t p12, const char *password,
0072 gnutls_x509_privkey_t *key,
0073 gnutls_x509_crt_t **chain,
0074 unsigned int *chain_len,
0075 gnutls_x509_crt_t **extra_certs,
0076 unsigned int *extra_certs_len,
0077 gnutls_x509_crl_t *crl, unsigned int flags);
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092 typedef enum gnutls_pkcs12_bag_type_t {
0093 GNUTLS_BAG_EMPTY = 0,
0094 GNUTLS_BAG_PKCS8_ENCRYPTED_KEY = 1,
0095 GNUTLS_BAG_PKCS8_KEY = 2,
0096 GNUTLS_BAG_CERTIFICATE = 3,
0097 GNUTLS_BAG_CRL = 4,
0098 GNUTLS_BAG_SECRET = 5,
0099
0100
0101
0102
0103 GNUTLS_BAG_ENCRYPTED = 10,
0104 GNUTLS_BAG_UNKNOWN = 20
0105 } gnutls_pkcs12_bag_type_t;
0106
0107 int gnutls_pkcs12_bag_get_type(gnutls_pkcs12_bag_t bag, unsigned indx);
0108 int gnutls_pkcs12_bag_get_data(gnutls_pkcs12_bag_t bag, unsigned indx,
0109 gnutls_datum_t *data);
0110 int gnutls_pkcs12_bag_set_data(gnutls_pkcs12_bag_t bag,
0111 gnutls_pkcs12_bag_type_t type,
0112 const gnutls_datum_t *data);
0113 int gnutls_pkcs12_bag_set_crl(gnutls_pkcs12_bag_t bag, gnutls_x509_crl_t crl);
0114 int gnutls_pkcs12_bag_set_crt(gnutls_pkcs12_bag_t bag, gnutls_x509_crt_t crt);
0115
0116 int gnutls_pkcs12_bag_set_privkey(gnutls_pkcs12_bag_t bag,
0117 gnutls_x509_privkey_t privkey,
0118 const char *password, unsigned flags);
0119
0120 int gnutls_pkcs12_bag_init(gnutls_pkcs12_bag_t *bag);
0121 void gnutls_pkcs12_bag_deinit(gnutls_pkcs12_bag_t bag);
0122 int gnutls_pkcs12_bag_get_count(gnutls_pkcs12_bag_t bag);
0123
0124 int gnutls_pkcs12_bag_get_key_id(gnutls_pkcs12_bag_t bag, unsigned indx,
0125 gnutls_datum_t *id);
0126 int gnutls_pkcs12_bag_set_key_id(gnutls_pkcs12_bag_t bag, unsigned indx,
0127 const gnutls_datum_t *id);
0128
0129 int gnutls_pkcs12_bag_get_friendly_name(gnutls_pkcs12_bag_t bag, unsigned indx,
0130 char **name);
0131 int gnutls_pkcs12_bag_set_friendly_name(gnutls_pkcs12_bag_t bag, unsigned indx,
0132 const char *name);
0133
0134 #ifdef __cplusplus
0135 }
0136 #endif
0137
0138 #endif