1*2175Sjp161948=pod 2*2175Sjp161948 3*2175Sjp161948=head1 NAME 4*2175Sjp161948 5*2175Sjp161948PKCS12_parse - parse a PKCS#12 structure 6*2175Sjp161948 7*2175Sjp161948=head1 SYNOPSIS 8*2175Sjp161948 9*2175Sjp161948 #include <openssl/pkcs12.h> 10*2175Sjp161948 11*2175Sjp161948int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca); 12*2175Sjp161948 13*2175Sjp161948=head1 DESCRIPTION 14*2175Sjp161948 15*2175Sjp161948PKCS12_parse() parses a PKCS12 structure. 16*2175Sjp161948 17*2175Sjp161948B<p12> is the B<PKCS12> structure to parse. B<pass> is the passphrase to use. 18*2175Sjp161948If successful the private key will be written to B<*pkey>, the corresponding 19*2175Sjp161948certificate to B<*cert> and any additional certificates to B<*ca>. 20*2175Sjp161948 21*2175Sjp161948=head1 NOTES 22*2175Sjp161948 23*2175Sjp161948The parameters B<pkey> and B<cert> cannot be B<NULL>. B<ca> can be <NULL> 24*2175Sjp161948in which case additional certificates will be discarded. B<*ca> can also 25*2175Sjp161948be a valid STACK in which case additional certificates are appended to 26*2175Sjp161948B<*ca>. If B<*ca> is B<NULL> a new STACK will be allocated. 27*2175Sjp161948 28*2175Sjp161948The B<friendlyName> and B<localKeyID> attributes (if present) on each certificate 29*2175Sjp161948will be stored in the B<alias> and B<keyid> attributes of the B<X509> structure. 30*2175Sjp161948 31*2175Sjp161948=head1 BUGS 32*2175Sjp161948 33*2175Sjp161948Only a single private key and corresponding certificate is returned by this function. 34*2175Sjp161948More complex PKCS#12 files with multiple private keys will only return the first 35*2175Sjp161948match. 36*2175Sjp161948 37*2175Sjp161948Only B<friendlyName> and B<localKeyID> attributes are currently stored in certificates. 38*2175Sjp161948Other attributes are discarded. 39*2175Sjp161948 40*2175Sjp161948Attributes currently cannot be store in the private key B<EVP_PKEY> structure. 41*2175Sjp161948 42*2175Sjp161948=head1 SEE ALSO 43*2175Sjp161948 44*2175Sjp161948L<d2i_PKCS12(3)|d2i_PKCS12(3)> 45*2175Sjp161948 46*2175Sjp161948=head1 HISTORY 47*2175Sjp161948 48*2175Sjp161948PKCS12_parse was added in OpenSSL 0.9.3 49*2175Sjp161948 50*2175Sjp161948=cut 51