BALTECH Docs |
C API for BALTECH SDK
|
brp_errcode brp_Crypto_EncryptBuffer | ( | brp_protocol | protocol, |
unsigned | KeyIndex, | ||
brp_buf | KeyValue, | ||
brp_buf | InitialVector, | ||
brp_buf | Buffer, | ||
size_t | Buffer_len, | ||
brp_buf * | NextInitialVector, | ||
brp_buf * | EncryptedBuffer, | ||
size_t * | EncryptedBuffer_len, | ||
brp_mempool * | mempool | ||
) |
This command encrypts a variable length buffer given in the Buffer parameter using the SkipJack algorithm.
If KeyIndex is set to 0x00, KeyValue will be used as encryption key. Otherwise, KeyIndex is interpreted as the index of the corresponding entry in the internal key list. KeyIndex = 0x01 denotes configuration value 0x81, KeyIndex = 0x02 denotes configuration value 0x82, etc.
The value returned in the InitialVector variable is necessary for CBC encryption. If large amounts of data must be encrypted, this command has to be called more than once. In this case, the returned InitialVector variable of call i of the command has to be specified as the InitialVector parameter of call i+1.
[in] | protocol | used to execute the command |
[in] | KeyIndex | Index of key to use to encrypt data. KeyIndex must be set to 0x00 if a user- defined key, specified in the KeyValue parameter, should be used for encryption. |
[in] | KeyValue | If KeyIndex is set to 0x00, this value specifies a user-defined encryption key. |
[in] | InitialVector | Initial vector (IV) used for encryption. |
[in] | Buffer | Data buffer to encrypt. |
[in] | Buffer_len | |
[out] | NextInitialVector | Initial vector to be used as InitialVector parameter in the next call of this command. |
[out] | EncryptedBuffer | Buffer after encryption. |
[out] | EncryptedBuffer_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 |