openssl_open_basic.phpt 844 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. openssl_open() tests
  3. --EXTENSIONS--
  4. openssl
  5. --FILE--
  6. <?php
  7. $data = "openssl_open() test";
  8. $pub_key = "file://" . __DIR__ . "/public.key";
  9. $priv_key = "file://" . __DIR__ . "/private_rsa_1024.key";
  10. $wrong = "wrong";
  11. $method = "AES-128-ECB";
  12. openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key, $pub_key), $method);
  13. openssl_open($sealed, $output, $ekeys[0], $priv_key, $method);
  14. var_dump($output);
  15. openssl_open($sealed, $output2, $ekeys[1], $wrong, $method);
  16. var_dump($output2);
  17. openssl_open($sealed, $output3, $ekeys[2], $priv_key, $method);
  18. var_dump($output3);
  19. openssl_open($sealed, $output4, $wrong, $priv_key, $method);
  20. var_dump($output4);
  21. ?>
  22. --EXPECTF--
  23. string(19) "openssl_open() test"
  24. Warning: openssl_open(): Unable to coerce parameter 4 into a private key in %s on line %d
  25. NULL
  26. string(19) "openssl_open() test"
  27. NULL