1gnutls_pkcs12_simple_parse(3) gnutls gnutls_pkcs12_simple_parse(3)
2
3
4
6 gnutls_pkcs12_simple_parse - API function
7
9 #include <gnutls/pkcs12.h>
10
11 int gnutls_pkcs12_simple_parse(gnutls_pkcs12_t p12, const char * pass‐
12 word, gnutls_x509_privkey_t * key, gnutls_x509_crt_t ** chain, unsigned
13 int * chain_len, gnutls_x509_crt_t ** extra_certs, unsigned int *
14 extra_certs_len, gnutls_x509_crl_t * crl, unsigned int flags);
15
17 gnutls_pkcs12_t p12
18 should contain a gnutls_pkcs12_t structure
19
20 const char * password
21 optional password used to decrypt the structure, bags and
22 keys.
23
24 gnutls_x509_privkey_t * key
25 a structure to store the parsed private key.
26
27 gnutls_x509_crt_t ** chain
28 the corresponding to key certificate chain (may be NULL)
29
30 unsigned int * chain_len
31 will be updated with the number of additional (may be NULL)
32
33 gnutls_x509_crt_t ** extra_certs
34 optional pointer to receive an array of additional certifi‐
35 cates found in the PKCS12 structure (may be NULL).
36
37 unsigned int * extra_certs_len
38 will be updated with the number of additional certs (may be
39 NULL).
40
41 gnutls_x509_crl_t * crl
42 an optional structure to store the parsed CRL (may be
43 NULL).
44
45 unsigned int flags
46 should be zero or one of GNUTLS_PKCS12_SP_*
47
49 This function parses a PKCS12 structure in pkcs12 and extracts the
50 private key, the corresponding certificate chain, any additional cer‐
51 tificates and a CRL.
52
53 The extra_certs and extra_certs_len parameters are optional and both
54 may be set to NULL. If either is non-NULL, then both must be set. The
55 value for extra_certs is allocated using gnutls_malloc().
56
57 Encrypted PKCS12 bags and PKCS8 private keys are supported, but only
58 with password based security and the same password for all operations.
59
60 Note that a PKCS12 structure may contain many keys and/or certificates,
61 and there is no way to identify which key/certificate pair you want.
62 For this reason this function is useful for PKCS12 files that contain
63 only one key/certificate pair and/or one CRL.
64
65 If the provided structure has encrypted fields but no password is pro‐
66 vided then this function returns GNUTLS_E_DECRYPTION_FAILED.
67
68 Note that normally the chain constructed does not include self signed
69 certificates, to comply with TLS' requirements. If, however, the flag
70 GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED is specified then self signed cer‐
71 tificates will be included in the chain.
72
73 Prior to using this function the PKCS 12 structure integrity must be
74 verified using gnutls_pkcs12_verify_mac().
75
77 On success, GNUTLS_E_SUCCESS [22m(0) is returned, otherwise a negative
78 error value.
79
81 3.1.0
82
84 Report bugs to <bugs@gnutls.org>.
85 Home page: http://www.gnutls.org
86
87
89 Copyright © 2001-2014 Free Software Foundation, Inc..
90 Copying and distribution of this file, with or without modification,
91 are permitted in any medium without royalty provided the copyright
92 notice and this notice are preserved.
93
95 The full documentation for gnutls is maintained as a Texinfo manual.
96 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
97 visit
98
99 http://www.gnutls.org/manual/
100
101gnutls 3.3.29 gnutls_pkcs12_simple_parse(3)