2014-10-18 37 views

回答

0

代理類提供憑證檔案錯誤和ssl_flag,所以我們可以把一個驗證這樣的HTTPS證書的證書:

BindingProxy *Service = new BindingPRoxy(); 
Service->cafile = "C:\\Users\\Machinename\\Desktop\\ca.cer"; 
Service->ssl_flags = SOAP_SSL_DEFAULT; 

這將驗證SSL證書。

0

請參考安裝目錄中的gsoap示例程序。你可以在這個問題上找到更多的細節。

if (soap_ssl_client_context(&soap, 
    /* SOAP_SSL_NO_AUTHENTICATION, */ /* for encryption w/o authentication */ 
    /* SOAP_SSL_DEFAULT | SOAP_SSL_SKIP_HOST_CHECK, */ /* if we don't want the host name checks since these will change from machine to machine */ 
    SOAP_SSL_DEFAULT, /* use SOAP_SSL_DEFAULT in production code */ 
    NULL,  /* keyfile (cert+key): required only when client must authenticate to server (see SSL docs to create this file) */ 
    NULL,  /* password to read the keyfile */ 
    "cacert.pem", /* optional cacert file to store trusted certificates, use cacerts.pem for all public certificates issued by common CAs */ 
    NULL,  /* optional capath to directory with trusted certificates */ 
    NULL  /* if randfile!=NULL: use a file with random data to seed randomness */ 
)) 
    { soap_print_fault(&soap, stderr); 
    exit(1); 
    } 
相關問題