You are here

public static function LockrAes256CbcSha256RawKeyWrapper::encrypt in Lockr 7.3

Encrypt the given plaintext.

Parameters

string $plaintext:

string|null $key:

Return value

array

Overrides KeyWrapperInterface::encrypt

3 calls to LockrAes256CbcSha256RawKeyWrapper::encrypt()
LockrAes256CbcSha256KeyWrapperTest::testUpgradedData in vendor/lockr/lockr/tests/KeyWrapper/LockrAes256CbcSha256KeyWrapperTest.php
LockrAes256CbcSha256RawKeyWrapperTest::testEncryptsData in vendor/lockr/lockr/tests/KeyWrapper/LockrAes256CbcSha256RawKeyWrapperTest.php
LockrAes256CbcSha256RawKeyWrapperTest::testReencryptsData in vendor/lockr/lockr/tests/KeyWrapper/LockrAes256CbcSha256RawKeyWrapperTest.php

File

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

Class

LockrAes256CbcSha256RawKeyWrapper

Namespace

Lockr\KeyWrapper

Code

public static function encrypt($plaintext, $key = null) {
  if (is_null($key)) {
    $key = random_bytes(self::KEY_LEN);
  }
  $iv = random_bytes(self::IV_LEN);
  return self::doEncrypt($plaintext, $key, $iv);
}