5 PKCS12_parse - parse a PKCS#12 structure
9 #include <openssl/pkcs12.h>
11 int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,
16 PKCS12_parse() parses a PKCS12 structure.
18 B<p12> is the B<PKCS12> structure to parse. B<pass> is the passphrase to use.
19 If successful the private key will be written to B<*pkey>, the corresponding
20 certificate to B<*cert> and any additional certificates to B<*ca>.
24 The parameters B<pkey> and B<cert> cannot be B<NULL>. B<ca> can be <NULL> in
25 which case additional certificates will be discarded. B<*ca> can also be a
26 valid STACK in which case additional certificates are appended to B<*ca>. If
27 B<*ca> is B<NULL> a new STACK will be allocated.
29 The B<friendlyName> and B<localKeyID> attributes (if present) on each
30 certificate will be stored in the B<alias> and B<keyid> attributes of the
35 PKCS12_parse() returns 1 for success and zero if an error occurred.
37 The error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>
41 Only a single private key and corresponding certificate is returned by this
42 function. More complex PKCS#12 files with multiple private keys will only
43 return the first match.
45 Only B<friendlyName> and B<localKeyID> attributes are currently stored in
46 certificates. Other attributes are discarded.
48 Attributes currently cannot be stored in the private key B<EVP_PKEY> structure.
52 L<d2i_PKCS12(3)|d2i_PKCS12(3)>
56 PKCS12_parse was added in OpenSSL 0.9.3