Menu

## IKickassCrypto
in

IKickassCrypto.php : 39

2023-04-05 jj5 - the IKickassCrypto interface is the interface provided by an encryption service. You can use the framework to create your own encryption services or you can use one (or more) of the four encryption services provided by this library.

2023-04-05 jj5 - the four encryption services provided by this library are:

- KickassCrypto\OpenSsl\KickassOpenSslAtRest
- KickassCrypto\OpenSsl\KickassOpenSslRoundTrip
- KickassCrypto\Sodium\KickassSodiumAtRest
- KickassCrypto\Sodium\KickassSodiumRoundTrip

### Table of Contents

clear_error() : void
  2023-04-03 jj5 - this will clear the current error list.
decrypt() : mixed
  2023-04-03 jj5 - this will decrypt the ciphertext and decode it as JSON; returns false on error.
delay() : void
  2023-04-03 jj5 - this will sleep for a random amount of time, from 1 millisecond to 10 seconds; this is called automatically on the first error as a mitigation against timing attacks.
encrypt() : mixed
  2023-04-03 jj5 - this will JSON encode the input and encrypt the result; returns false on error.
get_error() : string|null
  2023-04-03 jj5 - the most recent error; this is a string or null if no errors.
get_error_list() : array<string|int, mixed>
  2023-04-03 jj5 - the list of errors which have happened since the last time clear_error() was called.

### Methods

#### clear_error()

IKickassCrypto.php : 61

2023-04-03 jj5 - this will clear the current error list.

`public clear_error() : void`

##### Return values

void —

#### decrypt()

IKickassCrypto.php : 84

2023-04-03 jj5 - this will decrypt the ciphertext and decode it as JSON; returns false on error.

`public decrypt(string $ciphertext) : mixed`

##### Parameters

$ciphertext : string

  the ciphertext previously generated by encrypt().

##### Return values

mixed —

the deserialized decrypted value or false on error.

#### delay()

IKickassCrypto.php : 93

2023-04-03 jj5 - this will sleep for a random amount of time, from 1 millisecond to 10 seconds; this is called automatically on the first error as a mitigation against timing attacks.

`public delay() : void`

##### Return values

void —

#### encrypt()

IKickassCrypto.php : 74

2023-04-03 jj5 - this will JSON encode the input and encrypt the result; returns false on error.

`public encrypt(mixed $input) : mixed`

##### Parameters

$input : mixed

  the data you wish to encrypt, complex types accepted but decryption fidelity will depend on the data encoding format. The default data encoding format is JSON, but PHPS (PHP serialization) will give you better fidelity. PHPS support is not enabled by default however because deserialization might lead to code execution vulnerabilities.

##### Return values

mixed —

the encrypted serialized value or false on error.

#### get_error()

IKickassCrypto.php : 54

2023-04-03 jj5 - the most recent error; this is a string or null if no errors.

`public get_error() : string|null`

##### Return values

string|null —

the most recent error message or null if none.

#### get_error_list()

IKickassCrypto.php : 47

2023-04-03 jj5 - the list of errors which have happened since the last time clear_error() was called.

`public get_error_list() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

the list of error messages, if any.

## Search results