Enum EncryptionVersion

Source
pub enum EncryptionVersion<'a> {
    V1 {
        document: &'a Document,
        owner_password: &'a str,
        user_password: &'a str,
        permissions: Permissions,
    },
    V2 {
        document: &'a Document,
        owner_password: &'a str,
        user_password: &'a str,
        key_length: usize,
        permissions: Permissions,
    },
    V4 {
        document: &'a Document,
        encrypt_metadata: bool,
        crypt_filters: BTreeMap<Vec<u8>, Arc<dyn CryptFilter>>,
        stream_filter: Vec<u8>,
        string_filter: Vec<u8>,
        owner_password: &'a str,
        user_password: &'a str,
        permissions: Permissions,
    },
    R5 {
        encrypt_metadata: bool,
        crypt_filters: BTreeMap<Vec<u8>, Arc<dyn CryptFilter>>,
        file_encryption_key: &'a [u8],
        stream_filter: Vec<u8>,
        string_filter: Vec<u8>,
        owner_password: &'a str,
        user_password: &'a str,
        permissions: Permissions,
    },
    V5 {
        encrypt_metadata: bool,
        crypt_filters: BTreeMap<Vec<u8>, Arc<dyn CryptFilter>>,
        file_encryption_key: &'a [u8],
        stream_filter: Vec<u8>,
        string_filter: Vec<u8>,
        owner_password: &'a str,
        user_password: &'a str,
        permissions: Permissions,
    },
}

Variants§

§

V1

(PDF 1.4; deprecated in PDF 2.0) Indicates the use of encryption of data using the RC4 or AES algorithms with a file encryption key length of 40 bits.

Fields

§document: &'a Document
§owner_password: &'a str
§user_password: &'a str
§permissions: Permissions
§

V2

(PDF 1.4; deprecated in PDF 2.0) Indicates the use of encryption of data using the RC4 or AES algorithms but permitting file encryption key lengths greater or 40 bits.

Fields

§document: &'a Document
§owner_password: &'a str
§user_password: &'a str
§key_length: usize
§permissions: Permissions
§

V4

(PDF 1.5; deprecated in PDF 2.0) The security handler defines the use of encryption and decryption in the document, using the rules specified by the CF, StmF and StrF entries using encryption of data using the RC4 or AES algorithms (deprecated in PDF 2.0) with a file encryption key length of 128 bits.

Fields

§document: &'a Document
§encrypt_metadata: bool
§crypt_filters: BTreeMap<Vec<u8>, Arc<dyn CryptFilter>>
§stream_filter: Vec<u8>
§string_filter: Vec<u8>
§owner_password: &'a str
§user_password: &'a str
§permissions: Permissions
§

R5

👎Deprecated: R5 is a proprietary Adobe extension and should not be used in newly produced documents other than for testing purposes.

(PDF 2.0; deprecated in PDF 2.0) Shall not be used. This value was used by a deprecated proprietary Adobe extension.

This exists for testing purposes to guarantee improved compatibility.

Fields

§encrypt_metadata: bool
👎Deprecated: R5 is a proprietary Adobe extension and should not be used in newly produced documents other than for testing purposes.
§crypt_filters: BTreeMap<Vec<u8>, Arc<dyn CryptFilter>>
👎Deprecated: R5 is a proprietary Adobe extension and should not be used in newly produced documents other than for testing purposes.
§file_encryption_key: &'a [u8]
👎Deprecated: R5 is a proprietary Adobe extension and should not be used in newly produced documents other than for testing purposes.
§stream_filter: Vec<u8>
👎Deprecated: R5 is a proprietary Adobe extension and should not be used in newly produced documents other than for testing purposes.
§string_filter: Vec<u8>
👎Deprecated: R5 is a proprietary Adobe extension and should not be used in newly produced documents other than for testing purposes.
§owner_password: &'a str
👎Deprecated: R5 is a proprietary Adobe extension and should not be used in newly produced documents other than for testing purposes.
§user_password: &'a str
👎Deprecated: R5 is a proprietary Adobe extension and should not be used in newly produced documents other than for testing purposes.
§permissions: Permissions
👎Deprecated: R5 is a proprietary Adobe extension and should not be used in newly produced documents other than for testing purposes.
§

V5

(PDF 2.0) The security handler defines the use of encryption and decryption in the document, using the rules specified by the CF, StmF, StrF and EFF entries using encryption of data using the AES algorithms with a file encryption key length of 256 bits.

Fields

§encrypt_metadata: bool
§crypt_filters: BTreeMap<Vec<u8>, Arc<dyn CryptFilter>>
§file_encryption_key: &'a [u8]
§stream_filter: Vec<u8>
§string_filter: Vec<u8>
§owner_password: &'a str
§user_password: &'a str
§permissions: Permissions

Trait Implementations§

Source§

impl<'a> Clone for EncryptionVersion<'a>

Source§

fn clone(&self) -> EncryptionVersion<'a>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for EncryptionVersion<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl TryFrom<EncryptionVersion<'_>> for EncryptionState

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from( version: EncryptionVersion<'_>, ) -> Result<EncryptionState, <EncryptionState as TryFrom<EncryptionVersion<'_>>>::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'a> Freeze for EncryptionVersion<'a>

§

impl<'a> !RefUnwindSafe for EncryptionVersion<'a>

§

impl<'a> Send for EncryptionVersion<'a>

§

impl<'a> Sync for EncryptionVersion<'a>

§

impl<'a> Unpin for EncryptionVersion<'a>

§

impl<'a> !UnwindSafe for EncryptionVersion<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V