Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Encryption/Decryption(Which API is encrypting the packet in paho mqtt c code.)
Encryption/Decryption [message #1814162] Thu, 05 September 2019 07:41
gopal korrapati is currently offline gopal korrapatiFriend
Messages: 1
Registered: September 2019
Junior Member
Hi all,

Last one week onwads am struggling to find the Encryption and Decryption api's in paho mqtt c code. I took default MQTTClient_publish.c code, the below code

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "MQTTClient.h"

#define ADDRESS "ssl://"
#define CLIENTID "ExampleClientPub"
#define TOPIC "MQTTExamples"
#define PAYLOAD "Hello World!"
#define QOS 1
#define TIMEOUT 10000L

#define CA_PATH "/home/gopal/certificates/local/ca.crt"
#define KEYSTORE "/home/gopal/certificates/local/client.crt"
#define PRIVETE_KEY "/home/gopal/certificates/local/client.key"

int main(int argc, char* argv[])
MQTTClient client;
MQTTClient_connectOptions conn_opts = MQTTClient_connectOptions_initializer;
MQTTClient_message pubmsg = MQTTClient_message_initializer;
MQTTClient_SSLOptions sslOptions = MQTTClient_SSLOptions_initializer;
MQTTClient_deliveryToken token;
int rc;

MQTTClient_create(&client, ADDRESS, CLIENTID,
conn_opts.keepAliveInterval = 20;
conn_opts.cleansession = 0;

sslOptions.enableServerCertAuth = 1;
sslOptions.trustStore = CA_PATH;
sslOptions.keyStore= KEYSTORE;
sslOptions.privateKey= PRIVETE_KEY;
sslOptions.enabledCipherSuites = "AES128-GCM-SHA256";
// sslOptions.privateKeyPassword = KEYSTORE_PWD;
conn_opts.ssl = &sslOptions;

printf("verify = %d\n",sslOptions.verify);
if ((rc = MQTTClient_connect(client, &conn_opts)) != MQTTCLIENT_SUCCESS)
printf("Failed to connect, return code %d\n", rc);
pubmsg.payload = PAYLOAD;
pubmsg.payloadlen = (int)strlen(PAYLOAD);
pubmsg.qos = QOS;
pubmsg.retained = 0;
MQTTClient_publishMessage(client, TOPIC, &pubmsg, &token);
printf("Waiting for up to %d seconds for publication of %s\n"
"on topic %s for client with ClientID: %s\n",
rc = MQTTClient_waitForCompletion(client, token, TIMEOUT);
printf("Message with delivery token %d delivered\n", token);
MQTTClient_disconnect(client, 10000);
return rc;

And i went inside the code flow to find which api is encrypting my packet, please let me know any one .

Previous Topic:Broken Pipe after idle period
Next Topic:publish problem MQTT
Goto Forum:

Current Time: Fri Oct 23 02:27:57 GMT 2020

Powered by FUDForum. Page generated in 0.01840 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top