I encrypted a text using a key and would like to understand this method if it is vulnerable or not.
Could you tell me if it's easy to decrypt, what methods exist and if maybe I should change the encryption method?
$text = "Hello this is my word";
$method = "aes-256-ecb";
$ivlen = openssl_cipher_iv_length($method);
$iv = openssl_random_pseudo_bytes($ivlen);
$secretKey= "abcdefghilmnop10032001";
$encrypted = openssl_encrypt($text, $method, $secretKey, $options=0, $iv);
$decrypted = openssl_decrypt($encrypted, $method, $secretKey, $options=0, $iv);
print_r($encrypted);
print_r('<br>');
print_r($decrypted);
The encrypted text is:
Ad4jgTNQlNiSBXGidMoAPZeJkUAxQrYPYKHwc9/80Z0=
Besides with openssl_encrypt is possible to have a salt and so ever a different encrypted text (also if text doesn't change)?
aes-256-ecbis considered secure and not a general is encryption secure kind of question. I would say this question is probably better suited for Information security however I am willing to bet it's probably already been answered thereopenssl_encrypt($salt . $text, ...).