| 1 | /* |
| 2 | * WARNING: do not edit! |
| 3 | * Generated by Makefile from ../include/openssl/pkcs12.h.in |
| 4 | * |
| 5 | * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. |
| 6 | * |
| 7 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
| 8 | * this file except in compliance with the License. You can obtain a copy |
| 9 | * in the file LICENSE in the source distribution or at |
| 10 | * https://www.openssl.org/source/license.html |
| 11 | */ |
| 12 | |
| 13 | |
| 14 | |
| 15 | #ifndef OPENSSL_PKCS12_H |
| 16 | # define OPENSSL_PKCS12_H |
| 17 | # pragma once |
| 18 | |
| 19 | # include <openssl/macros.h> |
| 20 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 21 | # define |
| 22 | # endif |
| 23 | |
| 24 | # include <openssl/bio.h> |
| 25 | # include <openssl/core.h> |
| 26 | # include <openssl/x509.h> |
| 27 | # include <openssl/pkcs12err.h> |
| 28 | |
| 29 | #ifdef __cplusplus |
| 30 | extern "C" { |
| 31 | #endif |
| 32 | |
| 33 | # define PKCS12_KEY_ID 1 |
| 34 | # define PKCS12_IV_ID 2 |
| 35 | # define PKCS12_MAC_ID 3 |
| 36 | |
| 37 | /* Default iteration count */ |
| 38 | # ifndef PKCS12_DEFAULT_ITER |
| 39 | # define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER |
| 40 | # endif |
| 41 | |
| 42 | # define PKCS12_MAC_KEY_LENGTH 20 |
| 43 | |
| 44 | # define PKCS12_SALT_LEN 8 |
| 45 | |
| 46 | /* It's not clear if these are actually needed... */ |
| 47 | # define PKCS12_key_gen PKCS12_key_gen_utf8 |
| 48 | # define PKCS12_add_friendlyname PKCS12_add_friendlyname_utf8 |
| 49 | |
| 50 | /* MS key usage constants */ |
| 51 | |
| 52 | # define KEY_EX 0x10 |
| 53 | # define KEY_SIG 0x80 |
| 54 | |
| 55 | typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA; |
| 56 | |
| 57 | typedef struct PKCS12_st PKCS12; |
| 58 | |
| 59 | typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG; |
| 60 | |
| 61 | SKM_DEFINE_STACK_OF_INTERNAL(PKCS12_SAFEBAG, PKCS12_SAFEBAG, PKCS12_SAFEBAG) |
| 62 | #define sk_PKCS12_SAFEBAG_num(sk) OPENSSL_sk_num(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk)) |
| 63 | #define sk_PKCS12_SAFEBAG_value(sk, idx) ((PKCS12_SAFEBAG *)OPENSSL_sk_value(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk), (idx))) |
| 64 | #define sk_PKCS12_SAFEBAG_new(cmp) ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_new(ossl_check_PKCS12_SAFEBAG_compfunc_type(cmp))) |
| 65 | #define sk_PKCS12_SAFEBAG_new_null() ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_new_null()) |
| 66 | #define sk_PKCS12_SAFEBAG_new_reserve(cmp, n) ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_new_reserve(ossl_check_PKCS12_SAFEBAG_compfunc_type(cmp), (n))) |
| 67 | #define sk_PKCS12_SAFEBAG_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_PKCS12_SAFEBAG_sk_type(sk), (n)) |
| 68 | #define sk_PKCS12_SAFEBAG_free(sk) OPENSSL_sk_free(ossl_check_PKCS12_SAFEBAG_sk_type(sk)) |
| 69 | #define sk_PKCS12_SAFEBAG_zero(sk) OPENSSL_sk_zero(ossl_check_PKCS12_SAFEBAG_sk_type(sk)) |
| 70 | #define sk_PKCS12_SAFEBAG_delete(sk, i) ((PKCS12_SAFEBAG *)OPENSSL_sk_delete(ossl_check_PKCS12_SAFEBAG_sk_type(sk), (i))) |
| 71 | #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))) |
| 72 | #define sk_PKCS12_SAFEBAG_push(sk, ptr) OPENSSL_sk_push(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr)) |
| 73 | #define sk_PKCS12_SAFEBAG_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr)) |
| 74 | #define sk_PKCS12_SAFEBAG_pop(sk) ((PKCS12_SAFEBAG *)OPENSSL_sk_pop(ossl_check_PKCS12_SAFEBAG_sk_type(sk))) |
| 75 | #define sk_PKCS12_SAFEBAG_shift(sk) ((PKCS12_SAFEBAG *)OPENSSL_sk_shift(ossl_check_PKCS12_SAFEBAG_sk_type(sk))) |
| 76 | #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)) |
| 77 | #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)) |
| 78 | #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))) |
| 79 | #define sk_PKCS12_SAFEBAG_find(sk, ptr) OPENSSL_sk_find(ossl_check_PKCS12_SAFEBAG_sk_type(sk), ossl_check_PKCS12_SAFEBAG_type(ptr)) |
| 80 | #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)) |
| 81 | #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) |
| 82 | #define sk_PKCS12_SAFEBAG_sort(sk) OPENSSL_sk_sort(ossl_check_PKCS12_SAFEBAG_sk_type(sk)) |
| 83 | #define sk_PKCS12_SAFEBAG_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk)) |
| 84 | #define sk_PKCS12_SAFEBAG_dup(sk) ((STACK_OF(PKCS12_SAFEBAG) *)OPENSSL_sk_dup(ossl_check_const_PKCS12_SAFEBAG_sk_type(sk))) |
| 85 | #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))) |
| 86 | #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))) |
| 87 | |
| 88 | |
| 89 | typedef struct pkcs12_bag_st PKCS12_BAGS; |
| 90 | |
| 91 | # define PKCS12_ERROR 0 |
| 92 | # define PKCS12_OK 1 |
| 93 | |
| 94 | /* Compatibility macros */ |
| 95 | |
| 96 | #ifndef OPENSSL_NO_DEPRECATED_1_1_0 |
| 97 | |
| 98 | # define M_PKCS12_bag_type PKCS12_bag_type |
| 99 | # define M_PKCS12_cert_bag_type PKCS12_cert_bag_type |
| 100 | # define M_PKCS12_crl_bag_type PKCS12_cert_bag_type |
| 101 | |
| 102 | # define PKCS12_certbag2x509 PKCS12_SAFEBAG_get1_cert |
| 103 | # define PKCS12_certbag2scrl PKCS12_SAFEBAG_get1_crl |
| 104 | # define PKCS12_bag_type PKCS12_SAFEBAG_get_nid |
| 105 | # define PKCS12_cert_bag_type PKCS12_SAFEBAG_get_bag_nid |
| 106 | # define PKCS12_x5092certbag PKCS12_SAFEBAG_create_cert |
| 107 | # define PKCS12_x509crl2certbag PKCS12_SAFEBAG_create_crl |
| 108 | # define PKCS12_MAKE_KEYBAG PKCS12_SAFEBAG_create0_p8inf |
| 109 | # define PKCS12_MAKE_SHKEYBAG PKCS12_SAFEBAG_create_pkcs8_encrypt |
| 110 | |
| 111 | #endif |
| 112 | #ifndef OPENSSL_NO_DEPRECATED_1_1_0 |
| 113 | OSSL_DEPRECATEDIN_1_1_0 ASN1_TYPE *PKCS12_get_attr(const PKCS12_SAFEBAG *bag, |
| 114 | int attr_nid); |
| 115 | #endif |
| 116 | |
| 117 | ASN1_TYPE *PKCS8_get_attr(PKCS8_PRIV_KEY_INFO *p8, int attr_nid); |
| 118 | int PKCS12_mac_present(const PKCS12 *p12); |
| 119 | void PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac, |
| 120 | const X509_ALGOR **pmacalg, |
| 121 | const ASN1_OCTET_STRING **psalt, |
| 122 | const ASN1_INTEGER **piter, |
| 123 | const PKCS12 *p12); |
| 124 | |
| 125 | const ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag, |
| 126 | int attr_nid); |
| 127 | const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag); |
| 128 | int PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag); |
| 129 | int PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag); |
| 130 | const ASN1_TYPE *PKCS12_SAFEBAG_get0_bag_obj(const PKCS12_SAFEBAG *bag); |
| 131 | const ASN1_OBJECT *PKCS12_SAFEBAG_get0_bag_type(const PKCS12_SAFEBAG *bag); |
| 132 | |
| 133 | X509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag); |
| 134 | X509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag); |
| 135 | const STACK_OF(PKCS12_SAFEBAG) * |
| 136 | PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag); |
| 137 | const PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag); |
| 138 | const X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag); |
| 139 | |
| 140 | PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509); |
| 141 | PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl); |
| 142 | PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_secret(int type, int vtype, const unsigned char *value, int len); |
| 143 | PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8); |
| 144 | PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8); |
| 145 | PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid, |
| 146 | const char *pass, |
| 147 | int passlen, |
| 148 | unsigned char *salt, |
| 149 | int saltlen, int iter, |
| 150 | PKCS8_PRIV_KEY_INFO *p8inf); |
| 151 | PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(int pbe_nid, |
| 152 | const char *pass, |
| 153 | int passlen, |
| 154 | unsigned char *salt, |
| 155 | int saltlen, int iter, |
| 156 | PKCS8_PRIV_KEY_INFO *p8inf, |
| 157 | OSSL_LIB_CTX *ctx, |
| 158 | const char *propq); |
| 159 | |
| 160 | PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, |
| 161 | int nid1, int nid2); |
| 162 | PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass, |
| 163 | int passlen); |
| 164 | PKCS8_PRIV_KEY_INFO *PKCS8_decrypt_ex(const X509_SIG *p8, const char *pass, |
| 165 | int passlen, OSSL_LIB_CTX *ctx, |
| 166 | const char *propq); |
| 167 | PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag, |
| 168 | const char *pass, int passlen); |
| 169 | PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey_ex(const PKCS12_SAFEBAG *bag, |
| 170 | const char *pass, int passlen, |
| 171 | OSSL_LIB_CTX *ctx, |
| 172 | const char *propq); |
| 173 | X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, |
| 174 | const char *pass, int passlen, unsigned char *salt, |
| 175 | int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8); |
| 176 | X509_SIG *PKCS8_encrypt_ex(int pbe_nid, const EVP_CIPHER *cipher, |
| 177 | const char *pass, int passlen, unsigned char *salt, |
| 178 | int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8, |
| 179 | OSSL_LIB_CTX *ctx, const char *propq); |
| 180 | X509_SIG *PKCS8_set0_pbe(const char *pass, int passlen, |
| 181 | PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe); |
| 182 | X509_SIG *PKCS8_set0_pbe_ex(const char *pass, int passlen, |
| 183 | PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe, |
| 184 | OSSL_LIB_CTX *ctx, const char *propq); |
| 185 | PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); |
| 186 | STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); |
| 187 | PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, |
| 188 | unsigned char *salt, int saltlen, int iter, |
| 189 | STACK_OF(PKCS12_SAFEBAG) *bags); |
| 190 | PKCS7 *PKCS12_pack_p7encdata_ex(int pbe_nid, const char *pass, int passlen, |
| 191 | unsigned char *salt, int saltlen, int iter, |
| 192 | STACK_OF(PKCS12_SAFEBAG) *bags, |
| 193 | OSSL_LIB_CTX *ctx, const char *propq); |
| 194 | |
| 195 | STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, |
| 196 | int passlen); |
| 197 | |
| 198 | int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); |
| 199 | STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12); |
| 200 | |
| 201 | int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, |
| 202 | int namelen); |
| 203 | int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, |
| 204 | int namelen); |
| 205 | int PKCS12_add_friendlyname_utf8(PKCS12_SAFEBAG *bag, const char *name, |
| 206 | int namelen); |
| 207 | int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, |
| 208 | int namelen); |
| 209 | int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, |
| 210 | const unsigned char *name, int namelen); |
| 211 | int PKCS12_add1_attr_by_NID(PKCS12_SAFEBAG *bag, int nid, int type, |
| 212 | const unsigned char *bytes, int len); |
| 213 | int PKCS12_add1_attr_by_txt(PKCS12_SAFEBAG *bag, const char *attrname, int type, |
| 214 | const unsigned char *bytes, int len); |
| 215 | int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); |
| 216 | ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, |
| 217 | int attr_nid); |
| 218 | char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); |
| 219 | const STACK_OF(X509_ATTRIBUTE) * |
| 220 | PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag); |
| 221 | unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor, |
| 222 | const char *pass, int passlen, |
| 223 | const unsigned char *in, int inlen, |
| 224 | unsigned char **data, int *datalen, |
| 225 | int en_de); |
| 226 | unsigned char *PKCS12_pbe_crypt_ex(const X509_ALGOR *algor, |
| 227 | const char *pass, int passlen, |
| 228 | const unsigned char *in, int inlen, |
| 229 | unsigned char **data, int *datalen, |
| 230 | int en_de, OSSL_LIB_CTX *libctx, |
| 231 | const char *propq); |
| 232 | void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it, |
| 233 | const char *pass, int passlen, |
| 234 | const ASN1_OCTET_STRING *oct, int zbuf); |
| 235 | void *PKCS12_item_decrypt_d2i_ex(const X509_ALGOR *algor, const ASN1_ITEM *it, |
| 236 | const char *pass, int passlen, |
| 237 | const ASN1_OCTET_STRING *oct, int zbuf, |
| 238 | OSSL_LIB_CTX *libctx, |
| 239 | const char *propq); |
| 240 | ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, |
| 241 | const ASN1_ITEM *it, |
| 242 | const char *pass, int passlen, |
| 243 | void *obj, int zbuf); |
| 244 | ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt_ex(X509_ALGOR *algor, |
| 245 | const ASN1_ITEM *it, |
| 246 | const char *pass, int passlen, |
| 247 | void *obj, int zbuf, |
| 248 | OSSL_LIB_CTX *ctx, |
| 249 | const char *propq); |
| 250 | PKCS12 *PKCS12_init(int mode); |
| 251 | PKCS12 *PKCS12_init_ex(int mode, OSSL_LIB_CTX *ctx, const char *propq); |
| 252 | |
| 253 | int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, |
| 254 | int saltlen, int id, int iter, int n, |
| 255 | unsigned char *out, const EVP_MD *md_type); |
| 256 | int PKCS12_key_gen_asc_ex(const char *pass, int passlen, unsigned char *salt, |
| 257 | int saltlen, int id, int iter, int n, |
| 258 | unsigned char *out, const EVP_MD *md_type, |
| 259 | OSSL_LIB_CTX *ctx, const char *propq); |
| 260 | int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, |
| 261 | int saltlen, int id, int iter, int n, |
| 262 | unsigned char *out, const EVP_MD *md_type); |
| 263 | int PKCS12_key_gen_uni_ex(unsigned char *pass, int passlen, unsigned char *salt, |
| 264 | int saltlen, int id, int iter, int n, |
| 265 | unsigned char *out, const EVP_MD *md_type, |
| 266 | OSSL_LIB_CTX *ctx, const char *propq); |
| 267 | int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt, |
| 268 | int saltlen, int id, int iter, int n, |
| 269 | unsigned char *out, const EVP_MD *md_type); |
| 270 | int PKCS12_key_gen_utf8_ex(const char *pass, int passlen, unsigned char *salt, |
| 271 | int saltlen, int id, int iter, int n, |
| 272 | unsigned char *out, const EVP_MD *md_type, |
| 273 | OSSL_LIB_CTX *ctx, const char *propq); |
| 274 | |
| 275 | int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
| 276 | ASN1_TYPE *param, const EVP_CIPHER *cipher, |
| 277 | const EVP_MD *md_type, int en_de); |
| 278 | int PKCS12_PBE_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
| 279 | ASN1_TYPE *param, const EVP_CIPHER *cipher, |
| 280 | const EVP_MD *md_type, int en_de, |
| 281 | OSSL_LIB_CTX *libctx, const char *propq); |
| 282 | int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, |
| 283 | unsigned char *mac, unsigned int *maclen); |
| 284 | int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); |
| 285 | int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, |
| 286 | unsigned char *salt, int saltlen, int iter, |
| 287 | const EVP_MD *md_type); |
| 288 | int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, |
| 289 | int saltlen, const EVP_MD *md_type); |
| 290 | unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, |
| 291 | unsigned char **uni, int *unilen); |
| 292 | char *OPENSSL_uni2asc(const unsigned char *uni, int unilen); |
| 293 | unsigned char *OPENSSL_utf82uni(const char *asc, int asclen, |
| 294 | unsigned char **uni, int *unilen); |
| 295 | char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen); |
| 296 | |
| 297 | DECLARE_ASN1_FUNCTIONS(PKCS12) |
| 298 | DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) |
| 299 | DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) |
| 300 | DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) |
| 301 | |
| 302 | DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS) |
| 303 | DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) |
| 304 | |
| 305 | void PKCS12_PBE_add(void); |
| 306 | int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, |
| 307 | STACK_OF(X509) **ca); |
| 308 | PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, |
| 309 | X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, |
| 310 | int iter, int mac_iter, int keytype); |
| 311 | PKCS12 *PKCS12_create_ex(const char *pass, const char *name, EVP_PKEY *pkey, |
| 312 | X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, |
| 313 | int iter, int mac_iter, int keytype, |
| 314 | OSSL_LIB_CTX *ctx, const char *propq); |
| 315 | |
| 316 | PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); |
| 317 | PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, |
| 318 | EVP_PKEY *key, int key_usage, int iter, |
| 319 | int key_nid, const char *pass); |
| 320 | PKCS12_SAFEBAG *PKCS12_add_key_ex(STACK_OF(PKCS12_SAFEBAG) **pbags, |
| 321 | EVP_PKEY *key, int key_usage, int iter, |
| 322 | int key_nid, const char *pass, |
| 323 | OSSL_LIB_CTX *ctx, const char *propq); |
| 324 | |
| 325 | PKCS12_SAFEBAG *PKCS12_add_secret(STACK_OF(PKCS12_SAFEBAG) **pbags, |
| 326 | int nid_type, const unsigned char *value, int len); |
| 327 | int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, |
| 328 | int safe_nid, int iter, const char *pass); |
| 329 | int PKCS12_add_safe_ex(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, |
| 330 | int safe_nid, int iter, const char *pass, |
| 331 | OSSL_LIB_CTX *ctx, const char *propq); |
| 332 | |
| 333 | PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); |
| 334 | PKCS12 *PKCS12_add_safes_ex(STACK_OF(PKCS7) *safes, int p7_nid, |
| 335 | OSSL_LIB_CTX *ctx, const char *propq); |
| 336 | |
| 337 | int i2d_PKCS12_bio(BIO *bp, const PKCS12 *p12); |
| 338 | # ifndef OPENSSL_NO_STDIO |
| 339 | int i2d_PKCS12_fp(FILE *fp, const PKCS12 *p12); |
| 340 | # endif |
| 341 | PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); |
| 342 | # ifndef OPENSSL_NO_STDIO |
| 343 | PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); |
| 344 | # endif |
| 345 | int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass); |
| 346 | |
| 347 | # ifdef __cplusplus |
| 348 | } |
| 349 | # endif |
| 350 | #endif |
| 351 | |