1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =head1 NAME 4 1.1 christos 5 1.1 christos EVP_PBE_CipherInit, EVP_PBE_CipherInit_ex, 6 1.1 christos EVP_PBE_find, EVP_PBE_find_ex, 7 1.1 christos EVP_PBE_alg_add_type, EVP_PBE_alg_add - Password based encryption routines 8 1.1 christos 9 1.1 christos =head1 SYNOPSIS 10 1.1 christos 11 1.1 christos #include <openssl/evp.h> 12 1.1 christos 13 1.1 christos int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, 14 1.1 christos ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); 15 1.1 christos int EVP_PBE_CipherInit_ex(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, 16 1.1 christos ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de, 17 1.1 christos OSSL_LIB_CTX *libctx, const char *propq); 18 1.1 christos 19 1.1 christos int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, 20 1.1 christos EVP_PBE_KEYGEN **pkeygen); 21 1.1 christos int EVP_PBE_find_ex(int type, int pbe_nid, int *pcnid, int *pmnid, 22 1.1 christos EVP_PBE_KEYGEN **pkeygen, EVP_PBE_KEYGEN_EX **keygen_ex); 23 1.1 christos 24 1.1 christos int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, 25 1.1 christos int md_nid, EVP_PBE_KEYGEN *keygen); 26 1.1 christos int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, 27 1.1 christos EVP_PBE_KEYGEN *keygen); 28 1.1 christos 29 1.1 christos =head1 DESCRIPTION 30 1.1 christos 31 1.1 christos =head2 PBE operations 32 1.1 christos 33 1.1 christos EVP_PBE_CipherInit() and EVP_PBE_CipherInit_ex() initialise an B<EVP_CIPHER_CTX> 34 1.1 christos I<ctx> for encryption (I<en_de>=1) or decryption (I<en_de>=0) using the password 35 1.1 christos I<pass> of length I<passlen>. The PBE algorithm type and parameters are extracted 36 1.1 christos from an OID I<pbe_obj> and parameters I<param>. 37 1.1 christos 38 1.1 christos EVP_PBE_CipherInit_ex() also allows the application to specify a library context 39 1.1 christos I<libctx> and property query I<propq> to select appropriate algorithm 40 1.1 christos implementations. 41 1.1 christos 42 1.1 christos =head2 PBE algorithm search 43 1.1 christos 44 1.1 christos EVP_PBE_find() and EVP_PBE_find_ex() search for a matching algorithm using two parameters: 45 1.1 christos 46 1.1 christos 1. An algorithm type I<type> which can be: 47 1.1 christos 48 1.1 christos =over 4 49 1.1 christos 50 1.1 christos =item * 51 1.1 christos 52 1.1 christos EVP_PBE_TYPE_OUTER - A PBE algorithm 53 1.1 christos 54 1.1 christos =item * 55 1.1 christos 56 1.1 christos EVP_PBE_TYPE_PRF - A pseudo-random function 57 1.1 christos 58 1.1 christos =item * 59 1.1 christos 60 1.1 christos EVP_PBE_TYPE_KDF - A key derivation function 61 1.1 christos 62 1.1 christos =back 63 1.1 christos 64 1.1 christos 2. A I<pbe_nid> which can represent the algorithm identifier with parameters e.g. 65 1.1 christos B<NID_pbeWithSHA1AndRC2_CBC> or an algorithm class e.g. B<NID_pbes2>. 66 1.1 christos 67 1.1 christos They return the algorithm's cipher ID I<pcnid>, digest ID I<pmnid> and a key 68 1.1 christos generation function for the algorithm I<pkeygen>. EVP_PBE_CipherInit_ex() also 69 1.1 christos returns an extended key generation function I<keygen_ex> which takes a library 70 1.1 christos context and property query. 71 1.1 christos 72 1.1 christos If a NULL is supplied for any of I<pcnid>, I<pmnid>, I<pkeygen> or I<pkeygen_ex> 73 1.1 christos then this parameter is not returned. 74 1.1 christos 75 1.1 christos =head2 PBE algorithm add 76 1.1 christos 77 1.1 christos EVP_PBE_alg_add_type() and EVP_PBE_alg_add() add an algorithm to the list 78 1.1 christos of known algorithms. Their parameters have the same meaning as for 79 1.1 christos EVP_PBE_find() and EVP_PBE_find_ex() functions. 80 1.1 christos 81 1.1 christos =head1 NOTES 82 1.1 christos 83 1.1 christos The arguments I<pbe_obj> and I<param> to EVP_PBE_CipherInit() and EVP_PBE_CipherInit_ex() 84 1.1 christos together form an B<X509_ALGOR> and can often be extracted directly from this structure. 85 1.1 christos 86 1.1 christos =head1 RETURN VALUES 87 1.1 christos 88 1.1 christos Return value is 1 for success and 0 if an error occurred. 89 1.1 christos 90 1.1 christos =head1 SEE ALSO 91 1.1 christos 92 1.1 christos L<PKCS5_PBE_keyivgen(3)>, 93 1.1 christos L<PKCS12_PBE_keyivgen_ex(3)>, 94 1.1 christos L<PKCS5_v2_PBE_keyivgen_ex(3)>, 95 1.1 christos L<PKCS12_pbe_crypt_ex(3)>, 96 1.1 christos L<PKCS12_create_ex(3)> 97 1.1 christos 98 1.1 christos =head1 HISTORY 99 1.1 christos 100 1.1 christos EVP_PBE_CipherInit_ex() and EVP_PBE_find_ex() were added in OpenSSL 3.0. 101 1.1 christos 102 1.1 christos =head1 COPYRIGHT 103 1.1 christos 104 1.1 christos Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved. 105 1.1 christos 106 1.1 christos Licensed under the Apache License 2.0 (the "License"). You may not use 107 1.1 christos this file except in compliance with the License. You can obtain a copy 108 1.1 christos in the file LICENSE in the source distribution or at 109 1.1 christos L<https://www.openssl.org/source/license.html>. 110 1.1 christos 111 1.1 christos =cut 112