Encrypt a session key with a public key using the legacy EVP_PKEY path (deprecated).

Synopsis

Declared in <openssl/evp.h>

[[deprecated]]
int
EVP_PKEY_encrypt_old(
    unsigned char* enc_key,
    unsigned char const* key,
    int key_len,
    EVP_PKEY* pub_key);
Warning

Deprecated. Use of this entity is allowed but discouraged.

Description

Prefer EVP_PKEY_encrypt_init() / EVP_PKEY_encrypt().

Return Value

Number of encrypted bytes written to enc_key, or a negative value on error.

Parameters

Name

Description

enc_key

Output buffer for the encrypted key material.

key

Plaintext key bytes to encrypt.

key_len

Length of key in bytes.

pub_key

Public key used for encryption (typically RSA).

Created with MrDocs