bug60632.phpt 749 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Bug #60632: openssl_seal fails with AES
  3. --EXTENSIONS--
  4. openssl
  5. --FILE--
  6. <?php
  7. $pkey = openssl_pkey_new(array(
  8. 'digest_alg' => 'sha256',
  9. 'private_key_bits' => 1024,
  10. 'private_key_type' => OPENSSL_KEYTYPE_RSA,
  11. 'encrypt_key' => false,
  12. 'config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf',
  13. ));
  14. $details = openssl_pkey_get_details($pkey);
  15. $test_pubkey = $details['key'];
  16. $pubkey = openssl_pkey_get_public($test_pubkey);
  17. $encrypted = null;
  18. $ekeys = array();
  19. try {
  20. $result = openssl_seal('test phrase', $encrypted, $ekeys, array($pubkey), 'AES-256-CBC');
  21. } catch (\ValueError $e) {
  22. echo $e->getMessage() . \PHP_EOL;
  23. }
  24. ?>
  25. --EXPECT--
  26. openssl_seal(): Argument #6 ($iv) cannot be null for the chosen cipher algorithm