Skip to main content

PubSecEncoderConfig

Struct PubSecEncoderConfig 

Source
pub struct PubSecEncoderConfig {
    pub sub_filter: PubSecSubFilter,
    pub p: i32,
    pub encrypt_metadata: bool,
    pub recipients: Vec<PubSecRecipient>,
    pub seed: [u8; 20],
    pub cek: Vec<u8>,
    pub envelope_iv: [u8; 16],
    pub aes_iv: [u8; 16],
}
Expand description

Writer-side configuration for the public-key security handler. Picks one of the four PDF SubFilters and lists the recipients that may open the resulting file.

Fields§

§sub_filter: PubSecSubFilter

SubFilter — selects symmetric algorithm + (V, R) pair.

§p: i32

32-bit signed permissions value (§7.6.3.2 Table 22). Same shape as the password-handler’s EncryptionConfig::p.

§encrypt_metadata: bool

Whether the document metadata stream is encrypted (R≥4). Wired into both the /EncryptMetadata dict entry and the 0xFFFFFFFF opt-in tail of the SHA-1 / SHA-256 file-key derivation when false (§7.6.4.3 / §7.6.5.3).

§recipients: Vec<PubSecRecipient>

Recipients that may open the document. Each gets its own KeyTransRecipientInfo slot in the CMS EnvelopedData — the wrapped CEK is the same content-encryption key for every recipient in the same envelope, so any one of them can open the PDF.

§seed: [u8; 20]

20-byte seed prefixed to the envelope plaintext. Pinned for determinism in tests; production callers should use a fresh random per file.

§cek: Vec<u8>

Content-encryption key (CEK). Length must match the SubFilter: 16 bytes for s3 (RC4-40 keys are 16 bytes per ISO 32000-1 §7.6.4.3 — the 40-bit subset is selected via /Length only), 16 bytes for s4 / s5-V4-AESV2, 32 bytes for s5-V5-AESV3.

§envelope_iv: [u8; 16]

AES CBC IV for the envelope’s encrypted content (s5 only). Ignored for s3 / s4 (RC4 — no IV).

§aes_iv: [u8; 16]

IV used for per-object AES encryption (16 bytes). Tests pin; production callers should override per-object.

Implementations§

Source§

impl PubSecEncoderConfig

Source

pub fn pkcs7_s4(recipients: Vec<PubSecRecipient>) -> Self

Default config for adbe.pkcs7.s4 (RC4-128, V=2, SHA-1).

Source

pub fn pkcs7_s5_v4_aes128(recipients: Vec<PubSecRecipient>) -> Self

Default config for adbe.pkcs7.s5 V=4 + AESV2 (AES-128, SHA-1).

Source

pub fn pkcs7_s5_v5_aes256(recipients: Vec<PubSecRecipient>) -> Self

Default config for adbe.pkcs7.s5 V=5 + AESV3 (AES-256, SHA-256).

Trait Implementations§

Source§

impl Clone for PubSecEncoderConfig

Source§

fn clone(&self) -> PubSecEncoderConfig

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 PubSecEncoderConfig

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