pub struct Decryptor { /* private fields */ }Expand description
A configured Standard-handler decryptor for a document opened with the empty user password.
Implementations§
Source§impl Decryptor
impl Decryptor
Sourcepub fn from_standard(enc: &Dict, id0: &[u8]) -> Option<Decryptor>
pub fn from_standard(enc: &Dict, id0: &[u8]) -> Option<Decryptor>
Builds a decryptor from the resolved /Encrypt dictionary and the first
/ID element, assuming the empty user password. Returns None when the
handler or its parameters are unsupported, or the empty password does
not open the file (so the caller can report it as unsupported).
This is low-level: crate::Document configures decryption itself, and
a caller only reaches for this when driving object reads directly — as
the asynchronous API does.
use pdfboss_core::{Decryptor, Dict};
// An empty dictionary names no handler, so there is nothing to build.
assert!(Decryptor::from_standard(&Dict::default(), &[]).is_none());Sourcepub fn decrypt_object(&self, obj: &mut Object, num: u32, gen: u16)
pub fn decrypt_object(&self, obj: &mut Object, num: u32, gen: u16)
Decrypts one indirect object’s strings and stream data in place. Objects extracted from object streams are already plaintext and must not be passed here.
Low-level, like Decryptor::from_standard: crate::Document applies
this itself as it loads objects, and a caller only reaches for it when
driving object reads directly — as the asynchronous API does.
use pdfboss_core::{Decryptor, Object};
// Reachable from outside the crate; exercising it needs an encrypted
// document, so this only pins the signature and the visibility.
let apply: fn(&Decryptor, &mut Object, u32, u16) = Decryptor::decrypt_object;
let _ = apply;