ssl 用C++创建PKCS10CSR soap消息

ebdffaop  于 2022-11-14  发布在  其他
关注(0)|答案(1)|浏览(140)

我应该给予一个带有soap消息的设备一个签名请求。我在soap中包含了以下消息:http://www.onvif.org/ver10/advancedsecurity/wsdl/advancedsecurity.wsdl,我在Windows x64中使用VS2019构建了我的c++项目。
现在我尝试发送CreatePKCS10CSR,但没有成功。

#include "soapKeystoreBindingProxy.h"
        int CertificateRequest(const char* Country, const char* Province, const char* Locality, const char* Organization, const char* OrganizationalUnit, const char* CommonName, const char* KeyID, const char* SignatureAlgorithm, std::string* Response, int* maxLength)
        {
            deviceKeyStoreBindingProxy = new KeystoreBindingProxy();
        
            soap_register_plugin(deviceKeyStoreBindingProxy, http_da);
            deviceKeyStoreBindingProxy->userid = GetUser();
            deviceKeyStoreBindingProxy->passwd = GetPwd();
            
            //CreatePKCS10CSR
            _tas__CreatePKCS10CSR tas__CreatePKCS10CSR_tmp;
            _tas__CreatePKCS10CSRResponse tas__CreatePKCS10CSRResponse_tmp;
        
            tas__DistinguishedName* Subject_tmp;
            Subject_tmp = new tas__DistinguishedName();
            Subject_tmp->CommonName.push_back(CommonName);
            Subject_tmp->Country.push_back(Country);
            Subject_tmp->StateOrProvinceName.push_back(Province);
            Subject_tmp->Locality.push_back(Locality);
            Subject_tmp->Organization.push_back(Organization);
            Subject_tmp->OrganizationalUnit.push_back(OrganizationalUnit);
        
            tas__CreatePKCS10CSR_tmp.Subject = Subject_tmp;
        
            deviceKeyStoreBindingProxy->CreatePKCS10CSR(&tas__CreatePKCS10CSR_tmp, tas__CreatePKCS10CSRResponse_tmp);
            return 0;
        }

这是我的试验性代码,但它不工作,我没有收到任何回应。你能给予我一个例子,如何处理CreatePKCS10CSR?任何建议,如何调试该代码?

wvt8vs2t

wvt8vs2t1#

这段代码解决了我的问题。在我之前的代码中,我忘记声明远程设备服务的soap端点。我还使用了一种不同的身份验证方法。

deviceKeyStoreBindingProxy = new KeystoreBindingProxy();

soap_register_plugin(deviceKeyStoreBindingProxy, soap_wsse); //NOTE THIS LINE
deviceKeyStoreBindingProxy->send_timeout = 3;
deviceKeyStoreBindingProxy->recv_timeout = 5;
deviceKeyStoreBindingProxy->connect_timeout = 5;

deviceKeyStoreBindingProxy->userid = GetUser();
deviceKeyStoreBindingProxy->passwd = GetPwd();

deviceKeyStoreBindingProxy->soap_endpoint = GetSoapEndpointService(); //NOTE THIS LINE

//CreatePKCS10CSR
_tas__CreatePKCS10CSR tas__CreatePKCS10CSR_tmp;
_tas__CreatePKCS10CSRResponse tas__CreatePKCS10CSRResponse_tmp;

tas__DistinguishedName* Subject_tmp;
Subject_tmp = new tas__DistinguishedName();
Subject_tmp->CommonName.push_back(CommonName);
Subject_tmp->Country.push_back(Country);
Subject_tmp->StateOrProvinceName.push_back(Province);
Subject_tmp->Locality.push_back(Locality);
Subject_tmp->Organization.push_back(Organization);
Subject_tmp->OrganizationalUnit.push_back(OrganizationalUnit);

tas__CreatePKCS10CSR_tmp.Subject = Subject_tmp;

AddUsernameTokenDigest(deviceKeyStoreBindingProxy, NULL, GetUser(), GetPwd(), deltaT);
deviceKeyStoreBindingProxy->CreatePKCS10CSR(&tas__CreatePKCS10CSR_tmp, tas__CreatePKCS10CSRResponse_tmp);

tas__CreatePKCS10CSRResponse_tmp = tas__CreatePKCS10CSRResponse_tmp;

相关问题