@@ -92,35 +92,50 @@ image can be encrypted/decrypted using an RSA-3072 key pair.
92
92
93
93
Please follow the steps below to generate an application image for OTA upgrades:
94
94
95
- 1. Generate a new RSA-3072 key pair or use an existing one.
95
+ 1. Generate a new RSA-3072 key pair or use an existing one.
96
96
97
- - To generate a key pair, use the following command:
97
+ - To generate a key pair, use the following command:
98
98
99
99
```
100
100
openssl genrsa -out esp_image_encryption_key.pem 3072
101
101
```
102
102
103
- - Extract the public key from the key pair:
103
+ - Extract the public key from the key pair:
104
104
```
105
105
openssl rsa -in esp_image_encryption_key.pem -pubout -out esp_image_encryption_public_key.pem
106
106
```
107
107
108
- 2. Encrypt the application binary using the
109
- [esp_enc_img_gen.py](https://github.com/espressif/idf-extra-components/blob/master/esp_encrypted_img/tools/esp_enc_img_gen.py)
110
- script.
108
+ 2. Encrypt the application binary using the
109
+ [esp_enc_img_gen.py](https://github.com/espressif/idf-extra-components/blob/master/esp_encrypted_img/tools/esp_enc_img_gen.py)
110
+ script.
111
111
112
- - Use the following command to encrypt the OTA image with the public key:
112
+ Use the following command to encrypt the OTA image with the public key:
113
113
114
- ```
115
- python3 esp_enc_img_gen.py encrypt lighting-app.bin esp_image_encryption_public_key.pem lighting-app-encrypted.bin
116
- ```
114
+ ```
115
+ python3 esp_enc_img_gen.py encrypt lighting-app.bin esp_image_encryption_public_key.pem lighting-app-encrypted.bin
116
+ ```
117
117
118
- - Append the Matter OTA header:
119
- ```
120
- src/app/ota_image_tool.py create --vendor-id 0xFFF1 --product-id 0x8000 --version 2 --version-str "v2.0" -da sha256 lighting-app-encrypted.bin lighting-app-encrypted-ota.bin
121
- ```
118
+ Optionally, you can use the cmake function `create_esp_enc_img()` to encrypt
119
+ the OTA image during the build process. Please find the usage below. This is
120
+ also demonstrated in the `examples/lighting-app/esp32/main/CMakeLists.txt`
121
+ file.
122
+
123
+ ```
124
+ create_esp_enc_img(${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.bin
125
+ ${project_dir}/esp_image_encryption_public_key.pem
126
+ ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}-encrypted.bin
127
+ app)
128
+ ```
129
+
130
+ 3. Append the Matter OTA header
131
+
132
+ ```
133
+ src/app/ota_image_tool.py create --vendor-id 0xFFF1 --product-id 0x8000 \
134
+ --version 2 --version-str "v2.0" -da sha256 \
135
+ lighting-app-encrypted.bin lighting-app-encrypted-ota.bin
136
+ ```
122
137
123
- 3. Use the `lighting-app-encrypted-ota.bin` file with the OTA Provider app.
138
+ 4. Use the `lighting-app-encrypted-ota.bin` file with the OTA Provider app.
124
139
125
140
## Delta OTA
126
141
0 commit comments