You are here

public static function MultiKeyWrapper::reencrypt in Lockr 7.3

Same name and namespace in other branches
  1. 7.2 vendor/lockr/lockr-client/src/KeyWrapper/MultiKeyWrapper.php \Lockr\KeyWrapper\MultiKeyWrapper::reencrypt()

Encrypt the given plaintext reusing state.

Parameters

string $plaintext:

string $wrapping_key:

Return value

array

Overrides KeyWrapperInterface::reencrypt

1 call to MultiKeyWrapper::reencrypt()
Lockr::createSecretValue in vendor/lockr/lockr/src/Lockr.php
Creates a secret value by name.

File

vendor/lockr/lockr/src/KeyWrapper/MultiKeyWrapper.php, line 42

Class

MultiKeyWrapper

Namespace

Lockr\KeyWrapper

Code

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;
}