![]() |
ndn-lite
|
#include "ndn-lite-aes.h"
Functions | |
ndn_aes_backend_t * | ndn_aes_get_backend (void) |
uint32_t | ndn_aes_get_key_size (const ndn_aes_key_t *aes_key) |
Get aes key size in unit of byte. More... | |
const uint8_t * | ndn_aes_get_key_value (const ndn_aes_key_t *aes_key) |
Get aes key bytes. More... | |
int | ndn_aes_load_key (ndn_aes_key_t *aes_key, const uint8_t *key_value, uint32_t key_size) |
Load in-memory key bits into an NDN aes key. More... | |
int | ndn_aes_cbc_encrypt (const uint8_t *input_value, uint8_t input_size, uint8_t *output_value, uint8_t output_size, const uint8_t *aes_iv, const ndn_aes_key_t *aes_key) |
Use AES-128-CBC algorithm to encrypt a buffer. More... | |
int | ndn_aes_cbc_decrypt (const uint8_t *input_value, uint8_t input_size, uint8_t *output_value, uint8_t output_size, const uint8_t *aes_iv, const ndn_aes_key_t *aes_key) |
Use AES-128-CBC algorithm to decrypt an encrypted buffer. More... | |
uint32_t | ndn_aes_probe_padding_size (uint32_t plaintext_size) |
Probe after padding size of plaintext. More... | |
uint32_t | ndn_aes_parse_unpadding_size (uint8_t *plaintext_value, uint32_t plaintext_size) |
Parse the orginal plaintext size after stripping padding byte. More... | |
Variables | |
ndn_aes_backend_t | ndn_aes_backend |
int ndn_aes_cbc_decrypt | ( | const uint8_t * | input_value, |
uint8_t | input_size, | ||
uint8_t * | output_value, | ||
uint8_t | output_size, | ||
const uint8_t * | aes_iv, | ||
const ndn_aes_key_t * | aes_key | ||
) |
Use AES-128-CBC algorithm to decrypt an encrypted buffer.
This function is implemented with padding PKCS#7, but should call additional function to parse the unpadding size.
input_value. | Input. Buffer to decrypt. |
input_size. | Input. Size of input buffer. |
output_value. | Output. Decrypted buffer. |
output_size. | Input. Size of decrypted buffer. |
aes_iv. | Input. AES Initialization Vector, whose length should be NDN_AES_BLOCK_SIZE. |
key_value. | Input. AES-128 key to perform decryption. Should be same as encryption key. |
key_size. | Input. Size of used AES-128 key. |
int ndn_aes_cbc_encrypt | ( | const uint8_t * | input_value, |
uint8_t | input_size, | ||
uint8_t * | output_value, | ||
uint8_t | output_size, | ||
const uint8_t * | aes_iv, | ||
const ndn_aes_key_t * | aes_key | ||
) |
Use AES-128-CBC algorithm to encrypt a buffer.
This function performs PKCS#7 padding. The input_size must be a multiple of NDN_AES_BLOCK_SIZE to obtain a successful encryption.
input_value. | Input. Buffer to encrypt. |
input_size. | Input. Size of input buffer. |
output_value. | Output. Encrypted buffer. |
output_size. | Input. Size of encrypted buffer. |
aes_iv. | Input. AES Initialization Vector, whose length should be NDN_AES_BLOCK_SIZE. |
key_value. | Input. AES-128 key to perform encryption. |
key_size. | Input. Size of used AES-128 key. |
ndn_aes_backend_t* ndn_aes_get_backend | ( | void | ) |
uint32_t ndn_aes_get_key_size | ( | const ndn_aes_key_t * | aes_key | ) |
Get aes key size in unit of byte.
aes_key. | Input. NDN aes key. |
const uint8_t* ndn_aes_get_key_value | ( | const ndn_aes_key_t * | aes_key | ) |
Get aes key bytes.
aes_key. | Input. NDN aes key. |
int ndn_aes_load_key | ( | ndn_aes_key_t * | aes_key, |
const uint8_t * | key_value, | ||
uint32_t | key_size | ||
) |
Load in-memory key bits into an NDN aes key.
aes_key. | Output. NDN aes key. |
key_value. | Input. Key bytes. |
key_size. | Input. The size of the key bytes. |
uint32_t ndn_aes_parse_unpadding_size | ( | uint8_t * | plaintext_value, |
uint32_t | plaintext_size | ||
) |
Parse the orginal plaintext size after stripping padding byte.
Input size should be multiple of NDN_AES_BLOCK_SIZE.
plaintext_value. | Input. Input buffer before unpadding. |
plaintext_size. | Input. Size of input buffer. |
uint32_t ndn_aes_probe_padding_size | ( | uint32_t | plaintext_size | ) |
Probe after padding size of plaintext.
Ouput should be multiple of NDN_AES_BLOCK_SIZE.
plaintext_size. | Input. Size of original plaintext. |