【问题标题】:CreatePKCS10CSR soap message in c++在 C++ 中创建PKCS10CSR 肥皂消息
【发布时间】:2022-09-27 21:45:16
【问题描述】:

我应该向带有肥皂消息的设备发出签名请求。我在我的肥皂中包含了以下信息: 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 的例子吗? 任何建议如何调试该代码?

    标签: c++ ssl soap certificate-signing-request


    【解决方案1】:

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

    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;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多