5 #ifndef BITCOIN_BIP324_H 6 #define BITCOIN_BIP324_H 96 #endif // BITCOIN_BIP324_H static constexpr std::byte IGNORE_BIT
Span< const std::byte > GetSendGarbageTerminator() const noexcept
Get the Garbage Terminator to send.
std::optional< FSChaCha20Poly1305 > m_recv_p_cipher
static constexpr unsigned SESSION_ID_LEN
void Initialize(const EllSwiftPubKey &their_pubkey, bool initiator, bool self_decrypt=false) noexcept
Initialize when the other side's public key is received.
unsigned DecryptLength(Span< const std::byte > input) noexcept
Decrypt the length of a packet.
The BIP324 packet cipher, encapsulating its key derivation, stream cipher, and AEAD.
std::array< std::byte, GARBAGE_TERMINATOR_LEN > m_recv_garbage_terminator
static constexpr unsigned HEADER_LEN
Span< const std::byte > GetSessionID() const noexcept
Get the Session ID.
static constexpr unsigned REKEY_INTERVAL
static constexpr unsigned GARBAGE_TERMINATOR_LEN
std::optional< FSChaCha20Poly1305 > m_send_p_cipher
const EllSwiftPubKey & GetOurPubKey() const noexcept
Retrieve our public key.
BIP324Cipher()=delete
No default constructor; keys must be provided to create a BIP324Cipher.
An ElligatorSwift-encoded public key.
std::array< std::byte, GARBAGE_TERMINATOR_LEN > m_send_garbage_terminator
bool Decrypt(Span< const std::byte > input, Span< const std::byte > aad, bool &ignore, Span< std::byte > contents) noexcept
Decrypt a packet.
std::optional< FSChaCha20 > m_send_l_cipher
std::optional< FSChaCha20 > m_recv_l_cipher
static constexpr auto EXPANSION
Expansion when encrypting.
std::array< std::byte, SESSION_ID_LEN > m_session_id
void Encrypt(Span< const std::byte > contents, Span< const std::byte > aad, bool ignore, Span< std::byte > output) noexcept
Encrypt a packet.
EllSwiftPubKey m_our_pubkey
An encapsulated private key.
Span< const std::byte > GetReceiveGarbageTerminator() const noexcept
Get the expected Garbage Terminator to receive.
static constexpr unsigned EXPANSION
static constexpr unsigned LENGTH_LEN