Skip to content
ComPDF
Guides

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:

json
{
  "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:

java
CDocumentEncryptionDialog dialog = CDocumentEncryptionDialog.newInstance();
dialog.setDocument(cpdfDocument);
dialog.show(getSupportFragmentManager(), "encryption");
kotlin
val dialog = CDocumentEncryptionDialog.newInstance()
dialog.setDocument(cpdfDocument)
dialog.show(supportFragmentManager, "encryption")
ComponentDescription
CDocumentEncryptionDialogEncryption settings dialog
CInputOwnerPasswordDialogOwner password input dialog

Encryption Algorithms

ComPDFKit supports the following encryption algorithms:

AlgorithmDescription
RC4RC4 encryption
AES-128128-bit AES encryption
AES-256256-bit AES encryption
No EncryptionRemove 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.