pub struct EncryptionDict {
pub o_value: Vec<u8>,
pub u_value: Vec<u8>,
pub oe_value: Option<Vec<u8>>,
pub ue_value: Option<Vec<u8>>,
pub perms_value: Option<Vec<u8>>,
pub p_value: i32,
pub encryption_key: Vec<u8>,
pub key_length: u32,
pub revision: u32,
pub version: u32,
pub algorithm: EncryptionAlgorithm,
}Expand description
Computed encryption dictionary and keys
Fields§
§o_value: Vec<u8>The /O value (owner password hash, 32 bytes for RC4; 48 bytes for AES-256)
u_value: Vec<u8>The /U value (user password hash, 32 bytes for RC4; 48 bytes for AES-256)
oe_value: Option<Vec<u8>>The /OE value (owner key, 32 bytes; AES-256 only)
ue_value: Option<Vec<u8>>The /UE value (user key, 32 bytes; AES-256 only)
perms_value: Option<Vec<u8>>The /Perms value (encrypted permissions, 16 bytes; AES-256 only)
p_value: i32The /P value (permission flags)
encryption_key: Vec<u8>The encryption key (for encrypting streams/strings)
key_length: u32Key length in bits
revision: u32Revision number (2 for RC4-40, 3 for RC4-128, 6 for AES-256)
version: u32Version number (1 for RC4-40, 2 for RC4-128, 5 for AES-256)
algorithm: EncryptionAlgorithmEncryption algorithm
Implementations§
Source§impl EncryptionDict
impl EncryptionDict
Sourcepub fn encrypt_data(&self, data: &[u8], obj_num: u32, gen_num: u16) -> Vec<u8> ⓘ
pub fn encrypt_data(&self, data: &[u8], obj_num: u32, gen_num: u16) -> Vec<u8> ⓘ
Encrypt a PDF stream or string for a specific object
For RC4: derives per-object key (Algorithm 3.1) then RC4-encrypts. For AES-256: encrypts with AES-256-CBC, prepending a 16-byte IV.
Sourcepub fn to_pdf_dict(&self, encrypt_obj_id: usize) -> String
pub fn to_pdf_dict(&self, encrypt_obj_id: usize) -> String
Generate the /Encrypt dictionary PDF object content
Trait Implementations§
Source§impl Clone for EncryptionDict
impl Clone for EncryptionDict
Source§fn clone(&self) -> EncryptionDict
fn clone(&self) -> EncryptionDict
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for EncryptionDict
impl RefUnwindSafe for EncryptionDict
impl Send for EncryptionDict
impl Sync for EncryptionDict
impl Unpin for EncryptionDict
impl UnsafeUnpin for EncryptionDict
impl UnwindSafe for EncryptionDict
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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