class SodiumCipher implements CipherInterface

JCrypt cipher for sodium algorithm encryption, decryption and key generation.

Methods

string
decrypt( string $data, Key $key)

Method to decrypt a data string.

string
encrypt( string $data, Key $key)

Method to encrypt a data string.

Key
generateKey( array $options = array())

Method to generate a new encryption key object.

void
setNonce( string $nonce)

Set the nonce to use for encrypting/decrypting messages

Details

string decrypt( string $data, Key $key)

Method to decrypt a data string.

Parameters

string $data The encrypted string to decrypt.
Key $key The key[/pair] object to use for decryption.

Return Value

string The decrypted data string.

Exceptions

RuntimeException

string encrypt( string $data, Key $key)

Method to encrypt a data string.

Parameters

string $data The data string to encrypt.
Key $key The key[/pair] object to use for encryption.

Return Value

string The encrypted data string.

Exceptions

RuntimeException

Key generateKey( array $options = array())

Method to generate a new encryption key object.

Parameters

array $options Key generation options.

Return Value

Key

Exceptions

RuntimeException

void setNonce( string $nonce)

Set the nonce to use for encrypting/decrypting messages

Parameters

string $nonce The message nonce

Return Value

void