qcrypto_padding_pkcs7_pad()

Updated: October 26, 2022

Apply PKCS7 padding

Synopsis:

#include <qcrypto/qcrypto.h>
int qcrypto_padding_pkcs7_pad(const uint8_t *data,
                              size_t size,
                              uint8_t *paddata,
                              size_t *padsize,
                              size_t blocksize)

Arguments:

data
The data buffer to pad (optional). Can overlap with paddata. Omit this parameter to retrieve the padding bytes only, using size.
size
The data buffer size.
paddata
The padded data buffer.
padsize
The combined size of the padded data buffer and the padded data.
blocksize
The algorithm blocksize for padding alignment. Maximum is 255 bytes.

Library:

libqcrypto

Description:

This function pads data using the specified algorithm. The size of paddata needs to include the correct amount of space for the padding. See qcrypto_padding_pkcs7_size() to calculate the required amount.

Returns:

QCRYPTO_R_EOK if successful or qcrypto_errno if an error occurred.