---
Product: Aspose.PDF
Platform: net
Page Type: reference
Canonical URL: https://reference.aspose.org/pdf/net/ICustomSecurityHandler
---

# ICustomSecurityHandler

## Overview

`ICustomSecurityHandler` is a interface in Aspose.PDF FOSS for .NET.

Pluggable custom security handler — implement this to handle non-Standard /Filter entries (e.g.

This interface provides 9 methods for working with ICustomSecurityHandler objects in .NET programs.
Available methods include: `CalculateEncryptionKey`, `Decrypt`, `Encrypt`, `EncryptPermissions`, `GetOwnerKey`, `GetUserKey`, `Initialize`, `IsOwnerPassword`, `IsUserPassword`.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `Filter`, `KeyLength`, `Revision`, `SubFilter`, `Version`.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Filter` | `string` | Read | /Filter entry the handler is registered as. |
| `SubFilter` | `string` | Read | /SubFilter entry the handler is registered as. |
| `Version` | `int` | Read | Algorithm version (PDF /Encrypt /V). |
| `Revision` | `int` | Read | Standard handler revision (PDF /Encrypt /R) reported by the handler for emitted encryption dictionaries. |
| `KeyLength` | `int` | Read | Key length in bits. |

## Methods

| Signature | Description |
|-----------|-------------|
| `Initialize(parameters: EncryptionParameters)` | Initialise the handler from parsed /Encrypt parameters. |
| `CalculateEncryptionKey(password: string)` | Derive the per-document encryption key from the user password. |
| `GetUserKey(userPassword: string)` | Compute the /U value for the given user password. |
| `GetOwnerKey(userPassword: string, ownerPassword: string)` | Compute the /O value for the given user/owner password pair. |
| `IsOwnerPassword(password: string)` | Return true when password matches the owner password. |
| `IsUserPassword(password: string)` | Return true when password matches the user password. |
| `EncryptPermissions(permissions: int)` | Encrypt the /Perms byte string for the given permissions (revision 5+). |
| `Encrypt(data: byte[], objectNumber: int, generation: int, key: byte[])` | Encrypt one PDF object's content stream / string with the per-object key derived from key + objectNumber + generation. |
| `Decrypt(data: byte[], objectNumber: int, generation: int, key: byte[])` | Inverse of Encrypt. |

## See Also

- [Aspose.PDF for .NET — Enterprise API Reference](https://reference.aspose.com/pdf/net/)