OpenSSL EVP Series 13 --- EVP

zhaozj2021-02-16  70

OpenSSL EVP Series 13 --- EVP_Open Series Function Introduction

--- Translation according to OpenSSL DOC / CRYPTO / EVP_OPENINIT.POD translation and its own understanding

(Author: DragonKing, Mail: wzhah@263.net, released in:

Http://openssl.cn OpenSSL Professional Forum, Version: OpenSSL-0.9.7)

This series of functions is enveloped with respect to the EVP_SEAL series function. It encrypts the key encrypted with the public key and then decrypts the data. Its definition is as follows (openssl / evp.h):

INT EVP_OPENINIT (EVP_CIPHER_CTX * CTX, EVP_CIPHER * TYPE, UNSIGNED Char * EK,

INT EKL, UNSIGNED CHAR * IV, EVP_PKEY * Priv);

INT EVP_OPENUPDATE (EVP_CIPHER_CTX * CTX, Unsigned Char * OUT,

INT * OUTL, UNSIGNED CHAR * IN, INT INL);

INT EVP_OPENFINAL (EVP_CIPHER_CTX * CTX, Unsigned Char * OUT,

INT * OUTL);

[EVP_OPENINIT]

This function initializes a CTX structure used to encrypt data. It uses the private key decryption parameter ek of the parameter priv to the encryption key of the eKL byte. The parameter IV is an initialization vector. If the encryption algorithm length set by the parameter Type is variable, the key length is set to the length of the decrypted key; if the encryption algorithm length is fixed, the length of the obtained decryption key must be followed. The fixed algorithm is the same length. Successfully executed the length of the return key, otherwise returns 0.

Like the function EVP_DECRYPTINIT, the function can also be divided into multiple calls. The first call should set the parameter priv to null. When calling, TYPE should be set to NULL.

[EVP_OPENUPDATE]

This function is a macro definition function, which is actually defined as follows:

#define evp_openupdate (A, B, C, D, E) EVP_DECRYPTUPDATE (A, B, C, D, E)

Therefore, its functions and usage methods are the same as the EVP_DecryptUpdate described above, please refer to the corresponding article. Successfully executed returns 1, otherwise returns 0.

[EVP_OPENFINAL]

In fact, the function calls EVP_DECRYPTFINAL_EX to complete its function, so it is the same as the functional heel function EVP_DECRYPTFINAL_EX, refer to the function description. The only difference is that this function also calls EVP_DECRYPTINIT_EX (CTX, NULL, NULL, NULL, NULL) again in initialization. Successfully executed returns 1, otherwise returns 0.

转载请注明原文地址:https://www.9cbs.com/read-23985.html

New Post(0)