Annotation of embedaddon/php/ext/openssl/tests/bug36732.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #36732 (add support for req_extensions in openss_csr_new and sign)
        !             3: --SKIPIF--
        !             4: <?php 
        !             5: if (!extension_loaded("openssl")) die("skip");
        !             6: if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
        !             7: ?>
        !             8: --FILE--
        !             9: <?php 
        !            10: $configargs = array(
        !            11:         "req_extensions" => "v3_req",
        !            12:         "x509_extensions" => "usr_cert",
        !            13:                "config" => __DIR__."/openssl.cnf",
        !            14: );
        !            15: 
        !            16: $dn = array(
        !            17:         "countryName" => "GB",
        !            18:         "stateOrProvinceName" => "Berkshire",
        !            19:         "localityName" => "Newbury",
        !            20:         "organizationName" => "My Company Ltd",
        !            21:         "commonName" => "Demo Cert"
        !            22: );
        !            23: 
        !            24: $key = openssl_pkey_new();
        !            25: $csr = openssl_csr_new($dn, $key, $configargs);
        !            26: $crt = openssl_csr_sign($csr, NULL, $key, 365, $configargs);
        !            27: 
        !            28: $str = '';
        !            29: openssl_csr_export($csr, $str, false);
        !            30: 
        !            31: if (strpos($str, 'Requested Extensions:')) {
        !            32:        echo "Ok\n";
        !            33: }
        !            34: openssl_x509_export($crt, $str, false);
        !            35: if (strpos($str, 'X509v3 extensions:')) {
        !            36:        echo "Ok\n";
        !            37: }
        !            38: ?>
        !            39: --EXPECTF--
        !            40: Ok
        !            41: Ok

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>