🎯 Vấn đề cần giải quyết
Gửi hợp đồng PDF cần bảo mật? Muốn share tài liệu nhưng không cho copy text? Cần ngăn người khác print?
Pain points:
- File nhạy cảm dễ bị forward
- Không kiểm soát được ai đọc
- Nội dung bị copy/paste
⚖️ So sánh: Trước và Sau
| Tiêu chí | Không bảo vệ | Có password |
|---|---|---|
| Ai cũng mở được | Có | Không |
| Copy text | Có | Block được |
| Có | Block được |
💡 Prompt mẫu
Bảo vệ file PDF:
INPUT: [file PDF]
PASSWORD PROTECTION:
- Open password: [password để mở]
- Permission password: [password để thay đổi settings]
RESTRICTIONS:
- Printing: Không cho / Low quality only
- Copying text: Không cho
- Editing: Không cho
- Commenting: Cho phép
- Form filling: Cho phép
ENCRYPTION:
- Level: AES-256 (recommended)
OUTPUT:
- Suffix: _protected
🏗️ Phase 2: Architect (Permanent Tool)
For Security Officers.
Engineering Prompt:
**Role:** Python GUI Developer (PyQt6 Specialist)
**Task:** Create "PDF Vault" Desktop App
**Objective:** A security tool to apply encryption and permission restrictions to PDFs.
**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* Crypto: pikepdf (QPDF wrapper) for strong encryption
* Packaging: PyInstaller
**Functional Requirements:**
1. **UI Layout (PyQt6):**
* **Input:** File/Folder List.
* **Credentials:** Fields for "User Password" and "Owner Password".
* **Permissions:** Checkboxes for "Allow Printing", "Allow Copying", "Allow Modifying".
* **Algo:** Radio "AES-128" vs "AES-256".
2. **Core Logic:**
* Iterate inputs and apply `pikepdf.save()` with encryption info.
* Verify password strength (UI feedback).
* **Threading:** Encryption is CPU intensive; runs in background.
3. **Deliverables:**
* `main.py`: Complete source code.
* `requirements.txt`: Dependencies.
* **Build Instructions:**
* Windows: `pyinstaller --onefile --noconsole main.py`
* macOS: `pyinstaller --windowed --noconsole main.py`
🔧 Tips & Best Practices
Two types of passwords
| Type | Purpose |
|---|---|
| Open password | Cần để mở file |
| Permission password | Cần để thay đổi restrictions |
Common restrictions
- No print: Ngăn in
- No copy: Ngăn copy text
- No edit: Ngăn thay đổi nội dung
- No extract: Ngăn extract pages
- No annotate: Ngăn comment
Security levels
| Level | Encryption |
|---|---|
| Low | RC4 40-bit (weak) |
| Medium | RC4 128-bit |
| High | AES-128 |
| Highest | AES-256 ✓ |
⚠️ Limitations
- Password có thể bị crack
- Restrictions có thể bypass
- Screenshot vẫn hoạt động
Độ khó: ⭐ Beginner | Thời gian: 2 phút