1*ebfedea0SLionel Sambuc=pod 2*ebfedea0SLionel Sambuc 3*ebfedea0SLionel Sambuc=head1 NAME 4*ebfedea0SLionel Sambuc 5*ebfedea0SLionel SambucPKCS12_parse - parse a PKCS#12 structure 6*ebfedea0SLionel Sambuc 7*ebfedea0SLionel Sambuc=head1 SYNOPSIS 8*ebfedea0SLionel Sambuc 9*ebfedea0SLionel Sambuc #include <openssl/pkcs12.h> 10*ebfedea0SLionel Sambuc 11*ebfedea0SLionel Sambucint PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca); 12*ebfedea0SLionel Sambuc 13*ebfedea0SLionel Sambuc=head1 DESCRIPTION 14*ebfedea0SLionel Sambuc 15*ebfedea0SLionel SambucPKCS12_parse() parses a PKCS12 structure. 16*ebfedea0SLionel Sambuc 17*ebfedea0SLionel SambucB<p12> is the B<PKCS12> structure to parse. B<pass> is the passphrase to use. 18*ebfedea0SLionel SambucIf successful the private key will be written to B<*pkey>, the corresponding 19*ebfedea0SLionel Sambuccertificate to B<*cert> and any additional certificates to B<*ca>. 20*ebfedea0SLionel Sambuc 21*ebfedea0SLionel Sambuc=head1 NOTES 22*ebfedea0SLionel Sambuc 23*ebfedea0SLionel SambucThe parameters B<pkey> and B<cert> cannot be B<NULL>. B<ca> can be <NULL> in 24*ebfedea0SLionel Sambucwhich case additional certificates will be discarded. B<*ca> can also be a 25*ebfedea0SLionel Sambucvalid STACK in which case additional certificates are appended to B<*ca>. If 26*ebfedea0SLionel SambucB<*ca> is B<NULL> a new STACK will be allocated. 27*ebfedea0SLionel Sambuc 28*ebfedea0SLionel SambucThe B<friendlyName> and B<localKeyID> attributes (if present) on each 29*ebfedea0SLionel Sambuccertificate will be stored in the B<alias> and B<keyid> attributes of the 30*ebfedea0SLionel SambucB<X509> structure. 31*ebfedea0SLionel Sambuc 32*ebfedea0SLionel Sambuc=head1 RETURN VALUES 33*ebfedea0SLionel Sambuc 34*ebfedea0SLionel SambucPKCS12_parse() returns 1 for success and zero if an error occurred. 35*ebfedea0SLionel Sambuc 36*ebfedea0SLionel SambucThe error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)> 37*ebfedea0SLionel Sambuc 38*ebfedea0SLionel Sambuc=head1 BUGS 39*ebfedea0SLionel Sambuc 40*ebfedea0SLionel SambucOnly a single private key and corresponding certificate is returned by this 41*ebfedea0SLionel Sambucfunction. More complex PKCS#12 files with multiple private keys will only 42*ebfedea0SLionel Sambucreturn the first match. 43*ebfedea0SLionel Sambuc 44*ebfedea0SLionel SambucOnly B<friendlyName> and B<localKeyID> attributes are currently stored in 45*ebfedea0SLionel Sambuccertificates. Other attributes are discarded. 46*ebfedea0SLionel Sambuc 47*ebfedea0SLionel SambucAttributes currently cannot be stored in the private key B<EVP_PKEY> structure. 48*ebfedea0SLionel Sambuc 49*ebfedea0SLionel Sambuc=head1 SEE ALSO 50*ebfedea0SLionel Sambuc 51*ebfedea0SLionel SambucL<d2i_PKCS12(3)|d2i_PKCS12(3)> 52*ebfedea0SLionel Sambuc 53*ebfedea0SLionel Sambuc=head1 HISTORY 54*ebfedea0SLionel Sambuc 55*ebfedea0SLionel SambucPKCS12_parse was added in OpenSSL 0.9.3 56*ebfedea0SLionel Sambuc 57*ebfedea0SLionel Sambuc=cut 58