Annotation of embedaddon/php/ext/openssl/tests/022.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: openssl_csr_export() tests
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("openssl")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7: $wrong = "wrong";
! 8:
! 9: $dn = array(
! 10: "countryName" => "BR",
! 11: "stateOrProvinceName" => "Rio Grande do Sul",
! 12: "localityName" => "Porto Alegre",
! 13: "commonName" => "Henrique do N. Angelo",
! 14: "emailAddress" => "hnangelo@php.net"
! 15: );
! 16:
! 17: $args = array(
! 18: "digest_alg" => "sha1",
! 19: "private_key_bits" => 2048,
! 20: "private_key_type" => OPENSSL_KEYTYPE_DSA,
! 21: "encrypt_key" => true
! 22: );
! 23:
! 24: $privkey = openssl_pkey_new();
! 25: $csr = openssl_csr_new($dn, $privkey, $args);
! 26: var_dump(openssl_csr_export($csr, $output));
! 27: var_dump(openssl_csr_export($wrong, $output));
! 28: var_dump(openssl_csr_export($privkey, $output));
! 29: var_dump(openssl_csr_export(array(), $output));
! 30: var_dump(openssl_csr_export($csr, $output, false));
! 31: ?>
! 32: --EXPECTF--
! 33: bool(true)
! 34:
! 35: Warning: openssl_csr_export() expects parameter 1 to be resource, string given in %s on line %d
! 36: NULL
! 37:
! 38: Warning: openssl_csr_export(): supplied resource is not a valid OpenSSL X.509 CSR resource in %s on line %d
! 39:
! 40: Warning: openssl_csr_export(): cannot get CSR from parameter 1 in %s on line %d
! 41: bool(false)
! 42:
! 43: Warning: openssl_csr_export() expects parameter 1 to be resource, array given in %s on line %d
! 44: NULL
! 45: bool(true)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>