pub struct PdfEncryption {
pub user_password: String,
pub owner_password: String,
pub algorithm: PdfEncryptionAlgorithm,
pub permissions: PdfPermissions,
}Expand description
PDF 加密配置。
使用构建器方法 with_algorithm 和
with_permissions 进行自定义。默认使用
AES-256 并授予所有权限。
§Examples
use easypdf_core::crypto::{PdfEncryption, PdfEncryptionAlgorithm, PdfPermissions};
let enc = PdfEncryption::new("user", "owner");
assert_eq!(enc.algorithm, PdfEncryptionAlgorithm::Aes256);
let enc = PdfEncryption::new("u", "o")
.with_algorithm(PdfEncryptionAlgorithm::Aes128)
.with_permissions(PdfPermissions::PRINT | PdfPermissions::COPY);
assert_eq!(enc.algorithm, PdfEncryptionAlgorithm::Aes128);Fields§
§user_password: String打开和读取文档所需的密码。
owner_password: String更改权限或移除加密所需的密码。
algorithm: PdfEncryptionAlgorithm要使用的加密算法。
permissions: PdfPermissions用户密码的权限标志。
Implementations§
Source§impl PdfEncryption
impl PdfEncryption
Sourcepub fn with_algorithm(self, algorithm: PdfEncryptionAlgorithm) -> Self
pub fn with_algorithm(self, algorithm: PdfEncryptionAlgorithm) -> Self
设置加密算法。
Sourcepub fn with_permissions(self, permissions: PdfPermissions) -> Self
pub fn with_permissions(self, permissions: PdfPermissions) -> Self
设置权限标志。
Auto Trait Implementations§
impl Freeze for PdfEncryption
impl RefUnwindSafe for PdfEncryption
impl Send for PdfEncryption
impl Sync for PdfEncryption
impl Unpin for PdfEncryption
impl UnsafeUnpin for PdfEncryption
impl UnwindSafe for PdfEncryption
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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