pub struct EncryptionHandler { /* private fields */ }Expand description
PDF Encryption Handler
Implementations§
Source§impl EncryptionHandler
impl EncryptionHandler
Sourcepub fn new(
encrypt_dict: &PdfDictionary,
file_id: Option<Vec<u8>>,
) -> ParseResult<Self>
pub fn new( encrypt_dict: &PdfDictionary, file_id: Option<Vec<u8>>, ) -> ParseResult<Self>
Create encryption handler from encryption dictionary
Sourcepub fn detect_encryption(trailer: &PdfDictionary) -> bool
pub fn detect_encryption(trailer: &PdfDictionary) -> bool
Check if PDF is encrypted by looking for Encrypt entry in trailer
Sourcepub fn unlock_with_user_password(&mut self, password: &str) -> ParseResult<bool>
pub fn unlock_with_user_password(&mut self, password: &str) -> ParseResult<bool>
Try to unlock PDF with user password
Sourcepub fn unlock_with_owner_password(
&mut self,
password: &str,
) -> ParseResult<bool>
pub fn unlock_with_owner_password( &mut self, password: &str, ) -> ParseResult<bool>
Try to unlock PDF with owner password
Sourcepub fn try_empty_password(&mut self) -> ParseResult<bool>
pub fn try_empty_password(&mut self) -> ParseResult<bool>
Try to unlock with empty password (common case)
Sourcepub fn is_unlocked(&self) -> bool
pub fn is_unlocked(&self) -> bool
Check if the PDF is currently unlocked
Sourcepub fn encryption_key(&self) -> Option<&EncryptionKey>
pub fn encryption_key(&self) -> Option<&EncryptionKey>
Get the current encryption key (if unlocked)
Sourcepub fn decrypt_string(
&self,
data: &[u8],
obj_id: &ObjectId,
) -> ParseResult<Vec<u8>>
pub fn decrypt_string( &self, data: &[u8], obj_id: &ObjectId, ) -> ParseResult<Vec<u8>>
Decrypt a string object
Sourcepub fn decrypt_stream(
&self,
data: &[u8],
obj_id: &ObjectId,
) -> ParseResult<Vec<u8>>
pub fn decrypt_stream( &self, data: &[u8], obj_id: &ObjectId, ) -> ParseResult<Vec<u8>>
Decrypt a stream object
Sourcepub fn algorithm_info(&self) -> String
pub fn algorithm_info(&self) -> String
Get encryption algorithm information
Sourcepub fn permissions(&self) -> Permissions
pub fn permissions(&self) -> Permissions
Get permissions information
Sourcepub fn encrypt_strings(&self) -> bool
pub fn encrypt_strings(&self) -> bool
Check if strings should be encrypted
Sourcepub fn encrypt_streams(&self) -> bool
pub fn encrypt_streams(&self) -> bool
Check if streams should be encrypted
Sourcepub fn encrypt_metadata(&self) -> bool
pub fn encrypt_metadata(&self) -> bool
Check if metadata should be encrypted (R4 only)
Auto Trait Implementations§
impl Freeze for EncryptionHandler
impl RefUnwindSafe for EncryptionHandler
impl Send for EncryptionHandler
impl Sync for EncryptionHandler
impl Unpin for EncryptionHandler
impl UnwindSafe for EncryptionHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more