# StandardSecurityHandler

## Content

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

***

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

# Abstract Class: StandardSecurityHandler

Defines base class for Standard Security Handlers.
These security handlers allow access permissions and up to two passwords to be specified for a document:
an owner password and a user password.

## Extends

- [`SecurityHandlerBase`](SecurityHandlerBase)

## Extended by

- [`StandardSecurityHandlerRev2`](StandardSecurityHandlerRev2)

## Accessors

### accessType

#### Get Signature

> **get** **accessType**(): [`AccessType`](../enumerations/AccessType) \| `null`

Gets the access type granted by this StandardSecurityHandler, or null.
This property is initialized when a document is loaded.

##### Returns

[`AccessType`](../enumerations/AccessType) \| `null`

***

### id

#### Get Signature

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

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

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

***

### om

#### Get Signature

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

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

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

***

### ownerPassword

#### Get Signature

> **get** **ownerPassword**(): `string`

Gets or sets the password required to change permissions of a PDF document as a string.
The two properties [ownerPassword](#ownerpassword) and [ownerPasswordBytes](#ownerpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdfJS cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using this property.

##### Returns

`string`

#### Set Signature

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

Gets or sets the password required to change permissions of a PDF document as a string.
The two properties [ownerPassword](#ownerpassword) and [ownerPasswordBytes](#ownerpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdfJS cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using this property.

##### Parameters

###### value

`string`

##### Returns

`void`

***

### ownerPasswordBytes

#### Get Signature

> **get** **ownerPasswordBytes**(): `Uint8Array`

Gets or sets the password required to change permissions of a PDF document as a byte array.
The two properties [ownerPassword](#ownerpassword) and [ownerPasswordBytes](#ownerpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdfJS cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using this property.

##### Returns

`Uint8Array`

#### Set Signature

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

Gets or sets the password required to change permissions of a PDF document as a byte array.
The two properties [ownerPassword](#ownerpassword) and [ownerPasswordBytes](#ownerpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdfJS cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using this property.

##### Parameters

###### value

`Uint8Array`

##### Returns

`void`

***

### passwordMatches

#### Get Signature

> **get** **passwordMatches**(): [`PasswordMatches`](../enumerations/PasswordMatches)

Gets a combination of flags that indicate how the password specified
when loading the PDF matches the document's User and Owner passwords.

##### Returns

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

***

### revision

#### Get Signature

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

Gets the revision of this StandardSecurityHandler.

##### Returns

`number`

***

### userPassword

#### Get Signature

> **get** **userPassword**(): `string`

Gets or sets the password required to open a PDF document as a string.
The two properties [userPassword](#userpassword) and [userPasswordBytes](#userpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdf cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using [userPasswordBytes](#userpasswordbytes).

##### Returns

`string`

#### Set Signature

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

Gets or sets the password required to open a PDF document as a string.
The two properties [userPassword](#userpassword) and [userPasswordBytes](#userpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdf cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using [userPasswordBytes](#userpasswordbytes).

##### Parameters

###### value

`string`

##### Returns

`void`

***

### userPasswordBytes

#### Get Signature

> **get** **userPasswordBytes**(): `Uint8Array`

Gets or sets the password required to open a PDF document as a byte array.
The two properties [userPassword](#userpassword) and [userPasswordBytes](#userpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdfJS cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using this property.

##### Returns

`Uint8Array`

#### Set Signature

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

Gets or sets the password required to open a PDF document as a byte array.
The two properties [userPassword](#userpassword) and [userPasswordBytes](#userpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdfJS cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using this property.

##### Parameters

###### value

`Uint8Array`

##### Returns

`void`

## Methods

### assignFrom()

> **assignFrom**(`source`): `void`

Copies all property values from another object.

#### Parameters

##### source

[`SecurityHandlerBase`](SecurityHandlerBase)

The source object.

#### Returns

`void`

#### Inherited from

[`SecurityHandlerBase`](SecurityHandlerBase).[`assignFrom`](SecurityHandlerBase#assignfrom)

***

### clone()

> **clone**(): [`SecurityHandlerBase`](SecurityHandlerBase)

Create copy of this [SecurityHandlerBase](SecurityHandlerBase).

#### Returns

[`SecurityHandlerBase`](SecurityHandlerBase)

The clone of this object.

#### Inherited from

[`SecurityHandlerBase`](SecurityHandlerBase).[`clone`](SecurityHandlerBase#clone)

***

### free()

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

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

#### Returns

`void`

#### Inherited from

[`SecurityHandlerBase`](SecurityHandlerBase).[`free`](SecurityHandlerBase#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

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