Skip to content

rlpx::framing::FrameCipher

#include <frame_cipher.hpp>

Public Classes

Name
struct FrameCipherImpl

Public Functions

Name
FrameCipher(const auth::FrameSecrets & secrets)
~FrameCipher()
FramingResult< ByteBuffer > encrypt_frame(const FrameEncryptParams & params)
FramingResult< size_t > decrypt_header(gsl::span< const uint8_t, kFrameHeaderSize > header_ciphertext, gsl::span< const uint8_t, kMacSize > header_mac)
FramingResult< ByteBuffer > decrypt_frame(const FrameDecryptParams & params)
Decrypt a complete frame (header + body) in one call.
FramingResult< ByteBuffer > decrypt_frame_body(size_t fsize, ByteView frame_ct_padded, ByteView frame_mac)
Decrypt the frame body only, after decrypt_header has already been called.
const auth::FrameSecrets & secrets() const

Public Functions Documentation

function FrameCipher

explicit FrameCipher(
    const auth::FrameSecrets & secrets
)

function ~FrameCipher

~FrameCipher()

function encrypt_frame

FramingResult< ByteBuffer > encrypt_frame(
    const FrameEncryptParams & params
)

function decrypt_header

FramingResult< size_t > decrypt_header(
    gsl::span< const uint8_t, kFrameHeaderSize > header_ciphertext,
    gsl::span< const uint8_t, kMacSize > header_mac
)

function decrypt_frame

FramingResult< ByteBuffer > decrypt_frame(
    const FrameDecryptParams & params
)

Decrypt a complete frame (header + body) in one call.

Parameters:

  • params Bundled header ciphertext, header MAC, frame ciphertext, and frame MAC.

Return: Decrypted plaintext payload, or a FramingError on MAC mismatch / invalid size.

function decrypt_frame_body

FramingResult< ByteBuffer > decrypt_frame_body(
    size_t fsize,
    ByteView frame_ct_padded,
    ByteView frame_mac
)

Decrypt the frame body only, after decrypt_header has already been called.

Parameters:

  • fsize Plaintext byte count as decoded from the header.
  • frame_ct_padded Frame ciphertext padded to a 16-byte boundary.
  • frame_mac 16-byte frame MAC from the wire.

Return: Decrypted plaintext (truncated to fsize), or a FramingError on MAC mismatch.

Use this when the header has been decrypted separately (e.g. in MessageStream) to avoid advancing the MAC accumulator twice.

function secrets

inline const auth::FrameSecrets & secrets() const

Updated on 2026-04-13 at 23:22:46 -0700