class FileBasedSimpleKeyService (View source)

File based simple encrypted key service

Constants

PATTERN_KEYNAME

Pattern a key name must match.

Properties

protected string $passwordHashingStrategy
protected int $passwordGenerationLength
protected HashService $hashService

Methods

void
injectSettings(array $settings)

No description

string
generateKey(string $name)

Generates a new key & saves it encrypted with a hashing strategy

void
storeKey(string $name, string $password)

Saves a key encrypted with a hashing strategy

bool
keyExists(string $name)

Checks if a key exists

bool
getKey(string $name)

Returns a key by its name

void
persistKey(string $name, string $password)

Persists a key to the file system

string
getKeyPathAndFilename(string $name)

Returns the path and filename for the key with the given name.

string
checkKeyName(string $name)

Checks if the given key name is valid amd returns it (unchanged) if yes. Otherwise it throws an exception.

string
getPath()

Helper function to get the base path for key storage.

Details

void injectSettings(array $settings)

No description

Parameters

array $settings

Return Value

void

string generateKey(string $name)

Generates a new key & saves it encrypted with a hashing strategy

Parameters

string $name

Return Value

string

Exceptions

Exception

void storeKey(string $name, string $password)

Saves a key encrypted with a hashing strategy

Parameters

string $name
string $password

Return Value

void

Exceptions

Exception

bool keyExists(string $name)

Checks if a key exists

Parameters

string $name

Return Value

bool

Exceptions

Exception

bool getKey(string $name)

Returns a key by its name

Parameters

string $name

Return Value

bool

Exceptions

Exception

protected void persistKey(string $name, string $password)

Persists a key to the file system

Parameters

string $name
string $password

Return Value

void

Exceptions

Exception

protected string getKeyPathAndFilename(string $name)

Returns the path and filename for the key with the given name.

Parameters

string $name

Return Value

string

protected string checkKeyName(string $name)

Checks if the given key name is valid amd returns it (unchanged) if yes. Otherwise it throws an exception.

Parameters

string $name

Return Value

string

Exceptions

Exception

protected string getPath()

Helper function to get the base path for key storage.

Return Value

string