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: PubSecSubFilterSymmetric algorithm + key size — s5 only. s3 / s4 reject
at build time.
encrypt_metadata: boolWhether 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 content-encryption key bytes — must match the SubFilter’s key length (16 for AES-128, 32 for AES-256).
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
impl PubSecMultiCfConfig
Sourcepub fn build(self) -> Result<PubSecEncryptionState, PdfError>
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
impl Clone for PubSecMultiCfConfig
Source§fn clone(&self) -> PubSecMultiCfConfig
fn clone(&self) -> PubSecMultiCfConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more