You are here

protected function KeyClient::reencrypt in Lockr 7

1 call to KeyClient::reencrypt()
KeyClient::set in src/Lockr/KeyClient.php
Sets a key in Lockr.

File

src/Lockr/KeyClient.php, line 122

Class

KeyClient

Namespace

Lockr

Code

protected function reencrypt($plaintext, $encoded) {
  list($cipher, $mode, $iv, $key) = $this
    ->decode($encoded);
  $ciphertext = mcrypt_encrypt($cipher, $key, $plaintext, $mode, $iv);
  $ciphertext = base64_encode($ciphertext);
  $encoded = $this
    ->encode($cipher, $mode, $iv, $key);
  return array(
    $ciphertext,
    $encoded,
  );
}