1EVP_PBE_CIPHERINIT(3ossl)           OpenSSL          EVP_PBE_CIPHERINIT(3ossl)
2
3
4

NAME

6       EVP_PBE_CipherInit, EVP_PBE_CipherInit_ex, EVP_PBE_find,
7       EVP_PBE_find_ex, EVP_PBE_alg_add_type, EVP_PBE_alg_add - Password based
8       encryption routines
9

SYNOPSIS

11        #include <openssl/evp.h>
12
13        int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
14                               ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);
15        int EVP_PBE_CipherInit_ex(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
16                                  ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de,
17                                  OSSL_LIB_CTX *libctx, const char *propq);
18
19        int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid,
20                         EVP_PBE_KEYGEN **pkeygen);
21        int EVP_PBE_find_ex(int type, int pbe_nid, int *pcnid, int *pmnid,
22                            EVP_PBE_KEYGEN **pkeygen, EVP_PBE_KEYGEN_EX **keygen_ex);
23
24        int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid,
25                                 int md_nid, EVP_PBE_KEYGEN *keygen);
26        int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
27                            EVP_PBE_KEYGEN *keygen);
28

DESCRIPTION

30   PBE operations
31       EVP_PBE_CipherInit() and EVP_PBE_CipherInit_ex() initialise an
32       EVP_CIPHER_CTX ctx for encryption (en_de=1) or decryption (en_de=0)
33       using the password pass of length passlen. The PBE algorithm type and
34       parameters are extracted from an OID pbe_obj and parameters param.
35
36       EVP_PBE_CipherInit_ex() also allows the application to specify a
37       library context libctx and property query propq to select appropriate
38       algorithm implementations.
39
40   PBE algorithm search
41       EVP_PBE_find() and EVP_PBE_find_ex() search for a matching algorithm
42       using two parameters:
43
44       1. An algorithm type type which can be:
45
46       •   EVP_PBE_TYPE_OUTER - A PBE algorithm
47
48       •   EVP_PBE_TYPE_PRF - A pseudo-random function
49
50       •   EVP_PBE_TYPE_KDF - A key derivation function
51
52       2. A pbe_nid which can represent the algorithm identifier with
53       parameters e.g.  NID_pbeWithSHA1AndRC2_CBC or an algorithm class e.g.
54       NID_pbes2.
55
56       They return the algorithm's cipher ID pcnid, digest ID pmnid and a key
57       generation function for the algorithm pkeygen. EVP_PBE_CipherInit_ex()
58       also returns an extended key generation function keygen_ex which takes
59       a library context and property query.
60
61       If a NULL is supplied for any of pcnid, pmnid, pkeygen or pkeygen_ex
62       then this parameter is not returned.
63
64   PBE algorithm add
65       EVP_PBE_alg_add_type() and EVP_PBE_alg_add() add an algorithm to the
66       list of known algorithms. Their parameters have the same meaning as for
67       EVP_PBE_find() and EVP_PBE_find_ex() functions.
68

NOTES

70       The arguments pbe_obj and param to EVP_PBE_CipherInit() and
71       EVP_PBE_CipherInit_ex() together form an X509_ALGOR and can often be
72       extracted directly from this structure.
73

RETURN VALUES

75       Return value is 1 for success and 0 if an error occurred.
76

SEE ALSO

78       PKCS5_PBE_keyivgen(3), PKCS12_PBE_keyivgen_ex(3),
79       PKCS5_v2_PBE_keyivgen_ex(3), PKCS12_pbe_crypt_ex(3),
80       PKCS12_create_ex(3)
81

HISTORY

83       EVP_PBE_CipherInit_ex() and EVP_PBE_find_ex() were added in OpenSSL
84       3.0.
85
87       Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.
88
89       Licensed under the Apache License 2.0 (the "License").  You may not use
90       this file except in compliance with the License.  You can obtain a copy
91       in the file LICENSE in the source distribution or at
92       <https://www.openssl.org/source/license.html>.
93
94
95
963.1.1                             2023-08-31         EVP_PBE_CIPHERINIT(3ossl)
Impressum