如何使用GSOAP初始化服务器上下文以启用简单身份验证(仅服务器身份验证)

how to initialize server context using gsoap to enable simple authentication (server only authentication)

本文关键字:服务器 身份验证 简单 启用 何使用 GSOAP 初始化 上下文      更新时间:2023-10-16

我有server.pem和server.jks,用于后端,这是我的客户端(soapui(。我初始化SSL Server上下文,以便为我的Web服务提供简单的身份验证,如下:

int ssl_connection_flag = SOAP_SSL_DEFAULT; // Simple authentication
int soap_result = soap_ssl_server_context(soap_object,
                                                ssl_connection_flag,//SOAP_SSL_NO_AUTHENTICATION,//m_ssl_connection_flag,
                                                m_key_file.c_str(),//Settings::instance()->get_cert_mngr_tls_certificate_path().c_str(),//"D:\ICA\Release\currentStore\TLSCertificate.pem",//m_ssl_private_key_file_path.c_str(),/* keyfile: required when server must authenticate to clients (see SSL docs on how to obtain this file) */
                                                l_recover.c_str(),//"changeit",//PWDHelper::instance()->retrieve_pwd("k-tls-key").c_str(),//"changeit",//"12345678",//"server_key_password",/* password to read the key file (not used with GNUTLS) */
                                                m_ca_certs_file.c_str(),//Settings::instance()->get_cert_mngr_ca_path().c_str(),//"D:\ICA\Release\currentStore\CA.pem",//"D:\CertificatBrahim\CAs.pem",//m_ssl_ca_file_path.c_str(), /* optional cacert file to store trusted certificates */                                                 
                                                NULL, /* optional capath to directory with trusted certificates */
                                                NULL,/* DH file name or DH key len bits (minimum is 512, e.g. "512") to generate DH param, if NULL use RSA */
                                                NULL,
                                                NULL);

问题是,当我将我的请求从SOAPUI发送到位于我的服务器的远程PC之后,我在Wireshark中寻找。解码看起来像是正在进行的相互认证。

但是当我更改

soap_ssl_default

soap_ssl_no_authentication

,并发送了相同的请求,在Wireshark中,看起来有一个简单的(唯一的服务器身份验证(。

但这让我感到困惑,因为如果我遵循GSOAP文档,TLS/SSL选项soap_ssl_no_authentication,请禁用客户端和服务器身份验证。

那我的问题是我在做什么错?

预先感谢您的回复。

最好的问候。

服务器端上的SOAP_SSL_NO_AUTHENTICATION标志不会阻止客户端请求服务器进行身份验证。该标志禁用对等验证到请求侧的要求。在您的情况下,客户端是请求侧,标志是在服务器端设置的。