<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>MQTT_Connect -45 when connecting to AWS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50807/mqtt_connect--45-when-connecting-to-aws</link><description>I am trying to write a simple application to publish messages over MQTT to an AWS IoT-Core broker. I started with the MQTT_Simple and AWS_FOTA examples. When trying to do the mqtt_connect I am getting a -45 error code. My code is as follows:</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 01 May 2020 13:26:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50807/mqtt_connect--45-when-connecting-to-aws" /><item><title>RE: MQTT_Connect -45 when connecting to AWS</title><link>https://devzone.nordicsemi.com/thread/247678?ContentTypeID=1</link><pubDate>Fri, 01 May 2020 13:26:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c40d3d32-337d-40f6-867c-4c7a9c3667f3</guid><dc:creator>dtquang89</dc:creator><description>&lt;p&gt;Hi, I think the answer of &lt;a href="https://devzone.nordicsemi.com/members/didrik-rokhaug"&gt;Didrik Rokhaug&lt;/a&gt; is correct.&lt;/p&gt;
&lt;p&gt;Just to make sure the certificates are insert correctly in certificates.h.&lt;/p&gt;
&lt;p&gt;In addition, there are 3 certificates you need to obtain: Client certificate, client private key, and cloud certificate.&lt;/p&gt;
&lt;p&gt;Good luck.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT_Connect -45 when connecting to AWS</title><link>https://devzone.nordicsemi.com/thread/211276?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2019 13:08:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9291955c-0f0c-4b98-b7f5-ffaccd20bd54</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;1. When you are using the asset_tracker sample application, then the device generates its own client ID (nrf-&amp;lt;IMEI&amp;gt;). You can override this behavior by defining&amp;nbsp; NRF_CLOUD_CLINET_ID.&lt;/p&gt;
&lt;p&gt;If you are not using the nrf_cloud library, you have to define the client ID yourself. When using a cloud service, the device ID usually has to correspond to the device ID defined in the cloud.&lt;/p&gt;
&lt;p&gt;2. Yes, the certificates in certificates.h is PEM formatted, e.g.:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define NRF_CLOUD_CLIENT_PRIVATE_KEY \
	&amp;quot;-----BEGIN RSA PRIVATE KEY-----\n&amp;quot; \
	&amp;quot;NRF_CLOUD_CLIENT_PRIVATE_KEY\n&amp;quot; \
	&amp;quot;-----END RSA PRIVATE KEY-----\n&amp;quot;

#define NRF_CLOUD_CLIENT_PUBLIC_CERTIFICATE \
	&amp;quot;-----BEGIN CERTIFICATE-----\n&amp;quot; \
	&amp;quot;NRF_CLOUD_CLIENT_PUBLIC_CERTIFICATE\n&amp;quot; \
	&amp;quot;-----END CERTIFICATE-----\n&amp;quot;

#define NRF_CLOUD_CA_CERTIFICATE \
	&amp;quot;-----BEGIN CERTIFICATE-----\n&amp;quot; \
	&amp;quot;NRF_CLOUD_CA_CERTIFICATE\n&amp;quot; \
	&amp;quot;-----END CERTIFICATE-----\n&amp;quot;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT_Connect -45 when connecting to AWS</title><link>https://devzone.nordicsemi.com/thread/211040?ContentTypeID=1</link><pubDate>Sat, 21 Sep 2019 10:48:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebfadc2b-d5d3-4637-b0e4-31a5161447e1</guid><dc:creator>stevenlin</dc:creator><description>&lt;p&gt;hi dyres,&lt;/p&gt;
&lt;p&gt;1.&lt;/p&gt;
&lt;p&gt;what is client id ? it&amp;nbsp;&lt;span&gt;generating by self ,?&amp;nbsp; bind with&amp;nbsp;Policies&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;certificates.h&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;it is PEM formatted&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT_Connect -45 when connecting to AWS</title><link>https://devzone.nordicsemi.com/thread/204010?ContentTypeID=1</link><pubDate>Wed, 14 Aug 2019 09:36:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0db06e0f-d0a0-40ef-8641-5d9449feb047</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;Error code 2 is ENOENT, meaning that it could not find the file. This is the expected result if the certificates did not exist.&lt;/p&gt;
&lt;p&gt;When I use your main file, trying to connect to nRF Cloud (which is built on AWS) it works fine on my end. However, if I delibeartly give it invalid certificates I get -45.&lt;/p&gt;
&lt;p&gt;You can check what certificates are written to the modem using the procedure explained in this comment:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/49650/asset_tracker-does-not-work-with-firmware-v1-0-0/199421#199421"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/49650/asset_tracker-does-not-work-with-firmware-v1-0-0/199421#199421&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT_Connect -45 when connecting to AWS</title><link>https://devzone.nordicsemi.com/thread/203884?ContentTypeID=1</link><pubDate>Tue, 13 Aug 2019 14:42:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33d2721d-4a08-4111-8b65-6c85a087390f</guid><dc:creator>dyres004</dc:creator><description>&lt;p&gt;I have verified my certificates and client ID are correct.&lt;/p&gt;
&lt;p&gt;I tried deleting all 5 types. for index 3 and 4 I get a result of 2 from nrf_inbuilt_key_delete. I was unable to determine what that result code signifies.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT_Connect -45 when connecting to AWS</title><link>https://devzone.nordicsemi.com/thread/203559?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2019 11:46:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:329264fe-8513-48da-9960-7915c1d9f478</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Then it&amp;#39;s probably some issue with the authentication. Please make sure that your certificates and client ID are correct.&lt;/p&gt;
&lt;p&gt;You might also want to delete all 5 types of credentials on the modem, in case you have written some of the last two using the same sec_tag.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT_Connect -45 when connecting to AWS</title><link>https://devzone.nordicsemi.com/thread/203402?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2019 18:48:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f3053c1-9f96-4ae6-bd7b-672f12745c0d</guid><dc:creator>dyres004</dc:creator><description>&lt;p&gt;That has the same outcome.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT_Connect -45 when connecting to AWS</title><link>https://devzone.nordicsemi.com/thread/203283?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2019 11:28:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ab1d79f-936e-4143-bf4c-4ea851dc7a01</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;Try to enable peer and hostname verification by un-commenting lines 400 and 405 (and commenting lines 407 and 412).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>