\Drupal\strata\Crypto NullCipher

Stores frames unsealed, for a site that has turned encryption off.

Present so that the encryption setting is a choice of cipher rather than a branch at every call site, and so a frame header always records which cipher wrote it - including "none", which is what lets a store written with encryption off stay readable after it is turned on.

Summary

Methods
Properties
Constants
id
isAvailable
unavailableReason
seal
open
No public properties found
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Methods

id()

id() : string

The stable identifier recorded in a frame header.

Returns

string —

A short lowercase token such as "xchacha20poly1305" or "none".

isAvailable()

isAvailable() : bool

Whether this cipher can run on this host.

Returns

bool —

TRUE when every extension it needs is present.

unavailableReason()

unavailableReason() : string|null

Why the cipher is unavailable, for the settings form and hook_requirements().

Returns

string|null —

A short human-readable reason, or NULL when the cipher is available.

seal()

seal(string  $plain, string  $associated = '') : string

Seals a frame.

Parameters

string $plain

The bytes to seal. An empty string seals to an empty string, so an absent payload never becomes a non-empty frame.

string $associated

Additional authenticated data - bound to the ciphertext but not encrypted. Strata passes the frame's own digest, which is what makes a frame moved to a different key in the bucket fail to open rather than open as the wrong content.

Returns

string —

The sealed bytes, including whatever nonce and tag the implementation needs to open them.

open()

open(string  $sealed, string  $associated = '') : string

Opens a sealed frame.

Parameters

string $sealed

The sealed bytes.

string $associated

The same additional authenticated data used to seal.

Returns

string —

The original bytes.