| 
									
										
										
										
											2018-07-12 17:45:44 +05:30
										 |  |  | ESP HTTPS OTA
 | 
					
						
							|  |  |  | =============
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Overview
 | 
					
						
							|  |  |  | --------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``esp_https_ota`` provides simplified APIs to perform firmware upgrades over HTTPS.
 | 
					
						
							|  |  |  | It's an abstraction layer over existing OTA APIs.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Application Example
 | 
					
						
							|  |  |  | -------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     .. highlight:: c
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ::
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         esp_err_t do_firmware_upgrade()
 | 
					
						
							|  |  |  |         {
 | 
					
						
							|  |  |  |             esp_http_client_config_t config = {
 | 
					
						
							|  |  |  |                 .url = CONFIG_FIRMWARE_UPGRADE_URL,
 | 
					
						
							|  |  |  |                 .cert_pem = (char *)server_cert_pem_start,
 | 
					
						
							|  |  |  |             };
 | 
					
						
							|  |  |  |             esp_err_t ret = esp_https_ota(&config);
 | 
					
						
							|  |  |  |             if (ret == ESP_OK) {
 | 
					
						
							|  |  |  |                 esp_restart();
 | 
					
						
							|  |  |  |             } else {
 | 
					
						
							|  |  |  |                 return ESP_FAIL;
 | 
					
						
							|  |  |  |             }
 | 
					
						
							|  |  |  |             return ESP_OK;
 | 
					
						
							|  |  |  |         }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-12 15:20:41 +08:00
										 |  |  | Signature Verification
 | 
					
						
							|  |  |  | ----------------------
 | 
					
						
							| 
									
										
										
										
											2018-08-14 18:55:11 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-12 15:20:41 +08:00
										 |  |  | For additional security, signature of OTA firmware images can be verified. For that, refer :ref:`secure-ota-updates`
 | 
					
						
							| 
									
										
										
										
											2018-08-14 18:55:11 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-12 17:45:44 +05:30
										 |  |  | API Reference
 | 
					
						
							|  |  |  | -------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-13 11:46:16 +08:00
										 |  |  | .. include-build-file:: inc/esp_https_ota.inc
 |