pub struct Parameters { /* private fields */ }Expand description
The segment length is the only varying parameter in the current specification; AES-256-GCM, HKDF-Expand-SHA-384, and the 32-byte FLOE IV are fixed.
Use Parameters::with_segment_length to construct a Parameters instance with
your desired segment length, or use one of the pre-made Parameters constants
like Parameters::SEGMENT_4_KIB or Parameters::SEGMENT_1_MIB if convenient.
Implementations§
Source§impl Parameters
impl Parameters
Sourcepub const VALID_SEGMENT_LENGTHS: Range<u32>
pub const VALID_SEGMENT_LENGTHS: Range<u32>
Range of valid FLOE segment sizes in bytes. FLOE accepts any segment size in this range and is not restricted to powers of 2.
Sourcepub const SEGMENT_64_B: Self
pub const SEGMENT_64_B: Self
FLOE with 64-byte encrypted segments.
Sourcepub const SEGMENT_4_KIB: Self
pub const SEGMENT_4_KIB: Self
FLOE with 4 KiB encrypted segments.
Sourcepub const SEGMENT_1_MIB: Self
pub const SEGMENT_1_MIB: Self
FLOE with 1 MiB encrypted segments.
Sourcepub const SEGMENT_4_MIB: Self
pub const SEGMENT_4_MIB: Self
FLOE with 4 MiB encrypted segments.
Sourcepub const SEGMENT_5_MIB: Self
pub const SEGMENT_5_MIB: Self
FLOE with 5 MiB encrypted segments.
Sourcepub const SEGMENT_8_MIB: Self
pub const SEGMENT_8_MIB: Self
FLOE with 8 MiB encrypted segments.
Sourcepub const SEGMENT_16_MIB: Self
pub const SEGMENT_16_MIB: Self
FLOE with 16 MiB encrypted segments.
Sourcepub fn with_segment_length(segment_len: u32) -> Result<Self>
pub fn with_segment_length(segment_len: u32) -> Result<Self>
Construct a Parameters instance with the provided segment length in bytes.
segment_len can be any value in the range Parameters::VALID_SEGMENT_LENGTHS.
§Errors
Returns Error::InvalidSegmentLength when segment_len is outside
the supported range.
Sourcepub const fn ciphertext_segment_length(self) -> usize
pub const fn ciphertext_segment_length(self) -> usize
Returns the exact length of every non-final ciphertext segment.
Sourcepub const fn plaintext_segment_length(self) -> usize
pub const fn plaintext_segment_length(self) -> usize
Returns the plaintext length of every non-final segment and the maximum plaintext length of a final segment.
Sourcepub fn plaintext_layout(self, plaintext_length: u64) -> Result<MessageLayout>
pub fn plaintext_layout(self, plaintext_length: u64) -> Result<MessageLayout>
Calculates the complete FLOE layout for plaintext_length.
§Errors
Returns Error::SegmentLimit when the message would exceed the
specification’s segment limit, or Error::LengthOverflow when the
resulting ciphertext length cannot be represented as a u64.
Sourcepub fn ciphertext_layout(self, ciphertext_length: u64) -> Result<MessageLayout>
pub fn ciphertext_layout(self, ciphertext_length: u64) -> Result<MessageLayout>
Calculates the complete FLOE layout for ciphertext_length.
ciphertext_length includes the FLOE header. This validates only the
lengths implied by the file size and assumes every preceding segment is
a full non-final segment. Each prefix and authentication tag must still
be validated while decrypting. For streaming input whose complete
length is unavailable, use SegmentFraming::decode instead.
§Errors
Returns an error when the ciphertext is too short, implies an invalid final segment length, or exceeds the specification’s segment limit.
Trait Implementations§
Source§impl Clone for Parameters
impl Clone for Parameters
Source§fn clone(&self) -> Parameters
fn clone(&self) -> Parameters
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more