qcrypto_cipher_encrypt()

Updated: October 26, 2022

Encrypt a cipher

Synopsis:

#include <qcrypto/qcrypto.h>
int qcrypto_cipher_encrypt(qcrypto_ctx_t *ctx,
                           const uint8_t *in,
                           size_t insize,
                           uint8_t *out,
                           size_t *outsize)

Arguments:

ctx
The algorithm context object.
in
The input data.
insize
The input data size.
out
The output data.
outsize
The combined size of the output data and the encrypted data.

Library:

libqcrypto

Description:

This function encrypts plaintext data using the specified symmetric key. For stream ciphers (block size == 1), the out buffer should be at least as large as the in buffer . If the input is a multiple of the block size (block size > 1), the out buffer should be at least as large as the in buffer; otherwise, the out buffer needs to be at least one block larger.

The caller needs to make sure that data is padded appropriately, if required.

Returns:

QCRYPTO_R_EOK if successful or qcrypto_errno if an error occurred.