class MultiKeyWrapper in Lockr 7.2
Same name and namespace in other branches
- 7.3 vendor/lockr/lockr/src/KeyWrapper/MultiKeyWrapper.php \Lockr\KeyWrapper\MultiKeyWrapper
Hierarchy
- class \Lockr\KeyWrapper\MultiKeyWrapper implements KeyWrapperInterface
Expanded class hierarchy of MultiKeyWrapper
1 file declares its use of MultiKeyWrapper
- KeyClient.php in vendor/
lockr/ lockr-client/ src/ KeyClient.php
File
- vendor/
lockr/ lockr-client/ src/ KeyWrapper/ MultiKeyWrapper.php, line 6
Namespace
Lockr\KeyWrapperView source
class MultiKeyWrapper implements KeyWrapperInterface {
protected static $wrappers = array(
LockrAes256CbcSha256KeyWrapper::PREFIX => LockrAes256CbcSha256KeyWrapper::class,
LockrAes128CtrSha256KeyWrapper::PREFIX => LockrAes128CtrSha256KeyWrapper::class,
'' => LockrAesCbcKeyWrapper::class,
);
/**
* {@inheritdoc}
*/
public static function enabled() {
foreach (self::$wrappers as $wrapper) {
if ($wrapper::enabled()) {
return true;
}
}
return false;
}
/**
* {@inheritdoc}
*/
public static function encrypt($plaintext) {
foreach (self::$wrappers as $wrapper) {
if ($wrapper::enabled()) {
return $wrapper::encrypt($plaintext);
}
}
return false;
}
/**
* {@inheritdoc}
*/
public static function decrypt($ciphertext, $encoded) {
foreach (self::$wrappers as $prefix => $wrapper) {
if (substr($encoded, 0, strlen($prefix)) === $prefix) {
return $wrapper::decrypt($ciphertext, $encoded);
}
}
return false;
}
/**
* {@inheritdoc}
*/
public static function reencrypt($plaintext, $encoded) {
foreach (self::$wrappers as $prefix => $wrapper) {
if (substr($encoded, 0, strlen($prefix)) === $prefix) {
return $wrapper::reencrypt($plaintext, $encoded);
}
}
return false;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MultiKeyWrapper:: |
protected static | property | ||
MultiKeyWrapper:: |
public static | function |
Decrypt the given ciphertext using encoded. Overrides KeyWrapperInterface:: |
|
MultiKeyWrapper:: |
public static | function |
Overrides KeyWrapperInterface:: |
|
MultiKeyWrapper:: |
public static | function |
Encrypt the given plaintext. Overrides KeyWrapperInterface:: |
|
MultiKeyWrapper:: |
public static | function |
Encrypt the given plaintext using the same initial state as
defined by encoded. Overrides KeyWrapperInterface:: |