# Security

## Content

[**DsPdfJS API v9.1.3**](../README)

***

[DsPdfJS API](../globals) / Security

# Class: Security

Provides security and encryption services and manages permissions for 
[PdfDocument](PdfDocument) objects.

## Extends

- [`ObjectBase`](ObjectBase)

## Accessors

### decryptHandler

#### Get Signature

> **get** **decryptHandler**(): [`SecurityHandlerBase`](SecurityHandlerBase) \| `null`

Gets the [SecurityHandlerBase](SecurityHandlerBase) used to decrypt PDF document during loading.

##### Returns

[`SecurityHandlerBase`](SecurityHandlerBase) \| `null`

***

### decryptionStatus

#### Get Signature

> **get** **decryptionStatus**(): [`DecryptionStatus`](../enumerations/DecryptionStatus)

Gets the decryption status of the loaded document.
This property has meaning only if a document has been loaded.

##### Returns

[`DecryptionStatus`](../enumerations/DecryptionStatus)

***

### doc

#### Get Signature

> **get** **doc**(): [`PdfDocument`](PdfDocument)

Gets the [PdfDocument](PdfDocument) object owning this object.

##### Returns

[`PdfDocument`](PdfDocument)

***

### encryptHandler

#### Get Signature

> **get** **encryptHandler**(): [`SecurityHandlerBase`](SecurityHandlerBase) \| `null`

Gets or sets the [SecurityHandlerBase](SecurityHandlerBase) used to encrypt PDF document during saving.
Same [SecurityHandlerBase](SecurityHandlerBase) can not be used for [Security#decryptHandler](#decrypthandler) and
[Security#encryptHandler](#encrypthandler), use [SecurityHandlerBase#clone](SecurityHandlerBase#clone).

##### Returns

[`SecurityHandlerBase`](SecurityHandlerBase) \| `null`

#### Set Signature

> **set** **encryptHandler**(`value`): `void`

Gets or sets the [SecurityHandlerBase](SecurityHandlerBase) used to encrypt PDF document during saving.
Same [SecurityHandlerBase](SecurityHandlerBase) can not be used for [Security#decryptHandler](#decrypthandler) and
[Security#encryptHandler](#encrypthandler), use [SecurityHandlerBase#clone](SecurityHandlerBase#clone).

##### Parameters

###### value

[`SecurityHandlerBase`](SecurityHandlerBase)

##### Returns

`void`

***

### id

#### Get Signature

> **get** **id**(): `number`

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

[`ObjectBase`](ObjectBase).[`id`](ObjectBase#id)

***

### om

#### Get Signature

> **get** **om**(): [`ObjectManager`](ObjectManager)

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

[`ObjectBase`](ObjectBase).[`om`](ObjectBase#om)

## Methods

### free()

> **free**(): `void`

Detaches the object from the [ObjectManager](ObjectManager) and deallocates its memory, if possible.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`free`](ObjectBase#free)

***

### rebind()

> **rebind**(`omTo`): `void`

Rebinds the object from the current [ObjectManager](ObjectManager) to the specified one.

#### Parameters

##### omTo

[`ObjectManager`](ObjectManager)

The new [ObjectManager](ObjectManager) for the object.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`rebind`](ObjectBase#rebind)

***

### setEncryptOptions()

> **setEncryptOptions**(`options`): `void`

Creates the [StandardSecurityHandler](StandardSecurityHandler) object and assigns it to the
[encryptHandler](#encrypthandler) property.
The type and properties of the [StandardSecurityHandler](StandardSecurityHandler) object
is determined by the [.options](#setencryptoptions) object.

#### Parameters

##### options

[`EncryptOptions`](../type-aliases/EncryptOptions)

The [tp.EncryptOptions](../type-aliases/EncryptOptions) object.

#### Returns

`void`
