$aesKey = random_bytes(32); // 256-bit key
$iv = random_bytes(openssl_cipher_iv_length('aes-256-cbc'));
The above code is from PHP, and I need to do the same in React Native. I tried many packages but didn’t get the expected result.
Also, is there any way to get the same logic for the below PHP code in React Native
$encryptedData = openssl_encrypt($data, 'aes-256-cbc', $aesKey, OPENSSL_RAW_DATA, $iv);