class MultiKeyWrapper in Lockr 7.3
Same name and namespace in other branches
- 7.2 vendor/lockr/lockr-client/src/KeyWrapper/MultiKeyWrapper.php \Lockr\KeyWrapper\MultiKeyWrapper
 
Hierarchy
- class \Lockr\KeyWrapper\MultiKeyWrapper implements KeyWrapperInterface
 
Expanded class hierarchy of MultiKeyWrapper
File
- vendor/
lockr/ lockr/ src/ KeyWrapper/ MultiKeyWrapper.php, line 4  
Namespace
Lockr\KeyWrapperView source
class MultiKeyWrapper implements KeyWrapperInterface {
  private static $wrappers = [
    LockrAes256CbcSha256RawKeyWrapper::PREFIX => LockrAes256CbcSha256RawKeyWrapper::class,
    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, $key = null) {
    foreach (self::$wrappers as $wrapper) {
      if ($wrapper::enabled()) {
        return $wrapper::encrypt($plaintext, $key);
      }
    }
    return false;
  }
  /**
   * {@inheritdoc}
   */
  public static function reencrypt($plaintext, $wrapping_key) {
    foreach (self::$wrappers as $prefix => $wrapper) {
      if (!$prefix || strpos($wrapping_key, $prefix) === 0) {
        return $wrapper::reencrypt($plaintext, $wrapping_key);
      }
    }
    return false;
  }
  /**
   * {@inheritdoc}
   */
  public static function decrypt($ciphertext, $wrapping_key) {
    foreach (self::$wrappers as $prefix => $wrapper) {
      if (!$prefix || strpos($wrapping_key, $prefix) === 0) {
        return $wrapper::decrypt($ciphertext, $wrapping_key);
      }
    }
    return false;
  }
}Members
| 
            Name | 
                  Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| 
            MultiKeyWrapper:: | 
                  private static | property | ||
| 
            MultiKeyWrapper:: | 
                  public static | function | 
            Decrypt the given ciphertext. 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 reusing state. Overrides KeyWrapperInterface:: |