SSL communication to support CA Certificate(Public key certificate)

112 Views Asked by At

For the SSL communication with the certificate for the below C/C++ code link how to support the CA certificate (public key certificate which is exported from the site info)

HttpClientWithSslAndClientCert

WS_SSL_TRANSPORT_SECURITY_BINDING sslBinding = {}; // zero out the struct
sslBinding.binding.bindingType = WS_SSL_TRANSPORT_SECURITY_BINDING_TYPE; // set the binding type

// Set up the client certificate. The certificate must have been registered beforehand.
static const WS_STRING certStore = WS_STRING_VALUE(L"My");
static const WS_STRING certSubjectName = WS_STRING_VALUE(L"CN=client.com");

WS_SUBJECT_NAME_CERT_CREDENTIAL certBySubject;
certBySubject.credential.credentialType = WS_SUBJECT_NAME_CERT_CREDENTIAL_TYPE;
certBySubject.storeLocation = CERT_SYSTEM_STORE_CURRENT_USER;
certBySubject.storeName = certStore;
certBySubject.subjectName = certSubjectName;
sslBinding.localCertCredential = &certBySubject.credential;

// declare and initialize the array of all security bindings
WS_SECURITY_BINDING* securityBindings[1] = { &sslBinding.binding };

For the above sample code with my CA certificate (Public key certificate exported from site info) I am getting error:

There was an error communicating with the endpoint at 'https://localhost:8444'. No credentials were available in the client certificate"

How to support the CA certificate for the SSL communication?

I am able to establish a communication with the certificate with private keys.

how to support / code changes to add the properties to support the CA certificate/ public certificate.

0

There are 0 best solutions below