1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =head1 NAME 4 1.1 christos 5 1.1 christos EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal - EVP envelope decryption 6 1.1 christos 7 1.1 christos =head1 SYNOPSIS 8 1.1 christos 9 1.1 christos #include <openssl/evp.h> 10 1.1 christos 11 1.1 christos int EVP_OpenInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char *ek, 12 1.1 christos int ekl, unsigned char *iv, EVP_PKEY *priv); 13 1.1 christos int EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, 14 1.1 christos int *outl, unsigned char *in, int inl); 15 1.1 christos int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); 16 1.1 christos 17 1.1 christos =head1 DESCRIPTION 18 1.1 christos 19 1.1.1.2 christos The EVP envelope routines are a high-level interface to envelope 20 1.1 christos decryption. They decrypt a public key encrypted symmetric key and 21 1.1 christos then decrypt data using it. 22 1.1 christos 23 1.1 christos EVP_OpenInit() initializes a cipher context B<ctx> for decryption 24 1.1 christos with cipher B<type>. It decrypts the encrypted symmetric key of length 25 1.1 christos B<ekl> bytes passed in the B<ek> parameter using the private key B<priv>. 26 1.1 christos The IV is supplied in the B<iv> parameter. 27 1.1 christos 28 1.1 christos EVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties 29 1.1 christos as the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as 30 1.1 christos documented on the L<EVP_EncryptInit(3)> manual 31 1.1 christos page. 32 1.1 christos 33 1.1 christos =head1 NOTES 34 1.1 christos 35 1.1 christos It is possible to call EVP_OpenInit() twice in the same way as 36 1.1 christos EVP_DecryptInit(). The first call should have B<priv> set to NULL 37 1.1 christos and (after setting any cipher parameters) it should be called again 38 1.1 christos with B<type> set to NULL. 39 1.1 christos 40 1.1 christos If the cipher passed in the B<type> parameter is a variable length 41 1.1 christos cipher then the key length will be set to the value of the recovered 42 1.1 christos key length. If the cipher is a fixed length cipher then the recovered 43 1.1 christos key length must match the fixed cipher length. 44 1.1 christos 45 1.1 christos =head1 RETURN VALUES 46 1.1 christos 47 1.1 christos EVP_OpenInit() returns 0 on error or a non zero integer (actually the 48 1.1 christos recovered secret key size) if successful. 49 1.1 christos 50 1.1 christos EVP_OpenUpdate() returns 1 for success or 0 for failure. 51 1.1 christos 52 1.1 christos EVP_OpenFinal() returns 0 if the decrypt failed or 1 for success. 53 1.1 christos 54 1.1 christos =head1 SEE ALSO 55 1.1 christos 56 1.1 christos L<evp(7)>, L<RAND_bytes(3)>, 57 1.1 christos L<EVP_EncryptInit(3)>, 58 1.1 christos L<EVP_SealInit(3)> 59 1.1 christos 60 1.1 christos =head1 COPYRIGHT 61 1.1 christos 62 1.1.1.2 christos Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. 63 1.1 christos 64 1.1.1.3 christos Licensed under the Apache License 2.0 (the "License"). You may not use 65 1.1 christos this file except in compliance with the License. You can obtain a copy 66 1.1 christos in the file LICENSE in the source distribution or at 67 1.1 christos L<https://www.openssl.org/source/license.html>. 68 1.1 christos 69 1.1 christos =cut 70