Encrypt
config_decrypt
Wrapper around session::config::decrypt. ciphertext and key_base are binary: ciphertext has the
length provided, key_base must be exactly 32 bytes. domain is a c string. Returns a newly
allocated buffer containing the decrypted data, and sets the data's length into
plaintext_size. It is the caller's responsibility to free() the returned buffer!
Declaration
UNSIGNED CHAR* config_decrypt(
[in] const unsigned char* ciphertext,
[in] size_t clen,
[in] const unsigned char* key_base,
[in] const char* domain,
[out] size_t* plaintext_size
);
Parameters
ciphertext— [in] the message to be decrypted in binaryclen— [in] length of the message providedkey_base— [in] key, must be binarydomain— [in] textplaintext_size— [out] will contain the size of the returned plaintext
Returns
unsigned char*— decrypted message, will be nullptr on error
config_encrypt
Wrapper around session::config::encrypt. message and key_base are binary: message has the
length provided, key_base must be exactly 32 bytes. domain is a c string. Returns a newly
allocated buffer containing the encrypted data, and sets the data's length into
ciphertext_size. It is the caller's responsibility to free() the returned buffer!
Declaration
UNSIGNED CHAR* config_encrypt(
[in] const unsigned char* message,
[in] size_t mlen,
[in] const unsigned char* key_base,
[in] const char* domain,
[out] size_t* ciphertext_size
);
Parameters
message— [in] The message to encrypted in binarymlen— [in] Length of the message providedkey_base— [in] Key, must be binarydomain— [in] Textciphertext_size— [out] will contain the size of the returned ciphertext
Returns
unsigned char*— ciphertext, will be nullptr on error
config_padded_size
Returns the amount of padding needed for a plaintext of size s with encryption overhead
overhead.
Declaration
Parameters
s— [in] unsigned integer of the size of the plaintextoverhead— [in] unsigned integer of the desired overhead
Returns
size_t— Unsigned integer of the amount of padding necessary