You are here

public static function LockrAes256CbcSha256KeyWrapper::reencrypt in Lockr 7.2

Same name and namespace in other branches
  1. 7.3 vendor/lockr/lockr/src/KeyWrapper/LockrAes256CbcSha256KeyWrapper.php \Lockr\KeyWrapper\LockrAes256CbcSha256KeyWrapper::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

File

vendor/lockr/lockr-client/src/KeyWrapper/LockrAes256CbcSha256KeyWrapper.php, line 35

Class

LockrAes256CbcSha256KeyWrapper

Namespace

Lockr\KeyWrapper

Code

public static function reencrypt($plaintext, $wrapping_key) {
  $wrapping_key = substr($wrapping_key, strlen(self::PREFIX));
  $wrapping_key = base64_decode($wrapping_key);
  $iv = random_bytes(self::IV_LEN);
  return self::doEncrypt($plaintext, $wrapping_key, $iv);
}