|
esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
|
Implements the Noise SymmetricState object: it accumulates the handshake transcript hash h, derives keys through the chaining key ck, and owns the handshake CipherState.
More...
#include <symmetric_state.hpp>
Public Member Functions | |
| void | initialize (const std::string &protocol_name) |
| Initialize from the protocol name (e.g. "Noise_NNpsk0_25519_ChaChaPoly_SHA256"). | |
| void | mix_key (ByteView input) |
| MixKey(input): re-derive ck and the CipherState key. | |
| void | mix_hash (ByteView data) |
MixHash(data): fold data into the transcript hash. | |
| void | mix_key_and_hash (ByteView input) |
| MixKeyAndHash(input): the psk-mixing variant (HKDF with 3 outputs). | |
| ByteBuffer | encrypt_and_hash (ByteView plaintext) |
EncryptAndHash(plaintext): encrypt (if keyed), fold ciphertext into h. | |
| ByteBuffer | decrypt_and_hash (ByteView ciphertext) |
DecryptAndHash(ciphertext): decrypt (if keyed), fold ciphertext into h. | |
| void | split (CipherState &first, CipherState &second) const |
| Split(): derive the two transport CipherStates (initiator: first=send). | |
| const Hash & | handshake_hash () const noexcept |
Implements the Noise SymmetricState object: it accumulates the handshake transcript hash h, derives keys through the chaining key ck, and owns the handshake CipherState.
| ByteBuffer esphome::api::noise::SymmetricState::decrypt_and_hash | ( | ByteView | ciphertext | ) |
DecryptAndHash(ciphertext): decrypt (if keyed), fold ciphertext into h.
Throws EncryptionError on authentication failure.
| ByteBuffer esphome::api::noise::SymmetricState::encrypt_and_hash | ( | ByteView | plaintext | ) |
EncryptAndHash(plaintext): encrypt (if keyed), fold ciphertext into h.
|
inlinenoexcept |
| void esphome::api::noise::SymmetricState::initialize | ( | const std::string & | protocol_name | ) |
Initialize from the protocol name (e.g. "Noise_NNpsk0_25519_ChaChaPoly_SHA256").
| void esphome::api::noise::SymmetricState::mix_hash | ( | ByteView | data | ) |
MixHash(data): fold data into the transcript hash.
| void esphome::api::noise::SymmetricState::mix_key | ( | ByteView | input | ) |
MixKey(input): re-derive ck and the CipherState key.
| void esphome::api::noise::SymmetricState::mix_key_and_hash | ( | ByteView | input | ) |
MixKeyAndHash(input): the psk-mixing variant (HKDF with 3 outputs).
| void esphome::api::noise::SymmetricState::split | ( | CipherState & | first, |
| CipherState & | second | ||
| ) | const |
Split(): derive the two transport CipherStates (initiator: first=send).