esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
esphome::api::noise::CipherState Class Reference

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.
 

Detailed Description

Wraps a symmetric key plus a monotonically increasing nonce, per the Noise CipherState object.

Without a key, encrypt/decrypt are pass-through.

Member Function Documentation

◆ decrypt_with_ad()

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.

◆ encrypt_with_ad()

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.

◆ has_key()

bool esphome::api::noise::CipherState::has_key ( ) const
inlinenoexcept

◆ initialize_key()

void esphome::api::noise::CipherState::initialize_key ( const SymmetricKey key)

Set the key and reset the nonce to zero.

◆ nonce()

std::uint64_t esphome::api::noise::CipherState::nonce ( ) const
inlinenoexcept

The documentation for this class was generated from the following file: