MCPcopy Create free account
hub / github.com/error311/FileRise / encryptForTest

Function encryptForTest

tests/security/auth_security_regressions.php:18–25  ·  view source on GitHub ↗
(string $data, string $key)

Source from the content-addressed store, hash-verified

16putenv('FR_TEST_USERS_DIR=' . $usersDir);
17
18function encryptForTest(string $data, string $key): string
19{
20 $cipher = 'AES-256-CBC';
21 $ivlen = openssl_cipher_iv_length($cipher);
22 $iv = openssl_random_pseudo_bytes($ivlen);
23 $ct = openssl_encrypt($data, $cipher, $key, OPENSSL_RAW_DATA, $iv);
24 return base64_encode($iv . $ct);
25}
26
27function decryptForTest(string $data, string $key): string
28{

Callers 1

writeEncryptedJsonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected