Skip to main content

PubSecMultiCfConfig

Struct PubSecMultiCfConfig 

Source
pub struct PubSecMultiCfConfig {
    pub sub_filter: PubSecSubFilter,
    pub encrypt_metadata: bool,
    pub groups: Vec<PubSecCfGroup>,
    pub aes_iv: [u8; 16],
    pub shared_cek: Vec<u8>,
    pub shared_seed: [u8; 20],
}
Expand description

Configuration for a multi-permission-set public-key-encrypted PDF — one EnvelopedData per PubSecCfGroup, all threaded into a single /Recipients array (which is itself referenced from one or more /CF entries).

Every group’s envelope wraps the SAME 20-byte seed and the SAME content-encryption key (per ISO 32000-1 §7.6.4.3 / ISO 32000-2 §7.6.5.3 — the file encryption key is derived from SHA(seed ‖ ALL recipient blobs), so the seed must be identical across envelopes for every reader to converge on the same file key). Per-recipient differences surface only as different permission masks in each envelope’s plaintext trailer.

Fields§

§sub_filter: PubSecSubFilter

Symmetric algorithm + key size — s5 only. s3 / s4 reject at build time.

§encrypt_metadata: bool

Whether the document metadata stream is encrypted.

§groups: Vec<PubSecCfGroup>

One permission-set per PubSecCfGroup. Must contain at least one group; the first group’s name becomes the dict-level /StmF + /StrF CF entry. The CFs all reference the same /Recipients array (containing every group’s envelope), so any matching recipient — regardless of which CF they were nominally tied to — recovers the file key. Each group’s seed field is overridden by shared_seed at build time to guarantee key-derivation convergence; the per-group seed slot stays in the API for forward compatibility (round-13 might add per-stream key streams).

§aes_iv: [u8; 16]

Per-object AES IV (round-trip determinism only).

§shared_cek: Vec<u8>

Shared content-encryption key bytes — must match the SubFilter’s key length (16 for AES-128, 32 for AES-256).

§shared_seed: [u8; 20]

Shared 20-byte seed mixed into the file-key derivation. Must match across every envelope or the multi-recipient story breaks (different recipients would derive different file keys). Defaulted by the test fixtures to [0xA1; 20].

Implementations§

Source§

impl PubSecMultiCfConfig

Source

pub fn build(self) -> Result<PubSecEncryptionState, PdfError>

Build the writer-side state. Every group’s envelope wraps the SAME shared CEK to that group’s recipients with that group’s permission mask; all envelopes go into one /Recipients array. The file encryption key is derived from SHA(seed_of_first_group ‖ all_envelopes) per §7.6.4.3 / §7.6.5.3.

Trait Implementations§

Source§

impl Clone for PubSecMultiCfConfig

Source§

fn clone(&self) -> PubSecMultiCfConfig

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 PubSecMultiCfConfig

Source§

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

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V