pssht
latest
SSH server library written in PHP
|
Public Member Functions | |
__clone () | |
Prevent cloning of the singleton. | |
getAlgorithms ($type) | |
getClass ($type, $name) | |
getClasses ($type) | |
register ($type, $class) | |
restore ($type, $name) | |
unregister ($type, $name) | |
Static Public Member Functions | |
static | factory () |
static | sortAlgorithms ($a, $b) |
Protected Member Functions | |
getValidAlgorithm ($class) | |
getValidClass ($type, $name) | |
Protected Attributes | |
$algos | |
Array with currently available algorithms. | |
$interfaces | |
Mapping between algorithm types and their corresponding interface. | |
$savedAlgos | |
A backup of $algos when it was first populated. | |
Private Member Functions | |
__construct () | |
A singleton that gives access to supported algorithms.
Definition at line 17 of file Algorithms.php.
|
private |
Construct the only instance of this singleton.
Definition at line 31 of file Algorithms.php.
References fpoirotte\Pssht\Algorithms\$algos, fpoirotte\Pssht\Algorithms\getValidAlgorithm(), and fpoirotte\Pssht\Algorithms\getValidClass().
|
static |
Retrieve the singleton.
Algorithms | The singleton. |
Definition at line 105 of file Algorithms.php.
Referenced by fpoirotte\Pssht\Messages\KEX\ECDH\REPLY\RFC5656\__construct(), fpoirotte\Pssht\Transport\__construct(), fpoirotte\Pssht\Authentication\HostBased\authenticate(), fpoirotte\Pssht\Authentication\PublicKey\authenticate(), fpoirotte\Pssht\Authentication\PublicKey\check(), fpoirotte\Pssht\Handlers\KEXINIT\handle(), and fpoirotte\Pssht\Handlers\InitialState\handle().
fpoirotte\Pssht\Algorithms::getAlgorithms | ( | $type | ) |
Get a list of all registered algorithms with the given type.
string | $type | Type of algorithms to retrieve. |
array | A list with the names of all the algorithms currently registered with the given type. |
Definition at line 311 of file Algorithms.php.
fpoirotte\Pssht\Algorithms::getClass | ( | $type, | |
$name | |||
) |
Get the class responsible for providing the algorithm with the given type and name.
string | $type | Type of algorithm to retrieve. |
string | $name | Name of the algorithm. |
string | Full name (with namespace) of the class providing the given algorithm. |
null | No class provides an algorithm with the given type and name. |
Definition at line 356 of file Algorithms.php.
fpoirotte\Pssht\Algorithms::getClasses | ( | $type | ) |
Get a list of all registered classes with the given type.
string | $type | Type of algorithms to retrieve. |
array | A list with the names of the classes currently registered providing algorithms of the given type. |
Definition at line 330 of file Algorithms.php.
|
protected |
Check for valid algorithm names.
string | $class | Name of the class whose algorithm name must be checked. |
string | The class' algorithm name. |
null | No valid algorithm name for the given class. |
Definition at line 195 of file Algorithms.php.
Referenced by fpoirotte\Pssht\Algorithms\__construct(), and fpoirotte\Pssht\Algorithms\register().
|
protected |
Check for valid classnames.
string | $type | Expected type of class (algorithm name). |
string | $name | Name of the class. |
string | Full classname (with namespace). |
null | No valid class found with this type and name. |
Definition at line 129 of file Algorithms.php.
Referenced by fpoirotte\Pssht\Algorithms\__construct().
fpoirotte\Pssht\Algorithms::register | ( | $type, | |
$class | |||
) |
Register a new algorithm.
string | $type | Type of algorithm provided by the class. |
string | object | $class | Class or object that provides the algorithm. |
Algorithms | Returns the singleton. |
Definition at line 229 of file Algorithms.php.
References fpoirotte\Pssht\Algorithms\getValidAlgorithm().
fpoirotte\Pssht\Algorithms::restore | ( | $type, | |
$name | |||
) |
Restore an algorithm.
Reset the class in charge of providing a given algorithm to its initial value.
string | $type | Algorithm type. |
string | $name | Name of the algorithm to restore. |
Algorithms | Returns the singleton. |
Definition at line 289 of file Algorithms.php.
|
static |
Sort algorithms based on preferences.
string | $a | Name of the first algorithm. |
string | $b | Name of the second algorithm. |
int | An integer that is less than zero if the first algorithm should be preferred, equal to zero if both algorithms have the same preference and greater than zero when the second algorithm should be preferred. |
Definition at line 385 of file Algorithms.php.
fpoirotte\Pssht\Algorithms::unregister | ( | $type, | |
$name | |||
) |
Unregister an algorithm.
string | $type | Algorithm type. |
string | $name | Name of the algorithm to unregister. |
Algorithms | Returns the singleton. |
Definition at line 262 of file Algorithms.php.