<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anand Saraswa on Medium]]></title>
        <description><![CDATA[Stories by Anand Saraswa on Medium]]></description>
        <link>https://medium.com/@anand.saraswa?source=rss-b8bd1eb8a841------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SELoxlLWcJI1LwzQ</url>
            <title>Stories by Anand Saraswa on Medium</title>
            <link>https://medium.com/@anand.saraswa?source=rss-b8bd1eb8a841------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 13:05:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anand.saraswa/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[PKIX Certificate Issue]]></title>
            <link>https://medium.com/globant/pkix-certificate-issue-8ba37a5f0b41?source=rss-b8bd1eb8a841------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ba37a5f0b41</guid>
            <category><![CDATA[public-key-certificate]]></category>
            <category><![CDATA[pkix]]></category>
            <category><![CDATA[public-key-infrastructure]]></category>
            <dc:creator><![CDATA[Anand Saraswa]]></dc:creator>
            <pubDate>Tue, 26 Dec 2023 14:21:39 GMT</pubDate>
            <atom:updated>2025-10-08T05:42:19.532Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*3xQyrqVIilXGLIZA.png" /><figcaption>PKIX Certificate</figcaption></figure><p>While developing and testing my web or restful application, which is engaging with some remote server, I got the error below on my console.</p><pre>PKIX path building failed: <br>sun.security.provider.certpath.SunCertPathBuilderException: <br>unable to find valid certification path to requested target; <br>nested exception is javax.net.ssl.SSLHandshakeException: <br>PKIX path building failed: <br>sun.security.provider.certpath.SunCertPathBuilderException: <br>unable to find valid certification path to requested target</pre><p>Many of you also might have faced this. Let&#39;s deep dive and check this PKIX issue and how we can solve it.</p><h3>What is the PKIX Certificate Issue?</h3><p>Public Key Infrastructure (PKIX) issues generally come due to the system firewall, which restricts the application from connecting to the external unsecured system/remote server.</p><p>Your system, or if we specifically talk about the spring boot application which runs on JVM, you don&#39;t have a valid certificate in the trust store to access the remote system.</p><h3>What is Trust store in Java?</h3><p>Whenever a connection is made to any remote server, the server’s certificate gets checked and validated with the <strong>trust store</strong> of the client, who sends the request each time. By default, <a href="https://docs.oracle.com/cd/E19509-01/820-3503/6nf1il6er/index.html">Oracle Java </a>JDK has a default trust store, which contains multiple known certificates used to authenticate the remote server on the client side.</p><p>So, if the required certificate is unavailable in the<a href="https://docs.oracle.com/cd/E19509-01/820-3503/6nf1il6er/index.html"> </a>client&#39;s trust store, it doesn&#39;t get access to the remote server.</p><h3>How to resolve this?</h3><p>We will discuss how we can solve this issue if we have a spring-based Java application and are facing this issue in the steps below.</p><h4>Step 1</h4><p>First, you must identify which URL your system is blocking and cannot access. This can be easily identified by checking the console logs.</p><p>Copy and paste that URL into the browser (the screenshot below is <strong>Chrome</strong>), and you will see the screen below. You will see a lock icon; click on that icon and follow the path below.</p><p><strong>Connection is secure → Valid Certificate → Details → Export</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*stG76sCwSUJeomSFMwn_nw.png" /><figcaption>Certificate Path</figcaption></figure><h4>Step 2</h4><p>Minimize the Chrome window if you don’t see the below pop-up, then give the proper name to the certificate after selecting the <strong>format</strong> as “<strong>DER encoded binary</strong>” and download it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HS77nBYGk1VgNplUKLMSQ.png" /><figcaption>Certificate Export</figcaption></figure><h4>Step 3</h4><p>Now you have a keystore file and need to add it to your JVM trust store. Identify your JVM path, or if you are using <strong>IntelliJ,</strong> then you can check the JVM path as per the referenced image below.</p><p>Please note your path until the final <strong><em>cacerts</em></strong> in JVM.</p><pre>Example Path: <br>/Users/anand.saraswa/Library/Java/JavaVirtualMachines/corretto-11.0.20/Contents/Home/jre/lib/security/cacerts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LFl3DS-c4-5HPnIhe9rDew.png" /><figcaption>Check JVM path</figcaption></figure><h4>Step 4</h4><p>If everything is done up to step 3, you must import the example.cer(downloaded .cer file) file into cacerts. Open the terminal and execute the below command in the terminal.</p><pre>$ keytool -import -alias example -keystore &lt;cacert path in JDK&gt; -file &lt;path of downloaded certificate file&gt;<br><br># Example:<br>keytool -import -alias example -keystore /Users/anand.saraswa/Library/Java/JavaVirtualMachines/corretto-11.0.20/Contents/Home/lib/security/cacerts -file certificate.cer</pre><h4>Step 5</h4><p>It will ask to change the password type “<strong>changeit</strong>” and once the command is executed, it will ask for confirmation, so type “<strong>Yes”.</strong></p><p>The certificate will be installed with confirmation, and then you need to restart the system; try to reaccess it, and it should work.</p><p>Woohoo, you are done !! :)</p><h3>Conclusion</h3><p>In this blog, we explain how to add the required certificate in the Java trust store if we get a PKIX error in a Java-based spring application. We learned without a valid certificate, a client can not make a connection to a remote server.</p><p>Thanks for reading.</p><h3>References</h3><p><a href="https://docs.oracle.com/cd/E19509-01/820-3503/ggffo/index.html">OCJP Document for Java Trust Store</a></p><p><a href="https://yasarayasawardhana.medium.com/beginners-guide-to-key-stores-and-trust-stores-f7fa6d70ca2e">Difference between Key Store and Trust Store</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ba37a5f0b41" width="1" height="1" alt=""><hr><p><a href="https://medium.com/globant/pkix-certificate-issue-8ba37a5f0b41">PKIX Certificate Issue</a> was originally published in <a href="https://medium.com/globant">Globant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MQTT Protocol : Architecture & lots more]]></title>
            <link>https://medium.com/globant/mqtt-protocol-architecture-lots-more-c24bc5489e1?source=rss-b8bd1eb8a841------2</link>
            <guid isPermaLink="false">https://medium.com/p/c24bc5489e1</guid>
            <category><![CDATA[mqtt-architecture]]></category>
            <category><![CDATA[mqtt-broker]]></category>
            <category><![CDATA[mqtt-protocol]]></category>
            <category><![CDATA[mqtt-vs-http]]></category>
            <category><![CDATA[mqtt-topic]]></category>
            <dc:creator><![CDATA[Anand Saraswa]]></dc:creator>
            <pubDate>Thu, 13 Oct 2022 11:45:21 GMT</pubDate>
            <atom:updated>2022-10-13T11:45:21.625Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>MQTT Protocol : Architecture &amp; lots more</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*op6usipw6bEGFQJ_OBVftg.png" /><figcaption>OASIS standard messaging protocol for the Internet of Things (IoT)</figcaption></figure><p>MQTT is also a protocol like <a href="https://medium.com/@rachid1982fsb/what-is-http-5b01392678d5">HTTP</a>. It was very fresh and astonishing for me too when I learned about MQTT. We will cover these amazing points about MQTT at the end of this blog.</p><ul><li>What is MQTT ?</li><li>Avails of MQTT protocol</li><li>MQTT Components and Architecture</li><li>MQTT v/s HTTP</li><li>MQTT Applications and Real time usage.</li></ul><h3><strong>What is MQTT ?</strong></h3><p>MQTT (Messaging Queue Telemetry Transport) is a protocol prominently used for <strong>machine to machine</strong> data transfer in the <a href="https://medium.com/iotforall/what-is-iot-f825c7304368#:~:text=%E2%80%9CThe%20Internet%20of%20Things%20(IoT,%2Dto%2Dcomputer%20interaction.%E2%80%9D">IoT (Internet of things)</a> domain. In very simple terms I can say it’s a<strong> lightweight publish / subscribe</strong> protocol which enables <a href="https://medium.com/enjoy-algorithm/distributed-system-a64c5acb015"><strong>distributed design</strong></a> architecture for communication between embedded devices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*JA38PFomD1Gn5ueCADKAKg.png" /><figcaption>Pub/Sub</figcaption></figure><blockquote><strong>Publish: </strong>When the device sends the data to the server or broker, then the operation is called publish.</blockquote><blockquote><strong>Subscribe</strong> : When the client receives the data from the broker, then we call this operation as Subscription.</blockquote><h3><strong>Avails of MQTT Protocol</strong></h3><ul><li><strong>Takes less bandwidth and memory </strong>: It is a lightweight protocol to install and even can run on devices having low CPU and RAM. It results in smooth transmission of the data in comparison to other protocols like <a href="https://medium.com/@rachid1982fsb/what-is-http-5b01392678d5">HTTP</a> and AMQP<strong>.</strong></li><li><strong>Bidirectional:</strong> Amazing experience for me about MQTT is it allows messages in both directions, either from client to server or server to client.</li><li><strong>Reliable: </strong>MQTT follows a very high standard on reliability since there are many cases of messages delivery in the IoT domain. That is the main reason it is having <strong>QOI</strong>(quality of index) values as 0, 1, 2. In subsequent parts of this blog, we will discuss this topic.</li><li><strong>Feasible for Remote Application</strong>: The major goal of this protocol is to enable connections for remote places where just a little amount of code is required and network capacity is constrained.</li></ul><h3><strong>MQTT Components and Architecture</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*npxTJreTHvT0srM4MyNQIA.jpeg" /><figcaption>MQTT Architecture</figcaption></figure><p><strong>MQTT Components :</strong></p><ol><li>Message</li><li>Client</li><li>Server or Broker</li><li>Topic</li></ol><h4><strong>1) Message</strong>:</h4><p>Message is nothing but the data, which is going to be transferred over the network using MQTT.</p><p>These 4 parameter comes in message:</p><p><strong>a) Payload Data </strong>: Each message bundle contains a structured payload in it. Normally <strong>JSON </strong>and<strong> XML</strong> can be sent as payload which can be read by other devices.</p><p><strong>b) Quality of Index(qos)</strong>: Administration can increase the reliability of successful transfer of the message by QoS parameter.</p><ul><li><strong>qos (0) </strong>: <strong>No guarantee </strong>of delivery since receiver does not acknowledge the message received. Senders also do not send that message. It is like <strong>fire and forget</strong>.</li><li><strong>qos (1)</strong> : Receiver acknowledge the message which is received. If the sender does not get the acknowledgement it will resend the message. Receiver can get two duplicate messages.</li><li><strong>qos (2)</strong> : When sender sends the message with qos 2, at receiver side acknowledgement will be sent to the receiver same like qos 1, but with qos 2 duplicate message will not be entertained or received back by the receiver.</li></ul><blockquote>All messages sent with QoS 1 and 2 are queued for offline clients until the client is available again if the client’s session is persistent.</blockquote><p>c) <strong>Collection of Properties</strong></p><p>d) <strong>Topic Name</strong></p><h4><strong>2) Client</strong>:</h4><p>Any device which is getting or sending data from the broker is termed as <strong>Client</strong> in MQTT. It can have two roles: <strong>PUBLISH/SUBSCRIBE</strong>.</p><p>To get the message from the broker, client needs to subscribe to the broker on a <strong>specific topic</strong> and to publish the message from the client to the broker, the topic should be specified.</p><h4><strong>3) Server/Broker</strong>:</h4><p>Broker receives messages from devices and sends messages to clients. Devices/Clients who send the message to the broker are called <strong>publisher</strong> <strong>clients</strong> and devices who receives the messages from broker are called <strong>subscriber clients</strong>.</p><p>I learned that broker is the <strong>central point of communication</strong> through which every message should pass and it can be connected to multiple client devices on which the messages need to be sent.</p><p>Broker stores the messages in <strong>message queue</strong> and send the message in <strong>FIFO</strong>(first in first out) pattern and also it manages authentication and authorization of the Client.</p><h4><strong>4) Topic</strong>:</h4><p>Topic is a very important component I believe because it is an identity on which a specific type of <strong>payload/message</strong> can be subscribed by client and issued from server. It seems same as <strong>URI</strong> in <strong>HTTP</strong> protocol.</p><p>Topics are represented with strings separated by a forward slash. Each forward slash indicates a <strong>topic level</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L8WIvaPw8A7CSI1GD92fzQ.jpeg" /><figcaption>Topic Structure</figcaption></figure><h3>MQTT v/s HTTP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*25vc3niHcz4mLy5M866ixA.png" /><figcaption>MQTT v/s HTTP</figcaption></figure><h3><strong>MQTT Applications and Real Time usage.</strong></h3><p>Applications use message queueing telemetry transport (MQTT) to function are:</p><ol><li><strong>Smart Cities </strong>: Smart cities which include ( smart transport, smart healthcare, smart school, smart meter and smart home) required to set up a quick, faster and standard communication protocol like MQTT.</li><li><strong>Remote area Sensors</strong> : Sensor based devices / application installed at <strong>remote</strong> area which regularly sends the messages to its server required to run at low bandwidth internet and low cost infrastructure setup. The MQTT protocol suits these types of applications.</li><li><strong>Wearable Devices </strong>: To make data transmission in low energy wearable devices like smart watches, smart shoes etc.</li><li><strong>Social Media Applications</strong> : Facebook using MQTT protocol for transmission for its Instagram and Messenger applications. It takes low bandwidth and battery of the device.</li><li><strong>Smart Farming : </strong>Real time information of weather, sunlight, soil pH, moisture, humidity we can get from different MQTT enabled IoT devices, these information can make farming effective.</li><li><strong>Manufacturing : </strong>IoT devices have various sensors that can monitor the temperature, vibration, voltage, currents, and more. So, these MQTT enabled sensors can help with early warning signs of any predicted malfunctions, or downtime.</li><li><strong>Smart Home Automation : </strong>MQTT enabled home devices can<strong> </strong>enhance the energy efficiency, security and cost savings of the home. IoT enabled smart devices can send data to broker and data on the broker can be read by any mobile application.</li></ol><h3>References</h3><ul><li><a href="https://mqtt.org/">MQTT - The Standard for IoT Messaging</a></li><li><a href="https://www.hivemq.com/mqtt-essentials/">MQTT Essentials</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c24bc5489e1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/globant/mqtt-protocol-architecture-lots-more-c24bc5489e1">MQTT Protocol : Architecture &amp; lots more</a> was originally published in <a href="https://medium.com/globant">Globant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>