1109998Smarkm=pod 2109998Smarkm 3109998Smarkm=head1 NAME 4109998Smarkm 5109998SmarkmPKCS12_parse - parse a PKCS#12 structure 6109998Smarkm 7109998Smarkm=head1 SYNOPSIS 8109998Smarkm 9109998Smarkm #include <openssl/pkcs12.h> 10109998Smarkm 11109998Smarkmint PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca); 12109998Smarkm 13109998Smarkm=head1 DESCRIPTION 14109998Smarkm 15109998SmarkmPKCS12_parse() parses a PKCS12 structure. 16109998Smarkm 17109998SmarkmB<p12> is the B<PKCS12> structure to parse. B<pass> is the passphrase to use. 18109998SmarkmIf successful the private key will be written to B<*pkey>, the corresponding 19109998Smarkmcertificate to B<*cert> and any additional certificates to B<*ca>. 20109998Smarkm 21109998Smarkm=head1 NOTES 22109998Smarkm 23205128SsimonThe parameters B<pkey> and B<cert> cannot be B<NULL>. B<ca> can be <NULL> in 24205128Ssimonwhich case additional certificates will be discarded. B<*ca> can also be a 25205128Ssimonvalid STACK in which case additional certificates are appended to B<*ca>. If 26205128SsimonB<*ca> is B<NULL> a new STACK will be allocated. 27109998Smarkm 28205128SsimonThe B<friendlyName> and B<localKeyID> attributes (if present) on each 29205128Ssimoncertificate will be stored in the B<alias> and B<keyid> attributes of the 30205128SsimonB<X509> structure. 31109998Smarkm 32205128Ssimon=head1 RETURN VALUES 33205128Ssimon 34205128SsimonPKCS12_parse() returns 1 for success and zero if an error occurred. 35205128Ssimon 36205128SsimonThe error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)> 37205128Ssimon 38109998Smarkm=head1 BUGS 39109998Smarkm 40205128SsimonOnly a single private key and corresponding certificate is returned by this 41205128Ssimonfunction. More complex PKCS#12 files with multiple private keys will only 42205128Ssimonreturn the first match. 43109998Smarkm 44205128SsimonOnly B<friendlyName> and B<localKeyID> attributes are currently stored in 45205128Ssimoncertificates. Other attributes are discarded. 46109998Smarkm 47205128SsimonAttributes currently cannot be stored in the private key B<EVP_PKEY> structure. 48109998Smarkm 49109998Smarkm=head1 SEE ALSO 50109998Smarkm 51109998SmarkmL<d2i_PKCS12(3)|d2i_PKCS12(3)> 52109998Smarkm 53109998Smarkm=head1 HISTORY 54109998Smarkm 55109998SmarkmPKCS12_parse was added in OpenSSL 0.9.3 56109998Smarkm 57109998Smarkm=cut 58