esp8266ndn
NDN Arduino library for ESP8266 and more
|
AES-GCM secret key. More...
#include <mbed-common.hpp>
Public Types | |
using | Key = std::array< uint8_t, keyBits/8 > |
using | IvLen = AesGcmIvHelper::IvLen |
using | TagLen = std::integral_constant< size_t, 16 > |
Public Member Functions | |
AesGcm () | |
~AesGcm () | |
AesGcm (const AesGcm &)=delete | |
AesGcm & | operator= (const AesGcm &)=delete |
bool | import (const Key &key) |
Import raw AES key. | |
template<typename Encrypted > | |
tlv::Value | encrypt (Region ®ion, tlv::Value plaintext, const uint8_t *aad=nullptr, size_t aadLen=0) |
Encrypt to encrypted-message. | |
template<typename Encrypted > | |
tlv::Value | decrypt (Region ®ion, const Encrypted &encrypted, const uint8_t *aad=nullptr, size_t aadLen=0) |
Decrypt from encrypted-message. | |
void | clearDecryptIvChecker () |
AES-GCM secret key.
keyBits | AES key size in bits, either 128 or 256. |
InitializationVector requirements are enforced by AesGcmIvHelper
. AuthenticationTag is 16 octets. Other sizes are not supported.
using ndnph::mbedtls::AesGcm< keyBits >::IvLen = AesGcmIvHelper::IvLen |
using ndnph::mbedtls::AesGcm< keyBits >::Key = std::array<uint8_t, keyBits / 8> |
using ndnph::mbedtls::AesGcm< keyBits >::TagLen = std::integral_constant<size_t, 16> |
|
inlineexplicit |
|
inline |
|
delete |
|
inline |
|
inline |
Decrypt from encrypted-message.
Encrypted | a specialization of EncryptedMessage . |
region | where to allocate memory. |
encrypted | encrypted-message. |
aad | additional associated data. |
aadLen | length of aad . |
This function enforces IV uniqueness. It requires the random number portion to be consistent, and the counter portion to be monotonically increasing. Attempting to decrypt the same message for a second time would result in failure due to duplicate IV. Caller should deduplicate incoming messages, or disable this check by calling clearDecryptIvChecker()
every time.
|
inline |
Encrypt to encrypted-message.
Encrypted | a specialization of EncryptedMessage . |
region | where to allocate memory. |
plaintext | input plaintext. |
aad | additional associated data. |
aadLen | length of aad . |
|
inline |
Import raw AES key.
|
delete |