在c++中创建PKCS10CSR 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的例子吗?有什么关于如何调试代码的建议吗?

这段代码解决了我的问题。在以前的代码中,我忘记声明远程设备服务的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;

最新更新