KeyFactory

Read onlyYes
FinalYes

Table of Contents

Methods

createSharedKeyFromString()  : SharedKey
Creates a SharedKey instance from a given key.
deriveSharedKeyFromEncryptionKey()  : SharedKey
Derives a 32-byte key, based on the existing encryptionKey.
generateSharedKey()  : SharedKey
Generates a SharedKey instance from a random key.

Methods

createSharedKeyFromString()

Creates a SharedKey instance from a given key.

public createSharedKeyFromString(string $key) : SharedKey
Parameters
$key : string
Tags
throws
CipherException
Return values
SharedKey

deriveSharedKeyFromEncryptionKey()

Derives a 32-byte key, based on the existing encryptionKey.

public deriveSharedKeyFromEncryptionKey(string $seed[, int $subKeyId = 1 ]) : SharedKey

The key is supposed to be used in a symmetric XChaCha20-Poly1305 ciphering.

Parameters
$seed : string

(non-secret) value, used to build an 8-byte context (e.g. classname)

$subKeyId : int = 1

variation to the resulting derived key (value from 0 to PHP_INT_MAX)

Tags
throws
CipherException
throws
SodiumException
Return values
SharedKey

        
On this page

Search results