EVP_PKEY_encrypt

Encrypt data with a public key using a context from EVP_PKEY_encrypt_init().

Synopsis

Declared in <openssl/evp.h>

int
EVP_PKEY_encrypt(
    EVP_PKEY_CTX* ctx,
    unsigned char* out,
    size_t* outlen,
    unsigned char const* in,
    size_t inlen);

Return Value

1 on success, or a non-positive value on failure.

Parameters

NameDescription
ctxEncryption context holding the public key.
outOutput buffer for ciphertext, or NULL to query the required size via outlen.
outlenOn entry, capacity of out when non-NULL; on return, bytes written or required.
inPlaintext bytes to encrypt.
inlenLength of in in bytes.