You are here

public static function MultiKeyWrapper::reencrypt in Lockr 7.2

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

Encrypt the given plaintext using the same initial state as defined by encoded.

Parameters

string $plaintext:

string $encoded:

Return value

array

Overrides KeyWrapperInterface::reencrypt

1 call to MultiKeyWrapper::reencrypt()
KeyClient::set in vendor/lockr/lockr-client/src/KeyClient.php
Sets a key in Lockr.

File

vendor/lockr/lockr-client/src/KeyWrapper/MultiKeyWrapper.php, line 59

Class

MultiKeyWrapper

Namespace

Lockr\KeyWrapper

Code

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