cecies
|
ECIES encryption implementation using Curve25516 or Curve448, AES256-GCM and MbedTLS. More...
Go to the source code of this file.
Functions | |
CECIES_API int | cecies_curve25519_encrypt (const uint8_t *data, size_t data_length, int compress, cecies_curve25519_key public_key, uint8_t **output, size_t *output_length, int output_base64) |
CECIES_API int | cecies_curve448_encrypt (const uint8_t *data, size_t data_length, int compress, cecies_curve448_key public_key, uint8_t **output, size_t *output_length, int output_base64) |
ECIES encryption implementation using Curve25516 or Curve448, AES256-GCM and MbedTLS.
CECIES_API int cecies_curve25519_encrypt | ( | const uint8_t * | data, |
size_t | data_length, | ||
int | compress, | ||
cecies_curve25519_key | public_key, | ||
uint8_t ** | output, | ||
size_t * | output_length, | ||
int | output_base64 | ||
) |
Encrypts the given data using ECIES over Curve25519 and AES256-GCM.
data | The data to encrypt. |
data_length | The length of the data array. |
compress | Should the data be compressed before being encrypted? Pass any integer value between [0; 9] (where 0 is no compression at all and 9 is highest but slowest compression). |
public_key | The public key to encrypt the data with (hex-string format, as is the output of cecies_generate_curve25519_keypair()). |
output | Where to write the encrypted output into (this will ONLY be allocated if encryption succeeds; if the procedure fails in any way this is left untouched). On success: DO NOT FORGET TO FREE THIS YOURSELF! Use cecies_free() for freeing. |
output_length | Where to write the output buffer length into. |
output_base64 | Should the encrypted output bytes be base64-encoded for easy transmission over e.g. email? If you decide to base64-encode the encrypted data buffer, please be aware that a NUL-terminator is appended at the end to allow usage as a C-string but it will not be counted in output_length . Pass 0 for false , anything else for true . |
0
if encryption succeeded; error codes as defined inside the header file or MbedTLS otherwise. CECIES_API int cecies_curve448_encrypt | ( | const uint8_t * | data, |
size_t | data_length, | ||
int | compress, | ||
cecies_curve448_key | public_key, | ||
uint8_t ** | output, | ||
size_t * | output_length, | ||
int | output_base64 | ||
) |
Encrypts the given data using ECIES over Curve448 and AES256-GCM.
data | The data to encrypt. |
data_length | The length of the data array. |
compress | Should the data be compressed before being encrypted? Pass any integer value between [0; 9] (where 0 is no compression at all and 9 is highest but slowest compression). |
public_key | The public key to encrypt the data with (hex-string format, as is the output of cecies_generate_curve448_keypair()). |
output | Where to write the encrypted output into (this will ONLY be allocated if encryption succeeds; if the procedure fails in any way this is left untouched). On success: DO NOT FORGET TO FREE THIS YOURSELF! Use cecies_free() for freeing. |
output_length | Where to write the output buffer length into. |
output_base64 | Should the encrypted output bytes be base64-encoded for easy transmission over e.g. email? If you decide to base64-encode the encrypted data buffer, please be aware that a NUL-terminator is appended at the end to allow usage as a C-string but it will not be counted in output_length . Pass 0 for false , anything else for true . |
0
if encryption succeeded; error codes as defined inside the header file or MbedTLS otherwise.