|
esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
|
Wraps a symmetric key plus a monotonically increasing nonce, per the Noise CipherState object. More...
#include <cipher_state.hpp>
Public Member Functions | |
| void | initialize_key (const SymmetricKey &key) |
| Set the key and reset the nonce to zero. | |
| bool | has_key () const noexcept |
| std::uint64_t | nonce () const noexcept |
| ByteBuffer | encrypt_with_ad (ByteView ad, ByteView plaintext) |
AEAD-encrypt plaintext with associated data ad, advancing the nonce. | |
| ByteBuffer | decrypt_with_ad (ByteView ad, ByteView ciphertext) |
AEAD-decrypt ciphertext, advancing the nonce. | |
Wraps a symmetric key plus a monotonically increasing nonce, per the Noise CipherState object.
Without a key, encrypt/decrypt are pass-through.
| ByteBuffer esphome::api::noise::CipherState::decrypt_with_ad | ( | ByteView | ad, |
| ByteView | ciphertext | ||
| ) |
AEAD-decrypt ciphertext, advancing the nonce.
Throws EncryptionError on authentication failure. Returns a copy of ciphertext if no key is set.
| ByteBuffer esphome::api::noise::CipherState::encrypt_with_ad | ( | ByteView | ad, |
| ByteView | plaintext | ||
| ) |
AEAD-encrypt plaintext with associated data ad, advancing the nonce.
Returns a copy of plaintext if no key is set.
|
inlinenoexcept |
| void esphome::api::noise::CipherState::initialize_key | ( | const SymmetricKey & | key | ) |
Set the key and reset the nonce to zero.
|
inlinenoexcept |