1PKCS12_PARSE(3)                     OpenSSL                    PKCS12_PARSE(3)
2
3
4

NAME

6       PKCS12_parse - parse a PKCS#12 structure
7

SYNOPSIS

9        #include <openssl/pkcs12.h>
10
11        int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,
12                         STACK_OF(X509) **ca);
13

DESCRIPTION

15       PKCS12_parse() parses a PKCS12 structure.
16
17       p12 is the PKCS12 structure to parse. pass is the passphrase to use.
18       If successful the private key will be written to *pkey, the
19       corresponding certificate to *cert and any additional certificates to
20       *ca.
21

NOTES

23       The parameters pkey and cert cannot be NULL. ca can be <NULL> in which
24       case additional certificates will be discarded. *ca can also be a valid
25       STACK in which case additional certificates are appended to *ca. If *ca
26       is NULL a new STACK will be allocated.
27
28       The friendlyName and localKeyID attributes (if present) on each
29       certificate will be stored in the alias and keyid attributes of the
30       X509 structure.
31
32       The parameter pass is interpreted as a string in the UTF-8 encoding. If
33       it is not valid UTF-8, then it is assumed to be ISO8859-1 instead.
34
35       In particular, this means that passwords in the locale character set
36       (or code page on Windows) must potentially be converted to UTF-8 before
37       use. This may include passwords from local text files, or input from
38       the terminal or command line. Refer to the documentation of
39       UI_OpenSSL(3), for example.
40

RETURN VALUES

42       PKCS12_parse() returns 1 for success and zero if an error occurred.
43
44       The error can be obtained from ERR_get_error(3)
45

BUGS

47       Only a single private key and corresponding certificate is returned by
48       this function. More complex PKCS#12 files with multiple private keys
49       will only return the first match.
50
51       Only friendlyName and localKeyID attributes are currently stored in
52       certificates. Other attributes are discarded.
53
54       Attributes currently cannot be stored in the private key EVP_PKEY
55       structure.
56

SEE ALSO

58       d2i_PKCS12(3), passphrase-encoding(7)
59
61       Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.
62
63       Licensed under the OpenSSL license (the "License").  You may not use
64       this file except in compliance with the License.  You can obtain a copy
65       in the file LICENSE in the source distribution or at
66       <https://www.openssl.org/source/license.html>.
67
68
69
701.1.1q                            2023-07-20                   PKCS12_PARSE(3)
Impressum