# 为镜像签名

Source: [https://docs.qualcomm.com/doc/80-70015-11SC/topic/sign-the-images.html](https://docs.qualcomm.com/doc/80-70015-11SC/topic/sign-the-images.html)

镜像签名确保镜像的真实性、完整性和来源。

要刷写镜像，执行以下操作：

1. 有关使用不同的签名方法和安全镜像功能，参见 [SecTools V2: Secure Image User Guide](https://docs.qualcomm.com/bundle/80-NM248-12/resource/80-NM248-12_REV_AB_SecTools_V2__Secure_Image_User_Guide.pdf)。
2. 如果使用本地签名器并使用这些命令生成密钥和证书，参见[生成本地（不安全）根密钥和证书](https://docs.qualcomm.com/doc/80-70015-11SC/topic/generate-local-insecure-root-key-and-certificates.html)。
3. 要为单个镜像签名，运行以下命令，其中 `tz.mbn` 用作示例。
Note: 您可以根据需要替换以**粗体**突出显示的值。

        <meta>/common/sectoolsv2/ext/<platform>/sectools.exe secure-image --sign /path/to/tz.mbn --image-id=TZ --security-profile <meta>/common/sectoolsv2/<chipset>_security_profile.xml --oem-id=0x1 --oem-product-id=0xabcd --anti-rollback-version=0x0 --signing-mode=LOCAL --root-certificate=./OEM-KEYS/qpsa_rootca.cer --ca-certificate=./OEM-KEYS/qpsa_attestca.cer --ca-key=./OEM-KEYS/qpsa_attestca.key --outfile ./signed_images_out/tz.mbnCopy to clipboard
4. 对于应拆分的镜像，使用 `--pil-split` 选项。
5. 要对完整的 metabuild 进行签名，参见以下文档中的命令：[SecTools V2: Metabuild Secure Image User Guide](https://docs.qualcomm.com/bundle/80-NM248-17/resource/80-NM248-17_REV_AB_SecTools_V2__Metabuild_Secure_Image_User_Guide.pdf)。

**Parent Topic:** [启用安全启动](https://docs.qualcomm.com/doc/80-70015-11SC/topic/enable-secure-boot.html)

Last Published: Dec 03, 2024

[Previous Topic
为 RSA 和 ECDSA 生成 SHA-384 哈希](https://docs.qualcomm.com/bundle/publicresource/80-70015-11SC/topics/generate-sha-384-hash-for-rsa-and-ecdsa.md) [Next Topic
生成已签名的 sec.elf 镜像](https://docs.qualcomm.com/bundle/publicresource/80-70015-11SC/topics/generate-signed-sec-elf-image.md)