Skip to main content

SseChunkBinding

Struct SseChunkBinding 

Source
pub struct SseChunkBinding {
    pub enc_chunk_size: u32,
    pub enc_chunk_count: u32,
    pub enc_key_id: u16,
    pub enc_salt: [u8; 8],
    pub enc_plaintext_len: u64,
    pub enc_header_bytes: u32,
}
Expand description

v0.9 #106: per-object SSE-S4 chunked (S4E6) geometry, stored in v3 sidecars. The salt + key_id let the GET path derive the per-chunk AES-GCM nonce + AAD without re-fetching the encrypted body’s header bytes. Salt is not secret (it lives in the on-disk S4E6 header in plaintext anyway); duplicating it here saves one HEAD/GET round-trip per Range request.

Fields§

§enc_chunk_size: u32

S4E6 plaintext bytes per chunk (matches --sse-chunk-size). Must be > 0 for an SSE binding to be considered valid.

§enc_chunk_count: u32

Total number of S4E6 chunks in the body (= ceil(plaintext.len() / enc_chunk_size), always >= 1).

§enc_key_id: u16

Keyring slot the active key was at PUT time. The GET path uses it to look up the same key for decrypt.

§enc_salt: [u8; 8]

8-byte per-PUT random salt (S4E6). Fed into the nonce + AAD derivation; lives in the encrypted body’s header in plaintext anyway, so duplicating it in the sidecar leaks nothing.

§enc_plaintext_len: u64

Pre-encrypt plaintext body length (= post-compress, post-frame body length). Used to validate the chunk-walk math against the encrypted body length the backend reports.

§enc_header_bytes: u32

Fixed header size of the S4E6 frame (== S4E6_HEADER_BYTES = 24 today). Carried explicitly so a future S4E7-style bump doesn’t silently break v3 sidecar decode.

Implementations§

Source§

impl SseChunkBinding

Source

pub fn enc_chunk_stride(&self) -> u64

Per-chunk on-disk byte cost: ciphertext (= plaintext bytes, AES-GCM is CTR-mode) + 16-byte auth tag. Final chunk may carry fewer plaintext bytes; this helper returns the non-final chunk cost.

Source

pub fn enc_chunk_on_disk_size(&self, chunk_idx: u32) -> u64

On-disk byte length of chunk chunk_idx. Non-final chunks carry enc_chunk_size plaintext bytes (+ 16-byte tag); the final chunk carries enc_plaintext_len - (chunk_count - 1) * enc_chunk_size plaintext bytes (+ tag).

Source

pub fn enc_chunk_byte_offset(&self, chunk_idx: u32) -> u64

Encrypted-body byte offset of the start of chunk chunk_idx (= the chunk’s tag byte). Non-final chunks stride at enc_chunk_stride().

Trait Implementations§

Source§

impl Clone for SseChunkBinding

Source§

fn clone(&self) -> SseChunkBinding

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SseChunkBinding

Source§

impl Debug for SseChunkBinding

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SseChunkBinding

Source§

impl PartialEq for SseChunkBinding

Source§

fn eq(&self, other: &SseChunkBinding) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SseChunkBinding

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.