cecies
Functions
decrypt.h File Reference

ECIES decryption implementation using Curve25519 or Curve448, AES256-GCM and MbedTLS. More...

#include <stddef.h>
#include <stdint.h>
#include "types.h"
Include dependency graph for decrypt.h:

Go to the source code of this file.

Functions

CECIES_API int cecies_curve25519_decrypt (const uint8_t *encrypted_data, size_t encrypted_data_length, int encrypted_data_base64, cecies_curve25519_key private_key, uint8_t **output, size_t *output_length)
 
CECIES_API int cecies_curve448_decrypt (const uint8_t *encrypted_data, size_t encrypted_data_length, int encrypted_data_base64, cecies_curve448_key private_key, uint8_t **output, size_t *output_length)
 

Detailed Description

ECIES decryption implementation using Curve25519 or Curve448, AES256-GCM and MbedTLS.

Author
Raphael Beck

Function Documentation

◆ cecies_curve25519_decrypt()

CECIES_API int cecies_curve25519_decrypt ( const uint8_t *  encrypted_data,
size_t  encrypted_data_length,
int  encrypted_data_base64,
cecies_curve25519_key  private_key,
uint8_t **  output,
size_t *  output_length 
)

Decrypts the given data using ECIES, Curve25519 and AES256-GCM.

Parameters
encrypted_dataThe data to decrypt.
encrypted_data_lengthThe length of the data array.
encrypted_data_base64Is the input encrypted_data base64-encoded? Pass 0 for false, anything else for true.
private_keyThe private key to decrypt the data with (hex-string, as is the output of cecies_generate_curve25519_keypair()). This is passed by value and will be destroyed after usage!
outputWhere to write the decrypted output into (this will ONLY be allocated if decryption 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_lengthWhere to write the output buffer length into (how many bytes were written into it).
Returns
0 if decryption succeeded; error codes as defined inside the header file or MbedTLS otherwise.

◆ cecies_curve448_decrypt()

CECIES_API int cecies_curve448_decrypt ( const uint8_t *  encrypted_data,
size_t  encrypted_data_length,
int  encrypted_data_base64,
cecies_curve448_key  private_key,
uint8_t **  output,
size_t *  output_length 
)

Decrypts the given data using ECIES, Curve448 and AES256-GCM.

Parameters
encrypted_dataThe data to decrypt.
encrypted_data_lengthThe length of the data array.
encrypted_data_base64Is the input encrypted_data base64-encoded? Pass 0 for false, anything else for true.
private_keyThe private key to decrypt the data with (hex-string, as is the output of cecies_generate_curve448_keypair()). This is passed by value and will be destroyed after usage!
outputWhere to write the decrypted output into (this will ONLY be allocated if decryption 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_lengthWhere to write the output buffer length into (how many bytes were written into it).
Returns
0 if decryption succeeded; error codes as defined inside the header file or MbedTLS otherwise.