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 11344604Sjkim int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, 12344604Sjkim STACK_OF(X509) **ca); 13109998Smarkm 14109998Smarkm=head1 DESCRIPTION 15109998Smarkm 16109998SmarkmPKCS12_parse() parses a PKCS12 structure. 17109998Smarkm 18109998SmarkmB<p12> is the B<PKCS12> structure to parse. B<pass> is the passphrase to use. 19109998SmarkmIf successful the private key will be written to B<*pkey>, the corresponding 20109998Smarkmcertificate to B<*cert> and any additional certificates to B<*ca>. 21109998Smarkm 22109998Smarkm=head1 NOTES 23109998Smarkm 24205128SsimonThe parameters B<pkey> and B<cert> cannot be B<NULL>. B<ca> can be <NULL> in 25205128Ssimonwhich case additional certificates will be discarded. B<*ca> can also be a 26205128Ssimonvalid STACK in which case additional certificates are appended to B<*ca>. If 27205128SsimonB<*ca> is B<NULL> a new STACK will be allocated. 28109998Smarkm 29205128SsimonThe B<friendlyName> and B<localKeyID> attributes (if present) on each 30205128Ssimoncertificate will be stored in the B<alias> and B<keyid> attributes of the 31205128SsimonB<X509> structure. 32109998Smarkm 33205128Ssimon=head1 RETURN VALUES 34205128Ssimon 35205128SsimonPKCS12_parse() returns 1 for success and zero if an error occurred. 36205128Ssimon 37205128SsimonThe error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)> 38205128Ssimon 39109998Smarkm=head1 BUGS 40109998Smarkm 41205128SsimonOnly a single private key and corresponding certificate is returned by this 42205128Ssimonfunction. More complex PKCS#12 files with multiple private keys will only 43205128Ssimonreturn the first match. 44109998Smarkm 45205128SsimonOnly B<friendlyName> and B<localKeyID> attributes are currently stored in 46205128Ssimoncertificates. Other attributes are discarded. 47109998Smarkm 48205128SsimonAttributes currently cannot be stored in the private key B<EVP_PKEY> structure. 49109998Smarkm 50109998Smarkm=head1 SEE ALSO 51109998Smarkm 52109998SmarkmL<d2i_PKCS12(3)|d2i_PKCS12(3)> 53109998Smarkm 54109998Smarkm=head1 HISTORY 55109998Smarkm 56109998SmarkmPKCS12_parse was added in OpenSSL 0.9.3 57109998Smarkm 58109998Smarkm=cut 59