Jump to content

tibemsConnectionFactory_CreateConnection() returns TIBEMS_INVALID_PROTOCOL(15). Client on Windows OS, both server and client certificates added to the truststore - and also manupilated through C API. Tried tibemsConnection_CreateSSL returns the same.


Renfu Shiao

Recommended Posts

Sample code

TibcoConn()

{

tibems_status        status = TIBEMS_OK;

tibemsMsg          msg = NULL;

const char*         txt = NULL;

tibemsMsgType        msgType = TIBEMS_MESSAGE_UNKNOWN;

const char*         msgTypeName = "UNKNOWN";

tibemsConnectionFactory     factory = NULL;

tibemsConnection        connection = NULL;

tibemsSession          session = NULL;

tibemsMsgConsumer        msgConsumer = NULL;

tibemsDestination        destination = NULL;

//tibemsSSLParams         sslParams = NULL;

tibems_int           receive = 1;

rsSSLparams = tibemsSSLParams_Create();

rsPk_password = new char[20];

memset(rsPk_password, 0, 20);

memcpy(rsPk_password, "password", 9);

char** argv = NULL;

tibemsSSL_SetDebugTrace(TIBEMS_TRUE);

status = tibemsSSLParams_AddTrustedCertFile(rsSSLparams, "client.cert.pem",

TIBEMS_SSL_ENCODING_AUTO);

status = tibemsSSLParams_AddTrustedCertFile(rsSSLparams, "server.cert.pem",

TIBEMS_SSL_ENCODING_AUTO);

status = tibemsSSLParams_AddIssuerCertFile(rsSSLparams, "client_root.cert.pem",

TIBEMS_SSL_ENCODING_AUTO);

status = tibemsSSLParams_AddIssuerCertFile(rsSSLparams, "server_root.cert.pem",

TIBEMS_SSL_ENCODING_AUTO);

status = tibemsSSLParams_SetIdentityFile(rsSSLparams, "client_identity.p12",

TIBEMS_SSL_ENCODING_AUTO);

status = tibemsSSLParams_SetPrivateKeyFile(rsSSLparams, "client.key.pem",

TIBEMS_SSL_ENCODING_AUTO);

tibemsSSLParams_SetVerifyHost(rsSSLparams, TIBEMS_FALSE);

tibemsSSL_SetTrace(TIBEMS_TRUE);

const char* serverUrl = "ssh://devhost:7243";

status = tibemsConnectionFactory_SetServerURL(factory, serverUrl);

if (status != TIBEMS_OK)

{

//fail("Error setting server url", errorContext);

}

if (rsSSLparams)

{

status = tibemsConnectionFactory_SetSSLParams(factory, rsSSLparams);

if (status != TIBEMS_OK)

{

fail("Error setting ssl params", errorContext);

}

status = tibemsConnectionFactory_SetPkPassword(factory, rsPk_password);

if (status != TIBEMS_OK)

{

fail("Error setting pk password", errorContext);

}

}

//status = tibemsConnection_CreateSSL(&connection, serverUrl, "client", "user1", "pass1", rsSSLparams, rsPk_password);

status = tibemsConnectionFactory_CreateConnection(factory, &connection,

"user1", "pass1");

if (status != TIBEMS_OK)

{

fail("Error creating tibemsConnection", errorContext);

}

    ...

}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...