Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:48

0001 /*
0002  * WARNING: do not edit!
0003  * Generated by Makefile from include/openssl/pkcs12.h.in
0004  *
0005  * Copyright 1999-2024 The OpenSSL Project Authors. All Rights Reserved.
0006  *
0007  * Licensed under the Apache License 2.0 (the "License").  You may not use
0008  * this file except in compliance with the License.  You can obtain a copy
0009  * in the file LICENSE in the source distribution or at
0010  * https://www.openssl.org/source/license.html
0011  */
0012 
0013 
0014 
0015 #ifndef OPENSSL_PKCS12_H
0016 # define OPENSSL_PKCS12_H
0017 # pragma once
0018 
0019 # include <openssl/macros.h>
0020 # ifndef OPENSSL_NO_DEPRECATED_3_0
0021 #  define HEADER_PKCS12_H
0022 # endif
0023 
0024 # include <openssl/bio.h>
0025 # include <openssl/core.h>
0026 # include <openssl/x509.h>
0027 # include <openssl/pkcs12err.h>
0028 # ifndef OPENSSL_NO_STDIO
0029 #  include <stdio.h>
0030 # endif
0031 
0032 #ifdef __cplusplus
0033 extern "C" {
0034 #endif
0035 
0036 # define PKCS12_KEY_ID   1
0037 # define PKCS12_IV_ID    2
0038 # define PKCS12_MAC_ID   3
0039 
0040 /* Default iteration count */
0041 # ifndef PKCS12_DEFAULT_ITER
0042 #  define PKCS12_DEFAULT_ITER     PKCS5_DEFAULT_ITER
0043 # endif
0044 
0045 # define PKCS12_MAC_KEY_LENGTH 20
0046 
0047 /* The macro is expected to be used only internally. Kept for backwards compatibility. */
0048 # define PKCS12_SALT_LEN 8
0049 
0050 /* It's not clear if these are actually needed... */
0051 # define PKCS12_key_gen PKCS12_key_gen_utf8
0052 # define PKCS12_add_friendlyname PKCS12_add_friendlyname_utf8
0053 
0054 /* MS key usage constants */
0055 
0056 # define KEY_EX  0x10
0057 # define KEY_SIG 0x80
0058 
0059 typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA;
0060 
0061 typedef struct PKCS12_st PKCS12;
0062 
0063 typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG;
0064 
0065 SKM_DEFINE_STACK_OF_INTERNAL(PKCS12_SAFEBAG, PKCS12_SAFEBAG, PKCS12_SAFEBAG)
0066 #define sk_PKCS12_SAFEBAG_num(sk) OPENSSL_sk_num(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk))
0067 #define sk_PKCS12_SAFEBAG_value(sk, idx) ((PKCS12_SAFEBAG *)OPENSSL_sk_value(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk), (idx)))
0068 #define sk_PKCS12_SAFEBAG_new(cmp) ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_new(ossl_check_PKCS12_SAFEBAG_compfunc_type(cmp)))
0069 #define sk_PKCS12_SAFEBAG_new_null() ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_new_null())
0070 #define sk_PKCS12_SAFEBAG_new_reserve(cmp, n) ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_new_reserve(ossl_check_PKCS12_SAFEBAG_compfunc_type(cmp), (n)))
0071 #define sk_PKCS12_SAFEBAG_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_PKCS12_SAFEBAG_sk_type(sk), (n))
0072 #define sk_PKCS12_SAFEBAG_free(sk) OPENSSL_sk_free(ossl_check_PKCS12_SAFEBAG_sk_type(sk))
0073 #define sk_PKCS12_SAFEBAG_zero(sk) OPENSSL_sk_zero(ossl_check_PKCS12_SAFEBAG_sk_type(sk))
0074 #define sk_PKCS12_SAFEBAG_delete(sk, i) ((PKCS12_SAFEBAG *)OPENSSL_sk_delete(ossl_check_PKCS12_SAFEBAG_sk_type(sk), (i)))
0075 #define sk_PKCS12_SAFEBAG_delete_ptr(sk, ptr) ((PKCS12_SAFEBAG *)OPENSSL_sk_delete_ptr(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr)))
0076 #define sk_PKCS12_SAFEBAG_push(sk, ptr) OPENSSL_sk_push(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr))
0077 #define sk_PKCS12_SAFEBAG_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr))
0078 #define sk_PKCS12_SAFEBAG_pop(sk) ((PKCS12_SAFEBAG *)OPENSSL_sk_pop(ossl_check_PKCS12_SAFEBAG_sk_type(sk)))
0079 #define sk_PKCS12_SAFEBAG_shift(sk) ((PKCS12_SAFEBAG *)OPENSSL_sk_shift(ossl_check_PKCS12_SAFEBAG_sk_type(sk)))
0080 #define sk_PKCS12_SAFEBAG_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_PKCS12_SAFEBAG_sk_type(sk),ossl_check_PKCS12_SAFEBAG_freefunc_type(freefunc))
0081 #define sk_PKCS12_SAFEBAG_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr), (idx))
0082 #define sk_PKCS12_SAFEBAG_set(sk, idx, ptr) ((PKCS12_SAFEBAG *)OPENSSL_sk_set(ossl_check_PKCS12_SAFEBAG_sk_type(sk), (idx), ossl_check_PKCS12_SAFEBAG_type(ptr)))
0083 #define sk_PKCS12_SAFEBAG_find(sk, ptr) OPENSSL_sk_find(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr))
0084 #define sk_PKCS12_SAFEBAG_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr))
0085 #define sk_PKCS12_SAFEBAG_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr), pnum)
0086 #define sk_PKCS12_SAFEBAG_sort(sk) OPENSSL_sk_sort(ossl_check_PKCS12_SAFEBAG_sk_type(sk))
0087 #define sk_PKCS12_SAFEBAG_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk))
0088 #define sk_PKCS12_SAFEBAG_dup(sk) ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_dup(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk)))
0089 #define sk_PKCS12_SAFEBAG_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_deep_copy(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_copyfunc_type(copyfunc), ossl_check_PKCS12_SAFEBAG_freefunc_type(freefunc)))
0090 #define sk_PKCS12_SAFEBAG_set_cmp_func(sk, cmp) ((sk_PKCS12_SAFEBAG_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_compfunc_type(cmp)))
0091 
0092 
0093 typedef struct pkcs12_bag_st PKCS12_BAGS;
0094 
0095 # define PKCS12_ERROR    0
0096 # define PKCS12_OK       1
0097 
0098 /* Compatibility macros */
0099 
0100 #ifndef OPENSSL_NO_DEPRECATED_1_1_0
0101 
0102 # define M_PKCS12_bag_type PKCS12_bag_type
0103 # define M_PKCS12_cert_bag_type PKCS12_cert_bag_type
0104 # define M_PKCS12_crl_bag_type PKCS12_cert_bag_type
0105 
0106 # define PKCS12_certbag2x509 PKCS12_SAFEBAG_get1_cert
0107 # define PKCS12_certbag2scrl PKCS12_SAFEBAG_get1_crl
0108 # define PKCS12_bag_type PKCS12_SAFEBAG_get_nid
0109 # define PKCS12_cert_bag_type PKCS12_SAFEBAG_get_bag_nid
0110 # define PKCS12_x5092certbag PKCS12_SAFEBAG_create_cert
0111 # define PKCS12_x509crl2certbag PKCS12_SAFEBAG_create_crl
0112 # define PKCS12_MAKE_KEYBAG PKCS12_SAFEBAG_create0_p8inf
0113 # define PKCS12_MAKE_SHKEYBAG PKCS12_SAFEBAG_create_pkcs8_encrypt
0114 
0115 #endif
0116 #ifndef OPENSSL_NO_DEPRECATED_1_1_0
0117 OSSL_DEPRECATEDIN_1_1_0 ASN1_TYPE *PKCS12_get_attr(const PKCS12_SAFEBAG *bag,
0118                                                    int attr_nid);
0119 #endif
0120 
0121 ASN1_TYPE *PKCS8_get_attr(PKCS8_PRIV_KEY_INFO *p8, int attr_nid);
0122 int PKCS12_mac_present(const PKCS12 *p12);
0123 void PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac,
0124                      const X509_ALGOR **pmacalg,
0125                      const ASN1_OCTET_STRING **psalt,
0126                      const ASN1_INTEGER **piter,
0127                      const PKCS12 *p12);
0128 
0129 const ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag,
0130                                           int attr_nid);
0131 const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag);
0132 int PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag);
0133 int PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag);
0134 const ASN1_TYPE *PKCS12_SAFEBAG_get0_bag_obj(const PKCS12_SAFEBAG *bag);
0135 const ASN1_OBJECT *PKCS12_SAFEBAG_get0_bag_type(const PKCS12_SAFEBAG *bag);
0136 
0137 X509 *PKCS12_SAFEBAG_get1_cert_ex(const PKCS12_SAFEBAG *bag, OSSL_LIB_CTX *libctx, const char *propq);
0138 X509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag);
0139 X509_CRL *PKCS12_SAFEBAG_get1_crl_ex(const PKCS12_SAFEBAG *bag, OSSL_LIB_CTX *libctx, const char *propq);
0140 X509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag);
0141 const STACK_OF(PKCS12_SAFEBAG) *
0142 PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag);
0143 const PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag);
0144 const X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag);
0145 
0146 PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509);
0147 PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl);
0148 PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_secret(int type, int vtype, const unsigned char *value, int len);
0149 PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8);
0150 PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8);
0151 PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid,
0152                                                     const char *pass,
0153                                                     int passlen,
0154                                                     unsigned char *salt,
0155                                                     int saltlen, int iter,
0156                                                     PKCS8_PRIV_KEY_INFO *p8inf);
0157 PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(int pbe_nid,
0158                                                        const char *pass,
0159                                                        int passlen,
0160                                                        unsigned char *salt,
0161                                                        int saltlen, int iter,
0162                                                        PKCS8_PRIV_KEY_INFO *p8inf,
0163                                                        OSSL_LIB_CTX *ctx,
0164                                                        const char *propq);
0165 
0166 PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it,
0167                                          int nid1, int nid2);
0168 PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass,
0169                                    int passlen);
0170 PKCS8_PRIV_KEY_INFO *PKCS8_decrypt_ex(const X509_SIG *p8, const char *pass,
0171                                       int passlen, OSSL_LIB_CTX *ctx,
0172                                       const char *propq);
0173 PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag,
0174                                          const char *pass, int passlen);
0175 PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey_ex(const PKCS12_SAFEBAG *bag,
0176                                             const char *pass, int passlen,
0177                                             OSSL_LIB_CTX *ctx,
0178                                             const char *propq);
0179 X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,
0180                         const char *pass, int passlen, unsigned char *salt,
0181                         int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8);
0182 X509_SIG *PKCS8_encrypt_ex(int pbe_nid, const EVP_CIPHER *cipher,
0183                            const char *pass, int passlen, unsigned char *salt,
0184                            int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8,
0185                            OSSL_LIB_CTX *ctx, const char *propq);
0186 X509_SIG *PKCS8_set0_pbe(const char *pass, int passlen,
0187                         PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe);
0188 X509_SIG *PKCS8_set0_pbe_ex(const char *pass, int passlen,
0189                             PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe,
0190                             OSSL_LIB_CTX *ctx, const char *propq);
0191 PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk);
0192 STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7);
0193 PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen,
0194                              unsigned char *salt, int saltlen, int iter,
0195                              STACK_OF(PKCS12_SAFEBAG) *bags);
0196 PKCS7 *PKCS12_pack_p7encdata_ex(int pbe_nid, const char *pass, int passlen,
0197                                 unsigned char *salt, int saltlen, int iter,
0198                                 STACK_OF(PKCS12_SAFEBAG) *bags,
0199                                 OSSL_LIB_CTX *ctx, const char *propq);
0200 
0201 STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass,
0202                                                   int passlen);
0203 
0204 int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes);
0205 STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12);
0206 
0207 int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name,
0208                           int namelen);
0209 int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name,
0210                                 int namelen);
0211 int PKCS12_add_friendlyname_utf8(PKCS12_SAFEBAG *bag, const char *name,
0212                                  int namelen);
0213 int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name,
0214                            int namelen);
0215 int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag,
0216                                 const unsigned char *name, int namelen);
0217 int PKCS12_add1_attr_by_NID(PKCS12_SAFEBAG *bag, int nid, int type,
0218                             const unsigned char *bytes, int len);
0219 int PKCS12_add1_attr_by_txt(PKCS12_SAFEBAG *bag, const char *attrname, int type,
0220                             const unsigned char *bytes, int len);
0221 int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage);
0222 ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs,
0223                                int attr_nid);
0224 char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag);
0225 const STACK_OF(X509_ATTRIBUTE) *
0226 PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag);
0227 void PKCS12_SAFEBAG_set0_attrs(PKCS12_SAFEBAG *bag, STACK_OF(X509_ATTRIBUTE) *attrs);
0228 unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor,
0229                                 const char *pass, int passlen,
0230                                 const unsigned char *in, int inlen,
0231                                 unsigned char **data, int *datalen,
0232                                 int en_de);
0233 unsigned char *PKCS12_pbe_crypt_ex(const X509_ALGOR *algor,
0234                                    const char *pass, int passlen,
0235                                    const unsigned char *in, int inlen,
0236                                    unsigned char **data, int *datalen,
0237                                    int en_de, OSSL_LIB_CTX *libctx,
0238                                    const char *propq);
0239 void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it,
0240                               const char *pass, int passlen,
0241                               const ASN1_OCTET_STRING *oct, int zbuf);
0242 void *PKCS12_item_decrypt_d2i_ex(const X509_ALGOR *algor, const ASN1_ITEM *it,
0243                                  const char *pass, int passlen,
0244                                  const ASN1_OCTET_STRING *oct, int zbuf,
0245                                  OSSL_LIB_CTX *libctx, 
0246                                  const char *propq);
0247 ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor,
0248                                            const ASN1_ITEM *it,
0249                                            const char *pass, int passlen,
0250                                            void *obj, int zbuf);
0251 ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt_ex(X509_ALGOR *algor,
0252                                               const ASN1_ITEM *it,
0253                                               const char *pass, int passlen,
0254                                               void *obj, int zbuf,
0255                                               OSSL_LIB_CTX *ctx,
0256                                               const char *propq);
0257 PKCS12 *PKCS12_init(int mode);
0258 PKCS12 *PKCS12_init_ex(int mode, OSSL_LIB_CTX *ctx, const char *propq);
0259 
0260 int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt,
0261                        int saltlen, int id, int iter, int n,
0262                        unsigned char *out, const EVP_MD *md_type);
0263 int PKCS12_key_gen_asc_ex(const char *pass, int passlen, unsigned char *salt,
0264                           int saltlen, int id, int iter, int n,
0265                           unsigned char *out, const EVP_MD *md_type,
0266                           OSSL_LIB_CTX *ctx, const char *propq);
0267 int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
0268                        int saltlen, int id, int iter, int n,
0269                        unsigned char *out, const EVP_MD *md_type);
0270 int PKCS12_key_gen_uni_ex(unsigned char *pass, int passlen, unsigned char *salt,
0271                           int saltlen, int id, int iter, int n,
0272                           unsigned char *out, const EVP_MD *md_type,
0273                           OSSL_LIB_CTX *ctx, const char *propq);
0274 int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt,
0275                         int saltlen, int id, int iter, int n,
0276                         unsigned char *out, const EVP_MD *md_type);
0277 int PKCS12_key_gen_utf8_ex(const char *pass, int passlen, unsigned char *salt,
0278                            int saltlen, int id, int iter, int n,
0279                            unsigned char *out, const EVP_MD *md_type,
0280                            OSSL_LIB_CTX *ctx, const char *propq);
0281 
0282 int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
0283                         ASN1_TYPE *param, const EVP_CIPHER *cipher,
0284                         const EVP_MD *md_type, int en_de);
0285 int PKCS12_PBE_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
0286                            ASN1_TYPE *param, const EVP_CIPHER *cipher,
0287                            const EVP_MD *md_type, int en_de,
0288                            OSSL_LIB_CTX *libctx, const char *propq);
0289 int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
0290                    unsigned char *mac, unsigned int *maclen);
0291 int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen);
0292 int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen,
0293                    unsigned char *salt, int saltlen, int iter,
0294                    const EVP_MD *md_type);
0295 int PKCS12_set_pbmac1_pbkdf2(PKCS12 *p12, const char *pass, int passlen,
0296                              unsigned char *salt, int saltlen, int iter,
0297                              const EVP_MD *md_type, const char *prf_md_name);
0298 int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt,
0299                      int saltlen, const EVP_MD *md_type);
0300 unsigned char *OPENSSL_asc2uni(const char *asc, int asclen,
0301                                unsigned char **uni, int *unilen);
0302 char *OPENSSL_uni2asc(const unsigned char *uni, int unilen);
0303 unsigned char *OPENSSL_utf82uni(const char *asc, int asclen,
0304                                 unsigned char **uni, int *unilen);
0305 char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen);
0306 
0307 DECLARE_ASN1_FUNCTIONS(PKCS12)
0308 DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA)
0309 DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG)
0310 DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS)
0311 
0312 DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS)
0313 DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES)
0314 
0315 void PKCS12_PBE_add(void);
0316 int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,
0317                  STACK_OF(X509) **ca);
0318 typedef int PKCS12_create_cb(PKCS12_SAFEBAG *bag, void *cbarg);
0319 PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey,
0320                       X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert,
0321                       int iter, int mac_iter, int keytype);
0322 PKCS12 *PKCS12_create_ex(const char *pass, const char *name, EVP_PKEY *pkey,
0323                          X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert,
0324                          int iter, int mac_iter, int keytype,
0325                          OSSL_LIB_CTX *ctx, const char *propq);
0326 PKCS12 *PKCS12_create_ex2(const char *pass, const char *name, EVP_PKEY *pkey,
0327                           X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert,
0328                           int iter, int mac_iter, int keytype,
0329                           OSSL_LIB_CTX *ctx, const char *propq,
0330                           PKCS12_create_cb *cb, void *cbarg);
0331 
0332 PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert);
0333 PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags,
0334                                EVP_PKEY *key, int key_usage, int iter,
0335                                int key_nid, const char *pass);
0336 PKCS12_SAFEBAG *PKCS12_add_key_ex(STACK_OF(PKCS12_SAFEBAG) **pbags,
0337                                   EVP_PKEY *key, int key_usage, int iter,
0338                                   int key_nid, const char *pass,
0339                                   OSSL_LIB_CTX *ctx, const char *propq);
0340 
0341 PKCS12_SAFEBAG *PKCS12_add_secret(STACK_OF(PKCS12_SAFEBAG) **pbags,
0342                                   int nid_type, const unsigned char *value, int len);
0343 int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,
0344                     int safe_nid, int iter, const char *pass);
0345 int PKCS12_add_safe_ex(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,
0346                        int safe_nid, int iter, const char *pass,
0347                        OSSL_LIB_CTX *ctx, const char *propq);
0348 
0349 PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid);
0350 PKCS12 *PKCS12_add_safes_ex(STACK_OF(PKCS7) *safes, int p7_nid,
0351                             OSSL_LIB_CTX *ctx, const char *propq);
0352 
0353 int i2d_PKCS12_bio(BIO *bp, const PKCS12 *p12);
0354 # ifndef OPENSSL_NO_STDIO
0355 int i2d_PKCS12_fp(FILE *fp, const PKCS12 *p12);
0356 # endif
0357 PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12);
0358 # ifndef OPENSSL_NO_STDIO
0359 PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12);
0360 # endif
0361 int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass);
0362 
0363 # ifdef  __cplusplus
0364 }
0365 # endif
0366 #endif