pub struct EncryptionDictionary {Show 17 fields
pub filter: String,
pub sub_filter: Option<String>,
pub v: u32,
pub length: Option<u32>,
pub cf: Option<Vec<CryptFilter>>,
pub stm_f: Option<StreamFilter>,
pub str_f: Option<StringFilter>,
pub ef: Option<String>,
pub r: u32,
pub o: Vec<u8>,
pub u: Vec<u8>,
pub p: Permissions,
pub encrypt_metadata: bool,
pub id: Option<Vec<u8>>,
pub ue: Option<Vec<u8>>,
pub oe: Option<Vec<u8>>,
pub perms: Option<Vec<u8>>,
}Expand description
PDF encryption dictionary
Fields§
§filter: StringFilter (always “Standard” for standard security handler)
sub_filter: Option<String>Sub-filter (for public-key security handlers)
v: u32Algorithm version (1-5)
length: Option<u32>Key length in bytes
cf: Option<Vec<CryptFilter>>Crypt filters
stm_f: Option<StreamFilter>Stream filter
str_f: Option<StringFilter>String filter
ef: Option<String>Identity filter
r: u32Revision number
o: Vec<u8>Owner password hash (32 bytes)
u: Vec<u8>User password hash (32 bytes)
p: PermissionsPermissions
encrypt_metadata: boolWhether to encrypt metadata
id: Option<Vec<u8>>Document ID (first element)
ue: Option<Vec<u8>>UE entry: encrypted file encryption key (user password, R5/R6 only)
oe: Option<Vec<u8>>OE entry: encrypted file encryption key (owner password, R5/R6 only)
perms: Option<Vec<u8>>Perms entry: encrypted permissions verification (R6 only)
Implementations§
Source§impl EncryptionDictionary
impl EncryptionDictionary
Sourcepub fn rc4_40bit(
owner_hash: Vec<u8>,
user_hash: Vec<u8>,
permissions: Permissions,
id: Option<Vec<u8>>,
) -> Self
pub fn rc4_40bit( owner_hash: Vec<u8>, user_hash: Vec<u8>, permissions: Permissions, id: Option<Vec<u8>>, ) -> Self
Create RC4 40-bit encryption dictionary
Sourcepub fn rc4_128bit(
owner_hash: Vec<u8>,
user_hash: Vec<u8>,
permissions: Permissions,
id: Option<Vec<u8>>,
) -> Self
pub fn rc4_128bit( owner_hash: Vec<u8>, user_hash: Vec<u8>, permissions: Permissions, id: Option<Vec<u8>>, ) -> Self
Create RC4 128-bit encryption dictionary
Sourcepub fn aes_128(
owner_hash: Vec<u8>,
user_hash: Vec<u8>,
permissions: Permissions,
id: Option<Vec<u8>>,
) -> Self
pub fn aes_128( owner_hash: Vec<u8>, user_hash: Vec<u8>, permissions: Permissions, id: Option<Vec<u8>>, ) -> Self
Create AES-128 encryption dictionary (V=4, R=4, AESV2 crypt filter)
Per ISO 32000-1 §7.6.1 Table 20: V=4 uses crypt filters to specify the encryption method per stream/string. R=4 is used for AES-128.
Sourcepub fn aes_256(
owner_hash: Vec<u8>,
user_hash: Vec<u8>,
permissions: Permissions,
id: Option<Vec<u8>>,
) -> Self
pub fn aes_256( owner_hash: Vec<u8>, user_hash: Vec<u8>, permissions: Permissions, id: Option<Vec<u8>>, ) -> Self
Create AES-256 encryption dictionary (V=5, R=5, AESV3 crypt filter)
Per ISO 32000-2 §7.6.1: V=5 uses 256-bit AES encryption with crypt filters. R=5 uses the original AES-256 key derivation.
Sourcepub fn with_r5_entries(self, ue: Vec<u8>, oe: Vec<u8>) -> Self
pub fn with_r5_entries(self, ue: Vec<u8>, oe: Vec<u8>) -> Self
Set R5/R6 additional entries (UE, OE) on the encryption dictionary.
Sourcepub fn to_dict(&self) -> Dictionary
pub fn to_dict(&self) -> Dictionary
Convert to PDF dictionary
Trait Implementations§
Source§impl Clone for EncryptionDictionary
impl Clone for EncryptionDictionary
Source§fn clone(&self) -> EncryptionDictionary
fn clone(&self) -> EncryptionDictionary
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more