mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
docs: Update the CN translation for three docs in security
This commit is contained in:
parent
6f14f87e74
commit
85557380dd
@ -13,7 +13,7 @@ This is a quick start guide to {IDF_TARGET_NAME}'s flash encryption feature. Usi
|
||||
|
||||
.. note::
|
||||
|
||||
In this guide, most used commands are in the form of ``idf.py secure-<command>``, which is a wrapper around corresponding ``espsecure.py <command>``. The idf.py-based commands provides more user-friendly experience, although may lack some of the advanced functionality of their espsecure.py-based counterparts.
|
||||
In this guide, most used commands are in the form of ``idf.py secure-<command>``, which is a wrapper around corresponding ``espsecure.py <command>``. The ``idf.py`` based commands provides more user-friendly experience, although may lack some of the advanced functionality of their ``espsecure.py`` based counterparts.
|
||||
|
||||
Introduction
|
||||
------------
|
||||
@ -999,7 +999,7 @@ Manually encrypting or decrypting files requires the flash encryption key to be
|
||||
|
||||
The key file should be a single raw binary file (example: ``key.bin``).
|
||||
|
||||
For example, these are the steps to encrypt the file ``my-app.bin`` to flash at offset 0x10000. Run idf.py as follows:
|
||||
For example, these are the steps to encrypt the file ``my-app.bin`` to flash at offset 0x10000. Run ``idf.py`` as follows:
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
|
@ -19,7 +19,7 @@ Secure boot is separate from the :doc:`flash-encryption` feature, and you can us
|
||||
|
||||
.. note::
|
||||
|
||||
In this guide, most used commands are in the form of ``idf.py secure-<command>``, which is a wrapper around corresponding ``espsecure.py <command>``. The idf.py-based commands provides more user-friendly experience, although may lack some of the advanced functionality of their espsecure.py-based counterparts.
|
||||
In this guide, most used commands are in the form of ``idf.py secure-<command>``, which is a wrapper around corresponding ``espsecure.py <command>``. The ``idf.py`` based commands provides more user-friendly experience, although may lack some of the advanced functionality of their ``espsecure.py`` based counterparts.
|
||||
|
||||
Background
|
||||
----------
|
||||
|
@ -11,7 +11,7 @@ This guide provides an overview of the overall security features available in va
|
||||
|
||||
.. note::
|
||||
|
||||
In this guide, most used commands are in the form of ``idf.py secure-<command>``, which is a wrapper around corresponding ``espsecure.py <command>``. The idf.py-based commands provides more user-friendly experience, although may lack some of the advanced functionality of their espsecure.py-based counterparts.
|
||||
In this guide, most used commands are in the form of ``idf.py secure-<command>``, which is a wrapper around corresponding ``espsecure.py <command>``. The ``idf.py`` based commands provides more user-friendly experience, although may lack some of the advanced functionality of their ``espsecure.py`` based counterparts.
|
||||
|
||||
Goals
|
||||
-----
|
||||
@ -245,7 +245,7 @@ Anti-Rollback Protection
|
||||
|
||||
Anti-rollback protection feature ensures that device only executes the application that meets the security version criteria as stored in its eFuse. So even though the application is trusted and signed by legitimate key, it may contain some revoked security feature or credential. Hence, device must reject any such application.
|
||||
|
||||
ESP-IDF allows this feature for the application only and it is managed through 2nd stage bootloader. The security version is stored in the device eFuse and it is compared against the application image header during both bootup and over-the-air updates.
|
||||
ESP-IDF allows this feature for the application only and it is managed through 2nd stage bootloader. The security version is stored in the device eFuse and it is compared against the application image header during both boot-up and over-the-air updates.
|
||||
|
||||
Please see more information to enable this feature in the :ref:`anti-rollback` guide.
|
||||
|
||||
|
@ -5,12 +5,15 @@ flash 加密
|
||||
|
||||
{IDF_TARGET_ESP32_V3_ONLY:default="", esp32="(ESP32 V3 only)"}
|
||||
|
||||
{IDF_TARGET_ENCRYPT_COMMAND:default="espsecure.py encrypt_flash_data --aes_xts", esp32="espsecure.py encrypt_flash_data"}
|
||||
{IDF_TARGET_ENCRYPT_COMMAND:default="idf.py secure-encrypt-flash-data --aes-xts", esp32="idf.py secure-encrypt-flash-data"}
|
||||
|
||||
:link_to_translation:`en:[English]`
|
||||
|
||||
本文档旨在引导用户快速了解 {IDF_TARGET_NAME} 的 flash 加密功能,通过应用程序代码示例向用户演示如何在开发及生产过程中测试及验证 flash 加密的相关操作。
|
||||
|
||||
.. note::
|
||||
|
||||
在本指南中,最常用的命令形式为 ``idf.py secure-<command>``,这是对应 ``espsecure.py <command>`` 的封装。基于 ``idf.py`` 的命令能提供更好的用户体验,但与基于 ``espsecure.py`` 的命令相比,可能会损失一部分高级功能。
|
||||
|
||||
概述
|
||||
------
|
||||
@ -359,7 +362,7 @@ flash 加密设置
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
espsecure.py generate_flash_encryption_key my_flash_encryption_key.bin
|
||||
idf.py secure-generate-flash-encryption-key my_flash_encryption_key.bin
|
||||
|
||||
.. only:: SOC_FLASH_ENCRYPTION_XTS_AES_256
|
||||
|
||||
@ -367,20 +370,20 @@ flash 加密设置
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
espsecure.py generate_flash_encryption_key my_flash_encryption_key.bin
|
||||
idf.py secure-generate-flash-encryption-key my_flash_encryption_key.bin
|
||||
|
||||
如果 :ref:`生成的 XTS-AES 密钥大小 <CONFIG_SECURE_FLASH_ENCRYPTION_KEYSIZE>` 是 AES-256(512 位密钥):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
espsecure.py generate_flash_encryption_key --keylen 512 my_flash_encryption_key.bin
|
||||
idf.py secure-generate-flash-encryption-key --keylen 512 my_flash_encryption_key.bin
|
||||
|
||||
|
||||
.. only:: SOC_FLASH_ENCRYPTION_XTS_AES_128 and not SOC_FLASH_ENCRYPTION_XTS_AES_256 and not SOC_EFUSE_CONSISTS_OF_ONE_KEY_BLOCK
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
espsecure.py generate_flash_encryption_key my_flash_encryption_key.bin
|
||||
idf.py secure-generate-flash-encryption-key my_flash_encryption_key.bin
|
||||
|
||||
.. only:: SOC_FLASH_ENCRYPTION_XTS_AES_128 and SOC_EFUSE_CONSISTS_OF_ONE_KEY_BLOCK
|
||||
|
||||
@ -388,13 +391,13 @@ flash 加密设置
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
espsecure.py generate_flash_encryption_key my_flash_encryption_key.bin
|
||||
idf.py secure-generate-flash-encryption-key my_flash_encryption_key.bin
|
||||
|
||||
或者如果 :ref:`生成的 XTS-AES 密钥大小 <CONFIG_SECURE_FLASH_ENCRYPTION_KEYSIZE>` 是由 128 位导出的 AES-128 密钥(SHA256(128 位)):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
espsecure.py generate_flash_encryption_key --keylen 128 my_flash_encryption_key.bin
|
||||
idf.py secure-generate-flash-encryption-key --keylen 128 my_flash_encryption_key.bin
|
||||
|
||||
3. **在第一次加密启动前**,使用以下命令将该密钥烧录到设备上,这个操作只能执行 **一次**。
|
||||
|
||||
@ -996,19 +999,19 @@ JTAG 调试
|
||||
|
||||
密钥文件应该是单个原始二进制文件(例如:``key.bin``)。
|
||||
|
||||
例如,以下是将文件 ``build/my-app.bin`` 进行加密、烧录到偏移量 0x10000 的步骤。运行 ``espsecure.py``,如下所示:
|
||||
例如,以下是将文件 ``my-app.bin`` 进行加密、烧录到偏移量 0x10000 的步骤。如下所示,请运行 ``idf.py``:
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
espsecure.py encrypt_flash_data --keyfile /path/to/key.bin --address 0x10000 --output my-app-ciphertext.bin build/my-app.bin
|
||||
idf.py secure-encrypt-flash-data --keyfile /path/to/key.bin --address 0x10000 --output my-app-ciphertext.bin my-app.bin
|
||||
|
||||
.. only:: not esp32
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
espsecure.py encrypt_flash_data --aes_xts --keyfile /path/to/key.bin --address 0x10000 --output my-app-ciphertext.bin build/my-app.bin
|
||||
idf.py secure-encrypt-flash-data --aes-xts --keyfile /path/to/key.bin --address 0x10000 --output my-app-ciphertext.bin my-app.bin
|
||||
|
||||
然后可以使用 ``esptool.py`` 将文件 ``my-app-ciphertext.bin`` 写入偏移量 0x10000。 关于为 ``esptool.py`` 推荐的所有命令行选项,请查看 idf.py build 成功时打印的输出。
|
||||
|
||||
@ -1018,9 +1021,9 @@ JTAG 调试
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
如果你的 ESP32 在 eFuse 中使用了非默认的 :ref:`FLASH_CRYPT_CONFIG 值 <setting-flash-crypt-config>`,那么则需要向 ``espsecure.py`` 传递 ``--flash_crypt_conf`` 参数以设置匹配的值。如果设备自己设置了 flash 加密就不会出现这种情况,但如果手动烧录 eFuse 来启用 flash 加密就可能发生这种情况。
|
||||
若 ESP32 在 eFuse 中使用了非默认的 :ref:`FLASH_CRYPT_CONFIG 值 <setting-flash-crypt-config>`,则需要向 ``idf.py`` 命令传递 ``--flash-crypt-conf`` 参数以设置匹配的值。如果设备自行设置了 flash 加密就不会出现这种情况,但如果手动烧录 eFuse 来启用 flash 加密就可能发生这种情况。
|
||||
|
||||
``espsecure.py decrypt_flash_data`` 命令可以使用同样的选项(和不同的输入/输出文件)来解密 flash 密文或之前加密的文件。
|
||||
``idf.py decrypt-flash-data`` 命令可以使用同样的选项(和不同的输入/输出文件)来解密 flash 密文或之前加密的文件。
|
||||
|
||||
|
||||
.. only:: SOC_SPIRAM_SUPPORTED and not esp32
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
启用安全启动将限制进一步更新 {IDF_TARGET_NAME}。请仔细阅读本文档,了解启用安全启动的影响。
|
||||
|
||||
.. note::
|
||||
|
||||
在本指南中,最常用的命令形式为 ``idf.py secure-<command>``,这是对应 ``espsecure.py <command>`` 的封装。基于 ``idf.py`` 的命令能提供更好的用户体验,但与基于 ``espsecure.py`` 的命令相比,可能会损失一部分高级功能。
|
||||
|
||||
背景信息
|
||||
----------
|
||||
@ -92,7 +95,7 @@
|
||||
|
||||
3. 根据需要设置其他 menuconfig 选项。需注意,``Bootloader Config`` 选项对应的引导加载程序仅支持烧录一次。随后,退出 menuconfig 并保存配置。
|
||||
|
||||
4. 初次运行 ``idf.py build`` 时,如果找不到签名密钥,将打印错误信息,并提供一个通过 ``espsecure.py generate_signing_key`` 生成签名密钥的命令。
|
||||
4. 初次运行 ``idf.py build`` 时,如果找不到签名密钥,将打印错误信息,并提供一个通过 ``idf.py secure-generate-signing-key`` 生成签名密钥的命令。
|
||||
|
||||
.. important::
|
||||
|
||||
@ -160,7 +163,7 @@
|
||||
生成安全启动签名密钥
|
||||
----------------------------------
|
||||
|
||||
构建系统将提供一个命令,用于通过 ``espsecure.py generate_signing_key`` 生成新的签名密钥。这个命令使用 python-ecdsa 库,而该库则使用 Python 的 ``os.urandom()`` 作为随机数源。
|
||||
构建系统将提供一个命令,用于通过 ``idf.py secure-generate-signing-key`` 生成新的签名密钥。这个命令使用 python-ecdsa 库,而该库则使用 Python 的 ``os.urandom()`` 作为随机数源。
|
||||
|
||||
签名密钥的强度取决于系统的随机数源和所用算法的正确性。对于生产设备,建议从具有高质量熵源的系统生成签名密钥,并使用最佳的可用 EC 密钥生成工具。
|
||||
|
||||
@ -190,17 +193,17 @@
|
||||
|
||||
请在 ``Secure boot public signature verification key`` 下的 menuconfig 中指定公共签名验证密钥的路径,构建安全引导加载程序。
|
||||
|
||||
构建完应用程序镜像和分区表后,构建系统会使用 ``espsecure.py`` 打印签名步骤:
|
||||
构建完应用程序镜像和分区表后,构建系统会使用 ``idf.py`` 打印签名步骤:
|
||||
|
||||
.. code-block::
|
||||
|
||||
espsecure.py sign_data --keyfile PRIVATE_SIGNING_KEY BINARY_FILE
|
||||
idf.py secure-sign-data --version 1 --keyfile PRIVATE_SIGNING_KEY BINARY_FILE
|
||||
|
||||
上述命令将镜像签名附加到现有的二进制文件中,可以使用 `--output` 参数将签名后的二进制文件写入单独的文件:
|
||||
|
||||
.. code-block::
|
||||
|
||||
espsecure.py sign_data --keyfile PRIVATE_SIGNING_KEY --output SIGNED_BINARY_FILE BINARY_FILE
|
||||
idf.py secure-sign-data --version 1 --keyfile PRIVATE_SIGNING_KEY --output SIGNED_BINARY_FILE BINARY_FILE
|
||||
|
||||
|
||||
使用安全启动的建议
|
||||
@ -208,7 +211,7 @@
|
||||
|
||||
* 在具备高质量熵源的系统上生成签名密钥。
|
||||
* 时刻对签名密钥保密,泄漏此密钥将危及安全启动系统。
|
||||
* 不允许第三方查看 ``espsecure.py`` 进行密钥生成或签名过程的任何细节,因为这样容易受到定时或其他侧信道攻击的威胁。
|
||||
* 不允许第三方使用 ``espsecure.py`` 命令或 ``idf.py secure-`` 子命令来观察密钥生成或是签名过程的任何细节,这两个过程都容易受到定时攻击或其他侧信道攻击的威胁。
|
||||
* 在安全启动配置中启用所有安全启动选项,包括 flash 加密、禁用 JTAG、禁用 BASIC ROM 解释器和禁用 UART 引导加载程序的加密 flash 访问。
|
||||
* 结合 :doc:`flash-encryption` 使用安全启动,防止本地读取 flash 内容。
|
||||
|
||||
@ -284,13 +287,13 @@
|
||||
|
||||
安全启动已集成到 ESP-IDF 构建系统中,因此若启用了安全启动,``idf.py build`` 将自动签名应用程序镜像。如果 menuconfig 配置了相应选项,``idf.py bootloader`` 将生成引导加载程序摘要。
|
||||
|
||||
然而,也可以使用 ``espsecure.py`` 工具生成独立的签名和摘要。
|
||||
但也可以通过 ``idf.py secure-`` 子命令生成独立的签名和摘要。
|
||||
|
||||
可以使用以下命令进行二进制镜像签名:
|
||||
|
||||
.. code-block::
|
||||
|
||||
espsecure.py sign_data --keyfile ./my_signing_key.pem --output ./image_signed.bin image-unsigned.bin
|
||||
idf.py secure-sign-data --version 1 --keyfile ./my_signing_key.pem --output ./image_signed.bin image-unsigned.bin
|
||||
|
||||
keyfile 是包含 ECDSA 签名私钥的 PEM 文件。
|
||||
|
||||
@ -298,11 +301,11 @@ keyfile 是包含 ECDSA 签名私钥的 PEM 文件。
|
||||
|
||||
.. code-block::
|
||||
|
||||
espsecure.py digest_secure_bootloader --keyfile ./securebootkey.bin --output ./bootloader-digest.bin build/bootloader/bootloader.bin
|
||||
idf.py secure-digest-secure-bootloader --keyfile ./securebootkey.bin --output ./bootloader-digest.bin bootloader/bootloader.bin
|
||||
|
||||
keyfile 是设备的 32 字节原始安全启动密钥。
|
||||
|
||||
``espsecure.py digest_secure_bootloader`` 命令的输出是一个包含摘要和附加的引导加载程序的独立文件。可以使用以下命令将合并的摘要和引导加载程序烧录到设备上:
|
||||
使用 ``idf.py secure-digest-secure-bootloader`` 命令会输出一个包含摘要及附加引导加载程序的独立文件。可以使用以下命令,将合并的摘要及引导加载程序烧录到设备上:
|
||||
|
||||
.. code-block::
|
||||
|
||||
|
@ -9,6 +9,10 @@
|
||||
|
||||
本指南概述了乐鑫解决方案中可用的整体安全功能。从 **安全** 角度考虑,强烈建议在使用乐鑫平台和 ESP-IDF 软件栈设计产品时参考本指南。
|
||||
|
||||
.. note::
|
||||
|
||||
在本指南中,最常用的命令形式为 ``idf.py secure-<command>``,这是对应 ``espsecure.py <command>`` 的封装。基于 ``idf.py`` 的命令能提供更好的用户体验,但与基于 ``espsecure.py`` 的命令相比,可能会损失一部分高级功能。
|
||||
|
||||
目标
|
||||
----
|
||||
|
||||
@ -45,7 +49,7 @@
|
||||
|
||||
* 在具备高质量熵源的系统上生成签名密钥。
|
||||
* 签名密钥始终保密;签名密钥泄露会危及安全启动系统。
|
||||
* 禁止第三方使用 ``espsecure.py`` 观察密钥生成或签名过程的相关细节,这两个过程都容易受到时序攻击或其他侧信道攻击的影响。
|
||||
* 不允许第三方使用 ``idf.py secure-`` 或 ``espsecure.py`` 命令来观察密钥生成或是签名过程的任何细节,这两个过程都容易受到定时攻击或其他侧信道攻击的威胁。
|
||||
* 确保正确烧录所有安全性 eFuse,包括禁用调试接口以及非必需的启动介质(例如 UART 下载模式)等。
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user