Annotation of embedaddon/php/ext/openssl/tests/025.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: openssl_pkcs7_sign() tests
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("openssl")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7: $infile = dirname(__FILE__) . "/cert.crt";
! 8: $outfile = tempnam("/tmp", "ssl");
! 9: if ($outfile === false)
! 10: die("failed to get a temporary filename!");
! 11:
! 12: $privkey = "file://" . dirname(__FILE__) . "/private.key";
! 13: $single_cert = "file://" . dirname(__FILE__) . "/cert.crt";
! 14: $assoc_headers = array("To" => "test@test", "Subject" => "testing openssl_pkcs7_sign()");
! 15: $headers = array("test@test", "testing openssl_pkcs7_sign()");
! 16: $empty_headers = array();
! 17: $wrong = "wrong";
! 18: $empty = "";
! 19:
! 20: var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $headers));
! 21: var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $assoc_headers));
! 22: var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $empty_headers));
! 23: var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $wrong));
! 24: var_dump(openssl_pkcs7_sign($wrong, $outfile, $single_cert, $privkey, $headers));
! 25: var_dump(openssl_pkcs7_sign($empty, $outfile, $single_cert, $privkey, $headers));
! 26: var_dump(openssl_pkcs7_sign($infile, $empty, $single_cert, $privkey, $headers));
! 27: var_dump(openssl_pkcs7_sign($infile, $outfile, $wrong, $privkey, $headers));
! 28: var_dump(openssl_pkcs7_sign($infile, $outfile, $empty, $privkey, $headers));
! 29: var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $empty));
! 30: var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $wrong, $headers));
! 31:
! 32: if (file_exists($outfile)) {
! 33: echo "true\n";
! 34: unlink($outfile);
! 35: }
! 36: ?>
! 37: --EXPECTF--
! 38: bool(true)
! 39: bool(true)
! 40: bool(true)
! 41:
! 42: Warning: openssl_pkcs7_sign() expects parameter 5 to be array, string given in %s on line %d
! 43: NULL
! 44:
! 45: Warning: openssl_pkcs7_sign(): error opening input file %s in %s on line %d
! 46: bool(false)
! 47:
! 48: Warning: openssl_pkcs7_sign(): error opening input file %s in %s on line %d
! 49: bool(false)
! 50:
! 51: Warning: openssl_pkcs7_sign(): error opening output file %s in %s on line %d
! 52: bool(false)
! 53:
! 54: Warning: openssl_pkcs7_sign(): error getting cert in %s on line %d
! 55: bool(false)
! 56:
! 57: Warning: openssl_pkcs7_sign(): error getting cert in %s on line %d
! 58: bool(false)
! 59:
! 60: Warning: openssl_pkcs7_sign() expects parameter 5 to be array, string given in %s on line %d
! 61: NULL
! 62:
! 63: Warning: openssl_pkcs7_sign(): error getting private key in %s on line %d
! 64: bool(false)
! 65: true
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>