Complete the code to verify the firmware signature before booting.
if verify_signature(firmware, [1]): boot(firmware)
The public key is used to verify the digital signature of the firmware to ensure it is authentic before booting.
Complete the code to start the OTA update process securely.
ota_update.start_secure_update([1])The OTA update should start with signed firmware to ensure the update is authentic and secure.
Fix the error in the code that checks firmware integrity using a hash.
if firmware_hash == [1](firmware).hexdigest(): accept_update()
Using hashlib.sha256 computes the hash of the firmware to compare with the expected hash for integrity check.
Fill both blanks to create a dictionary comprehension that maps firmware versions to their hashes for verification.
version_hashes = {version: [1] for version in firmware_versions if version [2] '1.0.0'}The comprehension maps each version to its hash using get_hash(version), filtering versions greater than '1.0.0'.
Fill all three blanks to create a secure OTA update check that verifies signature, version, and hash.
if verify_signature(firmware, [1]) and firmware_version [2] current_version and firmware_hash [3] expected_hash: apply_update(firmware)
The code verifies the firmware signature with the public key, checks the firmware version is newer, and confirms the hash matches before applying the update.