SecretBox
in package
Class SecretBox.
Table of Contents
- $key : string
- $nonce : string
- __construct() : mixed
- SecretBox constructor.
- decrypt() : false|string
- Decrypts a secret box message ciphertext.
- encrypt() : string
- Encrypts a secret box message.
- makeKey() : string
- Makes a secret box key.
- makeNonce() : string
- Makes a secret box nonce with the correct length.
- validatedLengths() : void
- Validates key and nonce.
Properties
$key
protected
string
$key
$nonce
protected
string
$nonce
Methods
__construct()
SecretBox constructor.
public
__construct(string $key, string $nonce) : mixed
Parameters
- $key : string
- $nonce : string
Tags
Return values
mixed —decrypt()
Decrypts a secret box message ciphertext.
public
decrypt(string $ciphertext) : false|string
Parameters
- $ciphertext : string
Tags
Return values
false|string —encrypt()
Encrypts a secret box message.
public
encrypt(string $message) : string
Parameters
- $message : string
Tags
Return values
string —makeKey()
Makes a secret box key.
public
static makeKey() : string
Return values
string —makeNonce()
Makes a secret box nonce with the correct length.
public
static makeNonce() : string
Tags
Return values
string —validatedLengths()
Validates key and nonce.
protected
validatedLengths(string $key, string $nonce) : void
Parameters
- $key : string
- $nonce : string