# 签名镜像

镜像签名是一种安全过程，涉及向数字镜像添加加密签名。此签名用作唯一标识符，用于验证镜像的真实性、完整性和来源。如果没有镜像签名，则无法保证镜像的完整性或可信来源，从而导致潜在的安全漏洞和数据丢失。

请按照以下步骤对镜像进行签名。

1. 您可以使用 SecTools V2 对镜像进行签名。提供不同的签名方法和安全镜像功能。有关更多信息，请参阅 [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-70018-11SC/topic/generate-local-insecure-root-key-and-certificates.html#generate-local-insecure-root-key-and-certificates)。
3. 要对单个镜像进行签名，请运行以下命令，其中 `tz.mbn` 用作示例。

> 
> 
> Note
> 
> 
> 可根据需要替换 oem-id “**0x1**” 和 oem-product-id “**0xabcd**” 的值。

<meta>/common/sectoolsv2/ext/linux/sectools 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.mbn
        Copy to clipboard

    以下是 QCS9075/QCS9100 的示例命令。

> 
> 
> <meta>/common/sectoolsv2/ext/linux/sectools secure-image --sign /path/to/tz.mbn --image-id=TZ --security-profile <meta>/common/sectoolsv2/lemans_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.mbn
>         Copy to clipboard
4. 关于应拆分的镜像，请使用 `--pil-split` 选项。
5. 要签署完整的 metabuild，请使用以下命令。

> 
> 
> ./sectools metabuild-secure-image --image-finder /prj/qct/asw/crmbuilds/snowcone/builds901/PROD/QCM6490.LE.1.0.r1-00186-STD.INT.SL-1/common/build/app/image_finder.py --sign --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 --chipset KODIAK --outdir meta_signing_output/
>         Copy to clipboard

    更多详细信息，请参阅 [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)。

Note

*SecTools* 指南可供具有授权访问权限的许可用户使用。

## 后续步骤

- 要验证软件未被篡改且来自可信来源，请参阅[生成签名的 sec.elf 镜像](https://docs.qualcomm.com/doc/80-70018-11SC/topic/generate-signed-sec-elf-image.html#generate-signed-sec-elf-image)。
- 要将完整的软件镜像写入存储设备以确保设备已更新、功能正常、安全且经过优化，请参阅[刷写镜像](https://docs.qualcomm.com/doc/80-70018-11SC/topic/flash-the-images.html#flash-the-images)。

Last Published: Apr 29, 2025

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