1EVP_PBE_CIPHERINIT(3ossl) OpenSSL EVP_PBE_CIPHERINIT(3ossl)
2
3
4
6 EVP_PBE_CipherInit, EVP_PBE_CipherInit_ex, EVP_PBE_find,
7 EVP_PBE_find_ex - Password based encryption routines
8
10 #include <openssl/evp.h>
11
12 int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
13 ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);
14 int EVP_PBE_CipherInit_ex(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
15 ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de,
16 OSSL_LIB_CTX *libctx, const char *propq);
17
18 int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid,
19 EVP_PBE_KEYGEN **pkeygen);
20 int EVP_PBE_find_ex(int type, int pbe_nid, int *pcnid, int *pmnid,
21 EVP_PBE_KEYGEN **pkeygen, EVP_PBE_KEYGEN_EX **keygen_ex);
22
24 PBE operations
25 EVP_PBE_CipherInit() and EVP_PBE_CipherInit_ex() initialise an
26 EVP_CIPHER_CTX ctx for encryption (en_de=1) or decryption (en_de=0)
27 using the password pass of length passlen. The PBE algorithm type and
28 parameters are extracted from an OID pbe_obj and parameters param.
29
30 EVP_PBE_CipherInit_ex() also allows the application to specify a
31 library context libctx and property query propq to select appropriate
32 algorithm implementations.
33
34 PBE algorithm search
35 EVP_PBE_find() and EVP_PBE_find_ex() search for a matching algorithm
36 using two parameters:
37
38 1. An algorithm type type which can be:
39
40 • EVP_PBE_TYPE_OUTER - A PBE algorithm
41
42 • EVP_PBE_TYPE_PRF - A pseudo-random function
43
44 • EVP_PBE_TYPE_KDF - A key derivation function
45
46 2. A pbe_nid which can represent the algorithm identifier with
47 parameters e.g. NID_pbeWithSHA1AndRC2_CBC or an algorithm class e.g.
48 NID_pbes2.
49
50 They return the algorithm's cipher ID pcnid, digest ID pmnid and a key
51 generation function for the algorithm pkeygen. EVP_PBE_CipherInit_ex()
52 also returns an extended key generation function keygen_ex which takes
53 a library context and property query.
54
55 If a NULL is supplied for any of pcnid, pmnid, pkeygen or pkeygen_ex
56 then this parameter is not returned.
57
59 The arguments pbe_obj and param to EVP_PBE_CipherInit() and
60 EVP_PBE_CipherInit_ex() together form an X509_ALGOR and can often be
61 extracted directly from this structure.
62
64 Return value is 1 for success and 0 if an error occurred.
65
67 PKCS5_PBE_keyivgen(3), PKCS12_PBE_keyivgen_ex(3),
68 PKCS5_v2_PBE_keyivgen_ex(3), PKCS12_pbe_crypt_ex(3),
69 PKCS12_create_ex(3)
70
72 EVP_PBE_CipherInit_ex() and EVP_PBE_find_ex() were added in OpenSSL
73 3.0.
74
76 Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
77
78 Licensed under the Apache License 2.0 (the "License"). You may not use
79 this file except in compliance with the License. You can obtain a copy
80 in the file LICENSE in the source distribution or at
81 <https://www.openssl.org/source/license.html>.
82
83
84
853.0.5 2022-07-05 EVP_PBE_CIPHERINIT(3ossl)