

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在 License Manager 中对许可证进行加密签名
<a name="license-signing"></a>

License Manager 可以对独立软件供应商或代表 ISV 颁发的许可证 AWS Marketplace 进行加密签名。即使在离线环境下，签名也允许供应商在应用程序内验证许可证的完整性和来源。

为了签署许可证，License Manager 使用 AWS KMS key 属于独立软件供应商并在 AWS Key Management Service ()AWS KMS中保护的非对称数据。此客户托管 CMK 由数学上相关的公钥和私钥对组成。当用户申请许可证时，License Manager 会生成一个列出许可证权限的 JSON 对象，并使用私钥对该对象进行签名。签名和纯文本 JSON 对象将返回给用户。提供这些对象的任何一方都可以使用公钥来验证许可证文本是否未被更改，并且许可证是否由私钥的所有者签名。key pair 的私密部分永远不会离开 AWS KMS。有关非对称加密的更多信息 AWS KMS，请参阅[使用对称和非对称](symmetric-asymmetric.html)密钥。

**注意**  
在签署 AWS KMS [https://docs.aws.amazon.com/kms/latest/APIReference/API_Sign.html](https://docs.aws.amazon.com/kms/latest/APIReference/API_Sign.html)和验证许可证时，License Manager 会调用和 [https://docs.aws.amazon.com/kms/latest/APIReference/API_Verify.html](https://docs.aws.amazon.com/kms/latest/APIReference/API_Verify.html)API 操作。CMK 的密钥用法值必须为 [SIGN\_VERIFY](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-usage)，才能用于这些操作。此类 CMK 不能用于加密和解密。

以下工作流程描述了加密签名许可证的颁发：

1. 在 AWS KMS 控制台、API 或 SDK 中，许可证管理员创建一个非对称的客户托管 CMK。CMK 必须有签名和验证的密钥用法，并支持 RSASSA-PSS SHA-256 签名算法。有关更多信息，请参阅[创建非对称 CMKs](https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html#create-asymmetric-cmk)和[如何选择 CMK 配置](https://docs.aws.amazon.com/kms/latest/developerguide/symm-asymm-choose.html)。

1. 在 License Manager 中，许可管理员创建包含 AWS KMS ARN 或 ID 的使用配置。该配置可以指定**借用**和/或**临时**选项。有关更多信息，请参阅[创建卖家颁发的许可证块](https://docs.aws.amazon.com/license-manager/latest/userguide/create-vended-license.html)。

1. 最终用户使用 [https://docs.aws.amazon.com/license-manager/latest/APIReference/API_CheckoutLicense.html](https://docs.aws.amazon.com/license-manager/latest/APIReference/API_CheckoutLicense.html) 或 [https://docs.aws.amazon.com/license-manager/latest/APIReference/API_CheckoutBorrowLicense.html](https://docs.aws.amazon.com/license-manager/latest/APIReference/API_CheckoutBorrowLicense.html) API 操作获取许可证。仅允许在配置了**借用**的许可证上执行 `CheckoutBorrowLicense` 操作。它会返回一个数字签名作为其响应的一部分，同时还会返回列出权限的 JSON 对象。纯文本 JSON 与以下内容类似：

   ```
   {
      "entitlementsAllowed":[
         {
            "name":"EntitlementCount",
            "unit":"Count",
            "value":"1"
         }
      ],
      "expiration":"2020-12-01T00:47:35",
      "issuedAt":"2020-11-30T23:47:35",
      "licenseArn":"arn:aws:license-manager::123456789012:license:l-6585590917ad46858328ff02dEXAMPLE",
      "licenseConsumptionToken":"306eb19afd354ba79c3687b9bEXAMPLE",
      "nodeId":"100.20.15.10",
      "checkoutMetadata":{
         "Mac":"ABCDEFGHI"
      }
   }
   ```