BALTECH Docs |
C API for BALTECH SDK
|
brp_errcode brp_Crypto_BalKeyEncryptBuffer | ( | brp_protocol | protocol, |
unsigned | KeyVersion, | ||
unsigned | EmbeddedKeyIndex, | ||
unsigned | EmbeddedKeyPos, | ||
brp_buf | Buffer, | ||
size_t | Buffer_len, | ||
brp_buf | InitialVector, | ||
size_t | InitialVector_len, | ||
brp_buf * | EncryptedBuffer, | ||
size_t * | EncryptedBuffer_len, | ||
brp_buf * | NextInitialVector, | ||
size_t * | NextInitialVector_len, | ||
brp_mempool * | mempool | ||
) |
This command is a special version of the brp_Crypto_EncryptBuffer() command which always uses a customer key to encrypt a buffer of data and inserts a Crypto-Key at a desired position before encryption.
The key to insert has to be specified in the EmbeddedKeyIndex parameter. In this case, the 10 Byte Key will, on the one hand, replace the data at the EmbeddedKeyPos position, and on the other hand, replace the last two Bytes by a CRC (16-bit, 8404B, MSB encoded) that is generated on the data contained in Buffer.
[in] | protocol | used to execute the command |
[in] | KeyVersion | 2: use SkipJack Key, 3: Use AES Key. |
[in] | EmbeddedKeyIndex | Index of the embedded key to insert in the data (value != 0x00). No key is inserted when this parameter is set to 0x00. |
[in] | EmbeddedKeyPos | If an embedded key is specified, this value specifies the position where to include the key. |
[in] | Buffer | Data buffer to encrypt. |
[in] | Buffer_len | |
[in] | InitialVector | Initial vector (IV) used for encryption. |
[in] | InitialVector_len | |
[out] | EncryptedBuffer | Buffer after encryption. |
[out] | EncryptedBuffer_len | |
[out] | NextInitialVector | Initial vector to be used as InitialVector parameter in the next call of this command. |
[out] | NextInitialVector_len | |
[in] | mempool | is used to store response data. Maybe NULL to use an internal mempool, in this case the data is only available until another command uses the internal mempool |