Exemple #1
0
/*
 * This test case does a simple cacerts request
 * and looks for the HTTP 200 response code.
 */
static void us901_test5(void) {
    long rv;
    char cmd[200];
    int st_rv;

    st_rv = us901_start_server('D');
    if (st_rv) {
        return;
    }

    LOG_FUNC_NM
    ;

    SLEEP(1);

    outfile = fopen(test5_outfile, "w");
    rv = curl_http_get(US901_CACERT_URL, US901_CACERTS, &write_func);
    fclose(outfile);

    /*
     * we expect the server to respond with a 200
     */
    CU_ASSERT(rv == 200);

    sprintf(cmd,
            "openssl base64 -d -in %s | openssl pkcs7 -inform DER -text -print_certs",
            test5_outfile);
    rv = system(cmd);
    CU_ASSERT(rv == 0);
    st_stop();
    SLEEP(1);
}
Exemple #2
0
/*
 * Test the optional setting of the CA Certs response chain in est_proxy_init()
 * test passthrough (cache disabled) mode of the CA Certs response chain.
 */
static void us894_test26 (void)
{
    long rv;
    char cmd[200];

    LOG_FUNC_NM;
    
    st_proxy_stop();
    sleep(1);

    /*
     * restart the proxy without passing the ca certs response change parameter
     * param 5
     */
    rv = st_proxy_start(US894_TCP_PROXY_PORT, 
                        US894_PROXY_CERT,
                        US894_PROXY_KEY,
                        "estrealm",
                        NULL,
                        "CA/trustedcerts.crt",
                        "estuser",
                        "estpwd",
                        "127.0.0.1",
                        US894_TCP_SERVER_PORT,
                        0,  // disable PoP
                        0);  // ecdhe nid info
    sleep(1);

    outfile = fopen(test26_outfile, "w");
    rv = curl_http_get(US894_CACERT_URL, US894_CACERTS, &write_func);
    fclose(outfile);

    /* 
     * we expect the server to respond with a 200 
     */
    CU_ASSERT(rv == 200);

    sprintf(cmd, "openssl base64 -d -in %s | openssl pkcs7 -inform DER -text -print_certs", test26_outfile);
    rv = system(cmd);
    CU_ASSERT(rv == 0);

    /*
     * restart the proxy and include the CA Cert response chain
     */
    st_proxy_stop();
    sleep(1);
    rv = st_proxy_start(US894_TCP_PROXY_PORT, 
                        US894_PROXY_CERT,
                        US894_PROXY_KEY,
                        "estrealm",
                        US894_CACERT,
                        "CA/trustedcerts.crt",
                        "estuser",
                        "estpwd",
                        "127.0.0.1",
                        US894_TCP_SERVER_PORT,
                        0,  // disable PoP
                        0);  // ecdhe nid info
    sleep(1);
}
Exemple #3
0
/*
 * This test case does a simple cacerts request
 * and looks for the HTTP 200 response code.
 */
static void us894_test5 (void)
{
    long rv;
    char cmd[200];

    LOG_FUNC_NM;
    
    sleep(1);

    outfile = fopen(test5_outfile, "w");
    rv = curl_http_get(US894_CACERT_URL, US894_CACERTS, &write_func);
    fclose(outfile);

    /* 
     * we expect the server to respond with a 200 
     */
    CU_ASSERT(rv == 200);

    sprintf(cmd, "openssl base64 -d -in %s | openssl pkcs7 -inform DER -text -print_certs", test5_outfile);
    rv = system(cmd);
    CU_ASSERT(rv == 0);
}