There is the source code which update code by Amazon S3(OTA).

Daniel
Posts: 28
Joined: Tue Jan 09, 2018 12:55 pm

There is the source code which update code by Amazon S3(OTA).

Postby Daniel » Thu Apr 26, 2018 2:30 am

Hi everyone,

I'm very happy to tell you that I can update the program through Amazon S3, but I know it is imperfect, so I share it and let everyone to make it better. It updates the program through OTA .This is a program linkhttps://github.com/DanielXie00/https-ota-esp32-aws. I hope anyone can provide some advices . It works very well .
Thank you.
Best Wishes.
Daniel.

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: There is the source code which update code by Amazon S3(OTA).

Postby fly135 » Thu Apr 26, 2018 3:02 pm

Cool! I modified the same example app using SSL functions. I'm not really sure how this all works exactly. Do you need to use a certificate? Or is that just an additional level of security? Maybe I should be using TLS instead of SSL.

John A

Daniel
Posts: 28
Joined: Tue Jan 09, 2018 12:55 pm

Re: There is the source code which update code by Amazon S3(OTA).

Postby Daniel » Fri Apr 27, 2018 9:03 am

fly135 wrote:Cool! I modified the same example app using SSL functions. I'm not really sure how this all works exactly. Do you need to use a certificate? Or is that just an additional level of security? Maybe I should be using TLS instead of SSL.

John A
Yes ,it needs a certificate.Here is the certificate. https://github.com/DanielXie00/https-ot ... t_cert.pem You should replace the certificate with your own.
Actually , first,it saves the file to the buff by using mbedtls_ssl_read(&ssl, (unsigned char *)buf, TEXT_BUFFSIZE); ,and then copy to ota_write_data, finnally, check it and reboot .

Code: Select all

			
	memset(buf, 0, TEXT_BUFFSIZE);
       	memset(ota_write_data, 0, BUFFSIZE);
            len = sizeof(buf) - 1;
            bzero(buf, sizeof(buf));
            ret = mbedtls_ssl_read(&ssl, (unsigned char *)buf, TEXT_BUFFSIZE);
		if(ret>0)
		{
			if(!resp_body_start)
			{
				memcpy(ota_write_data, buf, ret);
				resp_body_start = read_past_http_header(buf, ret, update_handle);
				ESP_LOGI(TAG, "read_past_http_header");
			}
			else
			{
			memcpy(ota_write_data, buf,ret);
			 err = esp_ota_write( update_handle, (unsigned char *)ota_write_data, ret);
			ESP_LOGI(TAG, "ota_write_data");
			}
		
			continue;
		 
		}
Hope to receive your good news!
Best wishes. Daniel

jitheshjv
Posts: 7
Joined: Tue Feb 20, 2018 3:37 pm

Re: There is the source code which update code by Amazon S3(OTA).

Postby jitheshjv » Tue Aug 07, 2018 6:00 am

Hi,
Thanks for the code and its working well for me. But just before OTA updation is shows

W (230766) example: Failed to verify peer certificate!
W (230766) example: verification info: ! The certificate is not correctly signed by the trusted CA

I have changed the certificate , does this mean there is some problem with it ??

Who is online

Users browsing this forum: Majestic-12 [Bot] and 202 guests