Skip to main content

EncryptingEncoder

Struct EncryptingEncoder 

Source
pub struct EncryptingEncoder { /* private fields */ }
Expand description

The AES-256 /R 6 encrypting encoder (Pass 5.4) — the seam’s first non-identity implementation, and the reason it exists (decision 007 W8).

Encrypts every string and stream through Algorithm 1.A (§7.6.3.3): a fresh random 16-byte IV prefixed to AES-256-CBC ciphertext, PKCS#7 always padded. At /V 5 the object key IS the file key (T24), so no per-object derivation happens here.

§What it does NOT encrypt, and why the writer decides by OWNER id

The ObjectEncoder trait hands this only the bytes and the containing object’s id — not the dictionary — so the exemptions that depend on an object’s ROLE (the /Encrypt dict itself, cross-reference streams, /Metadata when /EncryptMetadata is false, external streams, an /Identity crypt filter) are resolved by the caller into two id sets and consulted here. A signed document is refused UPSTREAM (EditError), so the per-string /Contents exemption (N13) never has to be expressed at this granularity in this cut.

Implementations§

Source§

impl EncryptingEncoder

Source

pub fn new( key: [u8; 32], encrypt_dict: ObjId, clear_streams: HashSet<u32>, ) -> Self

Build the encoder from the file key and the two exemption sets.

Trait Implementations§

Source§

impl Clone for EncryptingEncoder

Source§

fn clone(&self) -> Self

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 Debug for EncryptingEncoder

Source§

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

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

impl ObjectEncoder for EncryptingEncoder

Source§

fn encode_string<'a>(&self, owner: ObjId, data: &'a [u8]) -> Cow<'a, [u8]>

Transform the decoded bytes of a string object (§7.3.4) belonging to indirect object owner. Read more
Source§

fn encode_stream<'a>(&self, owner: ObjId, data: &'a [u8]) -> Cow<'a, [u8]>

Transform the already-filter-encoded bytes of a stream (§7.3.8) belonging to indirect object owner. Read more

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.