pub struct Encryption { /* private fields */ }Expand description
how a document is encrypted: the cipher, the passwords, the permissions
Implementations§
Source§impl Encryption
impl Encryption
Sourcepub fn aes256(user: &str, owner: &str) -> Encryption
pub fn aes256(user: &str, owner: &str) -> Encryption
AES-256 with these passwords, every permission, metadata encrypted
Sourcepub fn aes128(user: &str, owner: &str) -> Encryption
pub fn aes128(user: &str, owner: &str) -> Encryption
AES-128 with these passwords (PDFDocEncoding, the first 32 bytes count), every permission, metadata encrypted
Sourcepub fn permissions(self, p: Permissions) -> Encryption
pub fn permissions(self, p: Permissions) -> Encryption
what the user password allows
Sourcepub fn encrypt_metadata(self, on: bool) -> Encryption
pub fn encrypt_metadata(self, on: bool) -> Encryption
whether the XMP metadata is encrypted too (true)
Sourcepub fn with_seed(self, seed: [u8; 32]) -> Encryption
pub fn with_seed(self, seed: [u8; 32]) -> Encryption
the bytes the key, the salts and the file ID come from (instead of the system’s random numbers): the same document and the same seed give the same file. Keep it as secret as a key, random, and fresh for each encryption (a seed used again when the passwords change keeps the old key): who knows the seed can decrypt without a password. Fixed seeds are for reproducible output such as tests
pub fn cipher(&self) -> Cipher
Trait Implementations§
Source§impl Clone for Encryption
impl Clone for Encryption
Source§impl Debug for Encryption
impl Debug for Encryption
impl Eq for Encryption
Source§impl PartialEq for Encryption
impl PartialEq for Encryption
impl StructuralPartialEq for Encryption
Auto Trait Implementations§
impl Forget for Encryption
impl Freeze for Encryption
impl Move for Encryption
impl RefUnwindSafe for Encryption
impl Send for Encryptionwhere
RawVecInner: Send,
impl Sync for Encryptionwhere
RawVecInner: Sync,
impl Unpin for Encryption
impl UnsafeUnpin for Encryption
impl UnwindSafe for Encryptionwhere
RawVecInner: UnwindSafe,
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