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: PubSecSubFilterSubFilter — selects symmetric algorithm + (V, R) pair.
p: i3232-bit signed permissions value (§7.6.3.2 Table 22). Same
shape as the password-handler’s EncryptionConfig::p.
encrypt_metadata: boolWhether 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
impl PubSecEncoderConfig
Sourcepub fn pkcs7_s4(recipients: Vec<PubSecRecipient>) -> Self
pub fn pkcs7_s4(recipients: Vec<PubSecRecipient>) -> Self
Default config for adbe.pkcs7.s4 (RC4-128, V=2, SHA-1).
Sourcepub fn pkcs7_s5_v4_aes128(recipients: Vec<PubSecRecipient>) -> Self
pub fn pkcs7_s5_v4_aes128(recipients: Vec<PubSecRecipient>) -> Self
Default config for adbe.pkcs7.s5 V=4 + AESV2 (AES-128, SHA-1).
Sourcepub fn pkcs7_s5_v5_aes256(recipients: Vec<PubSecRecipient>) -> Self
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
impl Clone for PubSecEncoderConfig
Source§fn clone(&self) -> PubSecEncoderConfig
fn clone(&self) -> PubSecEncoderConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more