5 #ifndef BITCOIN_BIP324_H 6 #define BITCOIN_BIP324_H 71 void Encrypt(std::span<const std::byte> contents, std::span<const std::byte> aad,
bool ignore, std::span<std::byte> output) noexcept;
77 unsigned DecryptLength(std::span<const std::byte> input) noexcept;
84 bool Decrypt(std::span<const std::byte> input, std::span<const std::byte> aad,
bool& ignore, std::span<std::byte> contents) noexcept;
96 #endif // BITCOIN_BIP324_H static constexpr std::byte IGNORE_BIT
std::optional< FSChaCha20Poly1305 > m_recv_p_cipher
std::span< const std::byte > GetSendGarbageTerminator() const noexcept
Get the Garbage Terminator to send.
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.
The BIP324 packet cipher, encapsulating its key derivation, stream cipher, and AEAD.
std::array< std::byte, GARBAGE_TERMINATOR_LEN > m_recv_garbage_terminator
void Encrypt(std::span< const std::byte > contents, std::span< const std::byte > aad, bool ignore, std::span< std::byte > output) noexcept
Encrypt a packet.
std::span< const std::byte > GetReceiveGarbageTerminator() const noexcept
Get the expected Garbage Terminator to receive.
static constexpr unsigned HEADER_LEN
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
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
bool Decrypt(std::span< const std::byte > input, std::span< const std::byte > aad, bool &ignore, std::span< std::byte > contents) noexcept
Decrypt a packet.
EllSwiftPubKey m_our_pubkey
std::span< const std::byte > GetSessionID() const noexcept
Get the Session ID.
An encapsulated private key.
static constexpr unsigned EXPANSION
static constexpr unsigned LENGTH_LEN
unsigned DecryptLength(std::span< const std::byte > input) noexcept
Decrypt the length of a packet.