You are here

public static function LockrAes256CbcSha256RawKeyWrapper::reencrypt in Lockr 7.3

Encrypt the given plaintext reusing state.

Parameters

string $plaintext:

string $wrapping_key:

Return value

array

Overrides KeyWrapperInterface::reencrypt

1 call to LockrAes256CbcSha256RawKeyWrapper::reencrypt()
LockrAes256CbcSha256RawKeyWrapperTest::testReencryptsData in vendor/lockr/lockr/tests/KeyWrapper/LockrAes256CbcSha256RawKeyWrapperTest.php

File

vendor/lockr/lockr/src/KeyWrapper/LockrAes256CbcSha256RawKeyWrapper.php, line 35

Class

LockrAes256CbcSha256RawKeyWrapper

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