# Security

## Content

# Class: Security

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

## Extends

- [`ObjectBase`](ObjectBase)

## Accessors

### decryptHandler

#### Get Signature

```ts
get decryptHandler(): SecurityHandlerBase;
```

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

##### Returns

[`SecurityHandlerBase`](SecurityHandlerBase)

***

### decryptionStatus

#### Get Signature

```ts
get decryptionStatus(): 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

```ts
get doc(): PdfDocument;
```

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

##### Returns

[`PdfDocument`](PdfDocument)

***

### encryptHandler

#### Get Signature

```ts
get encryptHandler(): SecurityHandlerBase;
```

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)

#### Set Signature

```ts
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

```ts
get id(): number;
```

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

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

***

### om

#### Get Signature

```ts
get om(): ObjectManager;
```

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

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

## Methods

### free()

```ts
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()

```ts
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()

```ts
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`
