1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! PDF 加密与解密(ISO 32000-1 第 7.6 节及 ISO 32000-2)。
//!
//! 本模块实现**标准安全处理器**(`/Filter /Standard`),
//! 包含两个算法族:
//!
//! - **AES-128**(`/V 4`、`/R 4`):AES-128-CBC,128 位文件加密密钥。
//! - **AES-256**(`/V 5`、`/R 6`):AES-256-CBC,256 位文件加密密钥
//! (ISO 32000-2)。
//!
//! 核心工作——迭代密钥派生(算法 2 / 2.A / 3 / 4 / 5 / 6)、
//! 逐对象密钥计算(算法 1)、透明字符串/流加密、
//! 以及 `/Encrypt` 字典构建——委托给
//! [`lopdf::Document::encrypt`] 和 [`lopdf::Document::decrypt`],
//! 它们完整实现了这些规范算法。
//!
//! # 用法
//!
//! ```no_run
//! use easypdf_core::crypto::{
//! encrypt_pdf, decrypt_pdf, PdfEncryption, PdfEncryptionAlgorithm, PdfPermissions,
//! };
//!
//! let pdf_bytes = std::fs::read("input.pdf").unwrap();
//!
//! // 使用 AES-256 和受限权限加密。
//! let enc = PdfEncryption::new("user", "owner")
//! .with_algorithm(PdfEncryptionAlgorithm::Aes256)
//! .with_permissions(PdfPermissions::PRINT | PdfPermissions::COPY);
//! let encrypted = encrypt_pdf(&pdf_bytes, &enc).unwrap();
//!
//! // 使用用户密码解密。
//! let decrypted = decrypt_pdf(&encrypted, "user").unwrap();
//! ```
// 从 ops 子模块重新导出公共函数。
pub use ;
// 从子模块重新导出公共类型。
pub use EncryptionInfo;
pub use PdfEncryption;
pub use PdfEncryptionAlgorithm;
pub use PdfPermissions;