Encryption
ComPDFKit_Tools provides document security features, including setting open passwords, permission passwords, and document permission controls.
Entry Configuration
Access encryption settings via the "security" item in the More menu:
{
"toolbarConfig": {
"availableMenus": [
"security"
]
}
}Encryption Types
User Password (Open Password)
Once set, a password is required to open the document:
- Prevents unauthorized users from viewing document content
- Full document access is granted after password verification
Owner Password (Permission Password)
Once set, user operations on the document can be restricted:
- Print permission
- Content copy permission
- Annotation and form fill permission
- Document modification permission
Both user password and owner password can be set simultaneously.
CDocumentEncryptionDialog
CDocumentEncryptionDialog is the main dialog for security settings, located in the com.compdfkit.tools.security.encryption package.
Usage
The encryption dialog is triggered by default via the "security" item in the More menu. It can also be opened programmatically:
CDocumentEncryptionDialog dialog = CDocumentEncryptionDialog.newInstance();
dialog.setDocument(cpdfDocument);
dialog.show(getSupportFragmentManager(), "encryption");val dialog = CDocumentEncryptionDialog.newInstance()
dialog.setDocument(cpdfDocument)
dialog.show(supportFragmentManager, "encryption")Related Components
| Component | Description |
|---|---|
CDocumentEncryptionDialog | Encryption settings dialog |
CInputOwnerPasswordDialog | Owner password input dialog |
Encryption Algorithms
ComPDFKit supports the following encryption algorithms:
| Algorithm | Description |
|---|---|
| RC4 | RC4 encryption |
| AES-128 | 128-bit AES encryption |
| AES-256 | 256-bit AES encryption |
| No Encryption | Remove encryption |
Remove Security Settings
If a document is encrypted, you can select "Remove Security Settings" in the security settings dialog to cancel password protection. The correct owner password must be entered before this operation can be performed.