2 * Copyright (C) 2003, 2004, 2005 Free Software Foundation
4 * Author: Nikos Mavroyanopoulos
6 * This file is part of GNUTLS.
8 * The GNUTLS library 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
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
25 #ifndef GNUTLS_PKCS12_H
26 # define GNUTLS_PKCS12_H
33 #include <gnutls/x509.h>
35 /* PKCS12 structures handling
37 struct gnutls_pkcs12_int
;
38 typedef struct gnutls_pkcs12_int
*gnutls_pkcs12_t
;
40 struct gnutls_pkcs12_bag_int
;
41 typedef struct gnutls_pkcs12_bag_int
*gnutls_pkcs12_bag_t
;
43 int gnutls_pkcs12_init (gnutls_pkcs12_t
* pkcs12
);
44 void gnutls_pkcs12_deinit (gnutls_pkcs12_t pkcs12
);
45 int gnutls_pkcs12_import (gnutls_pkcs12_t pkcs12
,
46 const gnutls_datum_t
* data
,
47 gnutls_x509_crt_fmt format
, unsigned int flags
);
48 int gnutls_pkcs12_export (gnutls_pkcs12_t pkcs12
,
49 gnutls_x509_crt_fmt format
, void *output_data
,
50 size_t * output_data_size
);
52 int gnutls_pkcs12_get_bag (gnutls_pkcs12_t pkcs12
,
53 int indx
, gnutls_pkcs12_bag_t bag
);
54 int gnutls_pkcs12_set_bag (gnutls_pkcs12_t pkcs12
, gnutls_pkcs12_bag_t bag
);
56 int gnutls_pkcs12_generate_mac (gnutls_pkcs12_t pkcs12
, const char *pass
);
57 int gnutls_pkcs12_verify_mac (gnutls_pkcs12_t pkcs12
, const char *pass
);
59 int gnutls_pkcs12_bag_decrypt (gnutls_pkcs12_bag_t bag
, const char *pass
);
60 int gnutls_pkcs12_bag_encrypt (gnutls_pkcs12_bag_t bag
, const char *pass
,
63 typedef enum gnutls_pkcs12_bag_type_t
67 GNUTLS_BAG_PKCS8_ENCRYPTED_KEY
= 1,
69 GNUTLS_BAG_CERTIFICATE
,
71 GNUTLS_BAG_ENCRYPTED
= 10,
72 GNUTLS_BAG_UNKNOWN
= 20
73 } gnutls_pkcs12_bag_type_t
;
75 gnutls_pkcs12_bag_type_t
gnutls_pkcs12_bag_get_type (gnutls_pkcs12_bag_t
77 int gnutls_pkcs12_bag_get_data (gnutls_pkcs12_bag_t bag
, int indx
,
78 gnutls_datum_t
* data
);
79 int gnutls_pkcs12_bag_set_data (gnutls_pkcs12_bag_t bag
,
80 gnutls_pkcs12_bag_type_t type
,
81 const gnutls_datum_t
* data
);
82 int gnutls_pkcs12_bag_set_crl (gnutls_pkcs12_bag_t bag
,
83 gnutls_x509_crl_t crl
);
84 int gnutls_pkcs12_bag_set_crt (gnutls_pkcs12_bag_t bag
,
85 gnutls_x509_crt_t crt
);
87 int gnutls_pkcs12_bag_init (gnutls_pkcs12_bag_t
* bag
);
88 void gnutls_pkcs12_bag_deinit (gnutls_pkcs12_bag_t bag
);
89 int gnutls_pkcs12_bag_get_count (gnutls_pkcs12_bag_t bag
);
91 int gnutls_pkcs12_bag_get_key_id (gnutls_pkcs12_bag_t bag
, int indx
,
93 int gnutls_pkcs12_bag_set_key_id (gnutls_pkcs12_bag_t bag
, int indx
,
94 const gnutls_datum_t
* id
);
96 int gnutls_pkcs12_bag_get_friendly_name (gnutls_pkcs12_bag_t bag
, int indx
,
98 int gnutls_pkcs12_bag_set_friendly_name (gnutls_pkcs12_bag_t bag
, int indx
,
104 #endif /* GNUTLS_PKCS12_H */