Skip to main content

PubSecCfGroup

Struct PubSecCfGroup 

Source
pub struct PubSecCfGroup {
    pub name: String,
    pub p: i32,
    pub recipients: Vec<PubSecRecipient>,
    pub seed: [u8; 20],
    pub cek: Vec<u8>,
    pub envelope_iv: [u8; 16],
}
Expand description

One permission-set inside a public-key-encrypted PDF. Each group emits one PKCS#7 EnvelopedData whose plaintext carries the supplied permission mask p; only the recipients listed here can open with those permissions.

Per ISO 32000-1 §7.6.4.2 + §7.6.5.4: “There shall be one PKCS#7 object per unique set of access permissions; if a recipient appears in more than one list, the permissions used shall be those in the first matching list.” The file encryption key is derived from SHA(seed_of_matched_envelope ‖ all_envelope_blobs_in_array_order) — every envelope in the /Recipients array contributes to the hash regardless of which one matched, so all recipients share the same per-object encryption key while seeing different permissions.

The round-12 multi-CF encoder ALSO supports separate [PubSecMultiCfConfig::cf_groups] when the caller wants the /CF dict to enumerate distinct CRYPT FILTERS (each with its own list); see PubSecMultiCfConfig for the shape.

Fields§

§name: String

Name under /CF — typically a descriptive label like OwnerCryptFilter or ReadOnlyCryptFilter. Must match the dictionary-key ASCII alphabet (no / prefix; the encoder adds it).

§p: i32

Permission mask for this group (4-byte signed integer per ISO 32000-1 §7.6.3.2 Table 22).

§recipients: Vec<PubSecRecipient>

Recipients allowed to open with this permission set. The same recipient may appear in multiple groups; the round-12 reader’s first-CF-match rule applies (the group order is the order supplied here, with the StmF entry sorted to the front).

§seed: [u8; 20]

Per-group seed (round-trips deterministically; production callers should override with fresh random per group).

§cek: Vec<u8>

Per-group content-encryption key. Length must match the parent config’s SubFilter (16 / 32 bytes).

§envelope_iv: [u8; 16]

Per-group AES-CBC envelope IV (s5 only).

Implementations§

Source§

impl PubSecCfGroup

Source

pub fn full_access_aes256( name: impl Into<String>, recipients: Vec<PubSecRecipient>, ) -> Self

Convenience constructor: full access (p = -4) for AES-256.

Source

pub fn read_only_aes256( name: impl Into<String>, recipients: Vec<PubSecRecipient>, ) -> Self

Convenience constructor: read-only (p clears the print + modify

  • extract bits per Table 22). The mask 0xFFFF_F0BF corresponds to “view + accessibility-extract only”.

Trait Implementations§

Source§

impl Clone for PubSecCfGroup

Source§

fn clone(&self) -> PubSecCfGroup

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 PubSecCfGroup

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