title: Solace Client in C with TLS support
body: <p>I am trying to implement C client to connect and publish message to particular topic. I am getting below error while implementing ssl.</p>
  <pre><code>ERROR:
  SDK WARNING Fri Feb 05 13:59:36.412 2021 solClientSession.c:3609              (7fb51ccfe740) Session '(c0,s1)_vpn-poc-d1': Client Certificate Authentication is not supported on unsecured sessions
  ERROR:: Error in craeting session sol client.
  </code></pre>
  <p>Below is the implementation POC code.</p>
  <pre><code>#include &quot;os.h&quot;
  #include &quot;../inc/solclient/solClient.h&quot;
  #include &quot;../inc/solclient/solClientMsg.h&quot;
  
  
    /*****************************************************************************
     * sessionMessageReceiveCallback
     *
     * The message receive callback function is mandatory for session creation.
     *****************************************************************************/
  solClient_rxMsgCallback_returnCode_t
  sessionMessageReceiveCallback(solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void* user_p)
  {
      return SOLCLIENT_CALLBACK_OK;
  }
  
  /*****************************************************************************
   * sessionEventCallback
   *
   * The event callback function is mandatory for session creation.
   *****************************************************************************/
  void
  sessionEventCallback(solClient_opaqueSession_pt opaqueSession_p,
      solClient_session_eventCallbackInfo_pt eventInfo_p, void* user_p)
  {
  }
  
  /*****************************************************************************
   * main
   *
   * The entry point to the application.
   *****************************************************************************/
  int main(int argc, char* argv[])
  {
  
      /*if (argc &gt; 1) {
          printf(&quot;Usage: TopicPublisher\n&quot;);
          return -1;
      }
  */
  
      /* Context */
      solClient_opaqueContext_pt context_p;
      solClient_context_createFuncInfo_t contextFuncInfo = SOLCLIENT_CONTEXT_CREATEFUNC_INITIALIZER;
  
      /* Session */
      solClient_opaqueSession_pt session_p;
      solClient_session_createFuncInfo_t sessionFuncInfo = SOLCLIENT_SESSION_CREATEFUNC_INITIALIZER;
  
      /* Session Properties */
      const char* sessionProps[40] = { 0, };
      int             propIndex = 0;
  
      /* Message */
      solClient_opaqueMsg_pt msg_p = NULL;
      solClient_destination_t destination;
  
      solClient_returnCode_t solReturnStatus = SOLCLIENT_OK;
  
      const char* text_p = &quot;Hello World!!&quot;;
  
      /*************************************************************************
       * Initialize the API (and setup logging level)
       *************************************************************************/
  
       /* solClient needs to be initialized before any other API calls. */
      solReturnStatus = solClient_initialize(SOLCLIENT_LOG_DEFAULT_FILTER, NULL);
      if (solReturnStatus != SOLCLIENT_OK)
      {
          printf(&quot;ERROR:: Error in initiailizing sol client.\n&quot;);
          return -1;
      }
      printf(&quot;TopicPublisher initializing...\n&quot;);
  
      /*************************************************************************
       * Create a Context
       *************************************************************************/
  
       /*
        * Create a Context, and specify that the Context thread be created
        * automatically instead of having the application create its own
        * Context thread.
        */
      solReturnStatus = solClient_context_create(SOLCLIENT_CONTEXT_PROPS_DEFAULT_WITH_CREATE_THREAD,
          &amp;context_p, &amp;contextFuncInfo, sizeof(contextFuncInfo));
      if (solReturnStatus != SOLCLIENT_OK)
      {
          printf(&quot;ERROR:: Error in creating context sol client.\n&quot;);
          return -1;
      }
  
      /*************************************************************************
       * Create and connect a Session
       *************************************************************************/
  
       /*
        * Message receive callback function and the Session event function
        * are both mandatory. In this sample, default functions are used.
        */
      sessionFuncInfo.rxMsgInfo.callback_p = sessionMessageReceiveCallback;
      sessionFuncInfo.rxMsgInfo.user_p = NULL;
      sessionFuncInfo.eventInfo.callback_p = sessionEventCallback;
      sessionFuncInfo.eventInfo.user_p = NULL;
  
      /* Configure the Session properties. */
      propIndex = 0;
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_HOST;
      sessionProps[propIndex++] = argv[1];
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_VPN_NAME;
      sessionProps[propIndex++] = argv[2];
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_USERNAME;
      sessionProps[propIndex++] = argv[3];
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_PASSWORD;
      sessionProps[propIndex++] = argv[4];
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_SSL_VALIDATE_CERTIFICATE;
      sessionProps[propIndex++] = SOLCLIENT_PROP_ENABLE_VAL;
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_AUTHENTICATION_SCHEME;
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_AUTHENTICATION_SCHEME_CLIENT_CERTIFICATE;
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_SSL_CLIENT_CERTIFICATE_FILE;
      sessionProps[propIndex++] = argv[5];
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_SSL_CLIENT_PRIVATE_KEY_FILE;
      sessionProps[propIndex++] = argv[6];
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_SSL_CLIENT_PRIVATE_KEY_FILE_PASSWORD;
      sessionProps[propIndex++] = argv[7];
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_REAPPLY_SUBSCRIPTIONS;
      sessionProps[propIndex++] = SOLCLIENT_PROP_ENABLE_VAL;
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_SSL_VALIDATE_CERTIFICATE;
      sessionProps[propIndex++] = SOLCLIENT_PROP_DISABLE_VAL;
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_SSL_EXCLUDED_PROTOCOLS;
      sessionProps[propIndex++] = &quot;TLSv1.1&quot;;
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_RECONNECT_RETRIES;
      sessionProps[propIndex++] = &quot;3&quot;;
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_CONNECT_RETRIES_PER_HOST;
      sessionProps[propIndex++] = &quot;3&quot;;
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_SSL_VALIDATE_CERTIFICATE_DATE;
      sessionProps[propIndex++] = SOLCLIENT_PROP_DISABLE_VAL;
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_SSL_TRUST_STORE_DIR;
      sessionProps[propIndex++] = argv[8];
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_SSL_CIPHER_SUITES;
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_SSL_CIPHER_TLS_RSA_WITH_AES_128_CBC_SHA;
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_SSL_TRUSTED_COMMON_NAME_LIST;
      sessionProps[propIndex++] = &quot;TEST&quot;;
  
      sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_SSL_CONNECTION_DOWNGRADE_TO;
      sessionProps[propIndex++] = &quot;PLAIN_TEXT&quot;;
  
      sessionProps[propIndex] = NULL;
      printf(&quot;Total Properties set = %d\n&quot;,propIndex);
  
      /* Create the Session. */
      solReturnStatus = solClient_session_create((char**)sessionProps,
          context_p,
          &amp;session_p, &amp;sessionFuncInfo, sizeof(sessionFuncInfo));
      if (solReturnStatus != SOLCLIENT_OK)
      {
          printf(&quot;ERROR:: Error in craeting session sol client.\n&quot;);
          return -1;
      }
  
      /* Connect the Session. */
      solReturnStatus = solClient_session_connect(session_p);
  
      if (solReturnStatus != SOLCLIENT_OK)
      {
          printf(&quot;ERROR:: Error in connecting to session sol client.\n&quot;);
          return -1;
      }
      printf(&quot;Connected.\n&quot;);
  
      /*************************************************************************
       * Publish
       *************************************************************************/
  
       /* Allocate memory for the message that is to be sent. */
      solClient_msg_alloc(&amp;msg_p);
  
      /* Set the message delivery mode. */
      solClient_msg_setDeliveryMode(msg_p, SOLCLIENT_DELIVERY_MODE_DIRECT);
  
      /* Set the destination. */
      destination.destType = SOLCLIENT_TOPIC_DESTINATION;
      destination.dest = argv[9];
      solClient_msg_setDestination(msg_p, &amp;destination, sizeof(destination));
  
      /* Add some content to the message. */
      solClient_msg_setBinaryAttachment(msg_p, text_p, (solClient_uint32_t)strlen((char*)text_p));
  
      /* Send the message. */
      printf(&quot;About to send message '%s' to topic '%s'...\n&quot;, (char*)text_p, argv[9]);
      solReturnStatus = solClient_session_sendMsg(session_p, msg_p);
      if (solReturnStatus != SOLCLIENT_OK)
      {
          printf(&quot;ERROR:: Error in sending data to topic.\n&quot;);
      }
  
      /* Free the message. */
      printf(&quot;Message sent. Exiting.\n&quot;);
      solReturnStatus = solClient_msg_free(&amp;msg_p);
      if (solReturnStatus != SOLCLIENT_OK)
      {
          printf(&quot;ERROR:: Error in msg free sol client.\n&quot;);
      }
  
      /*************************************************************************
       * Cleanup
       *************************************************************************/
  
       /* Cleanup solClient. */
      solReturnStatus = solClient_cleanup();
  
      if (solReturnStatus != SOLCLIENT_OK)
      {
          printf(&quot;ERROR:: Error in cleanup sol client.\n&quot;);
      }
  
      return 0;
  }
  </code></pre>
  <p>I might be using invalid certificates, is there any way to get the correct certificates from pubsub+ solace server?</p>