Skip to main content

PubSecEncryptionState

Struct PubSecEncryptionState 

Source
pub struct PubSecEncryptionState {
    pub handler: StandardHandler,
    pub encrypt_dict: Dict,
    pub aes_iv: [u8; 16],
    pub file_id: Vec<u8>,
}
Expand description

Result of building the writer-side public-key state — symmetric to the password-based crate::encrypt::EncryptionState. Callers install the handler / encrypt_dict on a Document exactly as the password-based encoder does.

Fields§

§handler: StandardHandler

File encryption handler (key + per-object method + revision).

§encrypt_dict: Dict

/Encrypt dictionary literal to thread into the trailer.

§aes_iv: [u8; 16]

Per-object AES IV.

§file_id: Vec<u8>

Permanent file identifier — placed in /ID[0]. Public-key PDFs still need an /ID array; we generate a deterministic 16-byte one (or accept a caller-supplied override via crate::write_pdf_from_scene_pubsec_encrypted).

Implementations§

Source§

impl PubSecEncryptionState

Source

pub fn into_encryption_state(self) -> EncryptionState

Convert to the password-handler crate::encrypt::EncryptionState shape so the writer can install it on Document::encryption without duplicating the per-object encryption paths. The resulting state’s encrypt_dict is /Filter /Adobe.PPKLite (not /Filter /Standard) — every other slot is identical.

Source

pub fn build(config: &PubSecEncoderConfig) -> Result<Self, PdfError>

Build the writer-side state from a PubSecEncoderConfig. The returned encrypt_dict is symmetric to what super::open_with_certificate consumes.

Source

pub fn with_file_id(self, file_id: Vec<u8>) -> Self

Override the file ID (16+ bytes recommended).

Source§

impl PubSecEncryptionState

Source

pub fn build_kari(config: &PubSecKariConfig) -> Result<Self, PdfError>

Round-15: build the writer-side state for a KARI-encrypted PDF. Emits one CMS EnvelopedData containing one KeyAgreeRecipientInfo per recipient (each one sized to its own curve), all wrapping the same shared CEK with AES-256-WRAP. Symmetric to the round-14 reader path: the resulting /Encrypt dict opens via super::open_with_certificate when the recipient passes a [PubSecCredential] carrying their EC scalar.

Trait Implementations§

Source§

impl Clone for PubSecEncryptionState

Source§

fn clone(&self) -> PubSecEncryptionState

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 PubSecEncryptionState

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