14inline constexpr auto protocol_name =
"Noise_NNpsk0_25519_ChaChaPoly_SHA256";
51 void ensure_ephemeral();
59 bool have_ephemeral_ =
false;
60 bool complete_ =
false;
Byte buffer / view aliases and protobuf base-128 varint codec.
Noise CipherState: a keyed AEAD with an incrementing nonce.
Non-owning view over a contiguous run of bytes (a C++17 stand-in for std::span<const std::uint8_t>).
Definition bytes.hpp:17
Wraps a symmetric key plus a monotonically increasing nonce, per the Noise CipherState object.
Definition cipher_state.hpp:15
Drives the two-message NNpsk0 handshake.
Definition noise_handshake.hpp:21
bool is_complete() const noexcept
Definition noise_handshake.hpp:35
bool read_message(ByteView message, ByteBuffer &out_payload)
Read the next handshake message into out_payload.
const Hash & handshake_hash() const noexcept
Definition noise_handshake.hpp:43
ByteBuffer write_message(ByteView payload=ByteView{})
Write the next handshake message (Initiator: message 1; Responder: 2).
void split(CipherState &send, CipherState &recv)
After completion, derive the transport cipher states for this role (send is what this side encrypts w...
Role
Definition noise_handshake.hpp:23
void initialize(Role role, const SymmetricKey &psk, ByteView prologue)
Set up with the role, the 32-byte PSK and the prologue.
void set_ephemeral_for_testing(const PrivateKey &private_key)
Test hook: force a fixed ephemeral private key (for known-answer vectors).
Implements the Noise SymmetricState object: it accumulates the handshake transcript hash h,...
Definition symmetric_state.hpp:18
const Hash & handshake_hash() const noexcept
Definition symmetric_state.hpp:42
Definition cipher_state.hpp:11
constexpr auto protocol_name
Noise protocol name for the ESPHome native API.
Definition noise_handshake.hpp:14
std::array< std::uint8_t, key_len > PublicKey
Definition primitives.hpp:22
std::array< std::uint8_t, key_len > SymmetricKey
Definition primitives.hpp:21
std::array< std::uint8_t, key_len > PrivateKey
Definition primitives.hpp:23
std::array< std::uint8_t, hash_len > Hash
Definition primitives.hpp:20
std::vector< std::uint8_t > ByteBuffer
Owning, growable byte buffer.
Definition bytes.hpp:13
Noise cryptographic primitives (SHA-256, HMAC, HKDF, X25519, ChaCha20- Poly1305, base64).
Noise SymmetricState: chaining key + transcript hash + CipherState.