You are here

public static function LockrAes256CbcSha256KeyWrapper::reencrypt in Lockr 7.3

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

Encrypt the given plaintext reusing state.

Parameters

string $plaintext:

string $wrapping_key:

Return value

array

Overrides KeyWrapperInterface::reencrypt

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

File

vendor/lockr/lockr/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);
}