

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# Amazon SES 的靜態資料加密
<a name="encryption-rest"></a>

根據預設，Amazon SES 會加密所有靜態資料。根據預設，加密有助於降低保護資料所涉及的操作開銷和複雜性。加密也可讓您建立符合嚴格加密合規和法規要求的 Mail Manager 封存。

SES 提供下列加密選項：
+ **AWS 擁有的金鑰** – SES 預設會使用這些金鑰。您無法檢視、管理或使用 AWS 擁有的金鑰，或稽核其使用方式。不過，您不需要採取任何動作或變更任何程式，即可保護加密您資料的金鑰。如需詳細資訊，請參閱《AWS Key Management Service 開發人員指南》**中的 [AWS 擁有的金鑰](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-owned-cmk)。
+ **客戶受管金鑰** – SES 支援使用您建立、擁有和管理的對稱客戶受管金鑰。由於您可以完全控制加密，因此您可以執行下列任務：
  + 建立和維護金鑰政策
  + 建立和維護 IAM 政策和授予操作
  + 啟用和停用金鑰政策
  + 輪換金鑰密碼編譯資料
  + 新增 標籤
  + 建立金鑰別名
  + 安排金鑰供刪除

  若要使用您自己的金鑰，請在建立 SES 資源時選擇客戶受管金鑰。

  如需更多資訊，請參閱 *AWS Key Management Service 開發人員指南*中的[客戶受管金鑰](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk)。

**注意**  
SES 會免費使用 AWS 擁有的金鑰自動啟用靜態加密。  
不過，使用客戶受管金鑰會產生 AWS KMS 費用。如需定價的詳細資訊，請參閱 [AWS Key Management Service 定價](https://aws.amazon.com/kms/pricing/)。

## 建立客戶自管金鑰
<a name="create-key"></a>

 您可以使用 AWS 管理主控台或 AWS KMS APIs 來建立對稱客戶受管金鑰。

**建立對稱客戶受管金鑰**

遵循《AWS Key Management Service 開發人員指南》**中[建立對稱加密 KMS 金鑰](https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html#create-symmetric-cmk)的步驟。

**注意**  
對於封存，您的金鑰必須符合下列要求：  
金鑰必須為對稱金鑰。
金鑰材料來源必須是 `AWS_KMS`。
金鑰用量必須為 `ENCRYPT_DECRYPT`。

**金鑰政策**

金鑰政策會控制客戶受管金鑰的存取權限。每個客戶受管金鑰都必須只有一個金鑰政策，其中包含決定誰可以使用金鑰及其使用方式的陳述式。在建立客戶受管金鑰時，可以指定金鑰政策。如需詳細資訊，請參閱《AWS Key Management Service 開發人員指南》**中的[管理客戶受管金鑰的存取](https://docs.aws.amazon.com/kms/latest/developerguide/control-access-overview.html#managing-access)。

若要將客戶受管金鑰與 Mail Manager 封存搭配使用，您的金鑰政策必須允許下列 API 操作：
+ [kms:DescribeKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html) – 提供客戶受管金鑰詳細資訊，允許 SES 驗證金鑰。
+ [kms:GenerateDataKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_GenerateDataKey.html) – 允許 SES 產生用於加密靜態資料的資料金鑰。
+ [kms:Decrypt](https://docs.aws.amazon.com/kms/latest/APIReference/API_Decrypt.html) – 允許 SES 先解密儲存的資料，再將其傳回 API 用戶端。

下列範例顯示典型的金鑰政策：

```
{
            "Sid": "Allow SES to encrypt/decrypt",
            "Effect": "Allow",
            "Principal": {
                "Service": "ses.amazonaws.com"
            },
            "Action": [
                "kms:GenerateDataKey",
                "kms:Decrypt",
                "kms:DescribeKey"
            ],
            "Resource": "*"
        },
```

如需詳細資訊，請參閱《 *AWS Key Management Service 開發人員指南*》中的[在政策中指定許可](https://docs.aws.amazon.com/kms/latest/developerguide/control-access-overview.html#overview-policy-elements)。

如需疑難排解的詳細資訊，請參閱《 *AWS Key Management Service 開發人員指南*》中的對[金鑰存取進行疑難排解](https://docs.aws.amazon.com/kms/latest/developerguide/policy-evaluation.html#example-no-iam)。

## 指定 Mail Manager 的客戶受管金鑰
<a name="enable-custom-encryption"></a>

您可以指定客戶受管金鑰做為使用 AWS 擁有金鑰的替代方案。當您使用交互 TLS (mTLS) 身分驗證建立封存或設定輸入端點時，您可以輸入 **KMS 金鑰 ARN 來指定資料金鑰**。對於封存，Mail Manager 會使用 金鑰來加密封存中的所有客戶資料。對於 mTLS 傳入端點，Mail Manager 會使用 金鑰來加密靜態信任存放區內容。
+ **KMS 金鑰 ARN** – AWS KMS 客戶受管金鑰的金鑰[識別符](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id)。輸入金鑰 ID、金鑰 ARN、別名名稱或別名 ARN。

## Amazon SES 加密內容
<a name="location-encryption-context"></a>

[加密內容](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context)是一組選用的金鑰值對，包含資料的其他相關內容資訊。

AWS KMS 使用加密內容做為額外的已驗證資料，以支援已驗證的加密。當您在加密資料的請求中包含加密內容時， 會將加密內容 AWS KMS 繫結至加密的資料。若要解密資料，您必須在請求中包含相同的加密內容。

**注意**  
Amazon SES 不支援建立封存的加密內容。反之，您可以使用 IAM 或 KMS 政策。如需範例政策，請參閱本節[封存建立政策](#archive-creation-policies)稍後的 。

**Amazon SES 加密內容**

SES 在所有 AWS KMS 密碼編譯操作中使用相同的加密內容，其中金鑰為 ，`aws:ses:arn`而值為資源 [Amazon Resource Name](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) (ARN)。

**Example**  

```
"encryptionContext": {
    "aws:ses:arn": "arn:aws:ses:us-west-2:111122223333:ExampleResourceName/ExampleResourceID"
}
```

**使用加密內容進行監控**

當您使用對稱客戶受管金鑰來加密 SES 資源時，您也可以使用稽核記錄和日誌中的加密內容來識別客戶受管金鑰的使用方式。加密內容也會出現在 [AWS CloudTrail 或 Amazon CloudWatch Logs 產生的日誌](#example-custom-encryption)中。

**使用加密內容控制對客戶受管金鑰的存取**

您也可以在金鑰政策和 IAM 政策中，使用加密內容作為 `conditions` 來控制對於對稱客戶受管金鑰的存取。您也可以在授予中使用加密內容條件。

SES 在授予中使用加密內容限制條件，以控制對您帳戶或區域中客戶受管金鑰的存取。授予條件會要求授予允許的操作使用指定的加密內容。

**Example**  
以下是授予特定加密內容之客戶受管金鑰存取權的金鑰政策陳述式範例。此政策陳述式中的條件會要求具有指定加密內容的加密內容條件。  

```
{
    "Sid": "Enable DescribeKey",
    "Effect": "Allow",
    "Principal": {
        "AWS": "arn:aws:iam::111122223333:role/ExampleReadOnlyRole"
     },
     "Action": "kms:DescribeKey",
     "Resource": "*"
},
{
     "Sid": "Enable CreateGrant",
     "Effect": "Allow",
     "Principal": {
         "AWS": "arn:aws:iam::111122223333:role/ExampleReadOnlyRole"
     },
     "Action": "kms:CreateGrant",
     "Resource": "*",
     "Condition": {
         "StringEquals": {
             "kms:EncryptionContext:aws:ses:arn": "arn:aws:ses:us-west-2:111122223333:ExampleResourceName/ExampleResourceID"
          }
     }
}
```

## 封存建立政策
<a name="archive-creation-policies"></a>

下列範例政策示範如何啟用封存建立。這些政策適用於所有資產。

**IAM 政策**

```
{
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "ses:CreateArchive",
            "Resource": [
                "*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "kms:DescribeKey",
                "kms:GenerateDataKey",
                "kms:Decrypt"
            ],
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "kms:ViaService": "ses.us-east-1.amazonaws.com",
                    "kms:CallerAccount": "012345678910"
                }
            }
        }
```

**AWS KMS 政策**

```
{
            "Sid": "Allow SES to encrypt/decrypt",
            "Effect": "Allow",
            "Principal": {
                "Service": "ses.amazonaws.com"
            },
            "Action": [
                "kms:GenerateDataKey",
                "kms:Decrypt",
                "kms:DescribeKey"
            ],
            "Resource": "*"
        },
```

## 輸入端點 mTLS 政策
<a name="ingress-endpoint-mtls-policies"></a>

下列範例政策可讓 使用客戶受管金鑰，在 Mail Manager 輸入端點上加密互斥 TLS (mTLS) 身分驗證的信任存放區內容。

若要將範例政策範圍限定為特定輸入端點，請將 條件中的萬用字元取代為確切的資源 ARN （例如 `arn:aws:ses:us-east-1:111122223333:mailmanager-ingress-point/inp-ab1c2defgh3ij4klmno5pq6rs`)。

**IAM 政策**

```
{
    "Effect": "Allow",
    "Principal": {
      "AWS": "arn:aws:iam::111122223333:role/rolename"
    },
    "Action": [
      "kms:GenerateDataKey",
      "kms:Decrypt"
    ],
    "Resource": "*",
    "Condition": {
      "StringEquals": {
        "kms:ViaService": "ses.us-east-1.amazonaws.com"
      },
      "StringLike": {
        "kms:EncryptionContext:aws:ses:arn": [
          "arn:aws:ses:us-east-1:111122223333:mailmanager-ingress-point/*"
        ]
      }
    }
  },
  {
    "Effect": "Allow",
    "Principal": {
      "AWS": "arn:aws:iam::111122223333:role/rolename"
    },
    "Action": [
      "kms:DescribeKey"
    ],
    "Resource": "*",
    "Condition": {
      "StringEquals": {
        "kms:ViaService": "ses.us-east-1.amazonaws.com"
      }
    }
  }
```

**AWS KMS 政策**

```
{
    "Effect": "Allow",
    "Principal": {
      "Service": "ses.amazonaws.com"
    },
    "Action": [
      "kms:Decrypt"
    ],
    "Resource": "*",
    "Condition": {
      "StringLike": {
        "aws:SourceArn": [
          "arn:aws:ses:us-east-1:111122223333:mailmanager-ingress-point/*"
        ],
        "kms:EncryptionContext:aws:ses:arn": [
          "arn:aws:ses:us-east-1:111122223333:mailmanager-ingress-point/*"
        ]
      }
    }
  },
  {
    "Effect": "Allow",
    "Principal": {
      "Service": "ses.amazonaws.com"
    },
    "Action": [
      "kms:DescribeKey"
    ],
    "Resource": "*",
    "Condition": {
      "StringLike": {
        "aws:SourceArn": [
          "arn:aws:ses:us-east-1:111122223333:mailmanager-ingress-point/*"
        ]
      }
    }
  }
```

## 監控 Amazon SES 的加密金鑰
<a name="example-custom-encryption"></a>

當您搭配 Amazon SES 資源使用 AWS KMS 客戶受管金鑰時，您可以使用 [AWS CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html)或 [Amazon CloudWatch Logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html) 來追蹤 SES 傳送的請求 AWS KMS。

下列範例是 `GenerateDataKey`、 和 AWS CloudTrail 的事件`Decrypt`，`DescribeKey`用於監控 SES 呼叫的 KMS 操作，以存取客戶受管金鑰加密的資料：

------
#### [ GenerateDataKey ]

當您為資源啟用 AWS KMS 客戶受管金鑰時，SES 會建立唯一的資料表金鑰。它會傳送`GenerateDataKey`請求至 AWS KMS ，以指定資源 AWS KMS的客戶受管金鑰。

當您為 Mail Manager 封存資源啟用 AWS KMS 客戶受管金鑰時，它會在加密靜態封存資料`GenerateDataKey`時使用 。

下面的範例事件會記錄 `GenerateDataKey` 操作：

```
{
    "eventVersion": "1.08",
    "userIdentity": {
        "type": "AWSService",
        "invokedBy": "ses.amazonaws.com"
    },
    "eventTime": "2021-04-22T17:07:02Z",
    "eventSource": "kms.amazonaws.com",
    "eventName": "GenerateDataKey",
    "awsRegion": "us-west-2",
    "sourceIPAddress": "172.12.34.56",
    "userAgent": "ExampleDesktop/1.0 (V1; OS)",
    "requestParameters": {
        "encryptionContext": {
            "aws:ses:arn": "arn:aws:ses:us-west-2:111122223333:ExampleResourceName/ExampleResourceID"
        },
        "keySpec": "AES_256",
        "keyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-123456SAMPLE"
    },
    "responseElements": null,
    "requestID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE",
    "eventID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE",
    "readOnly": true,
    "resources": [
        {
            "accountId": "111122223333",
            "type": "AWS::KMS::Key",
            "ARN": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-123456SAMPLE"
        }
    ],
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "eventCategory": "Management",
    "recipientAccountId": "111122223333",
    "sharedEventID": "57f5dbee-16da-413e-979f-2c4c6663475e"
}
```

------
#### [ Decrypt ]

當您存取加密的資源時，SES 會呼叫 `Decrypt`操作，以使用存放的加密資料金鑰來存取加密的資料。

下面的範例事件會記錄 `Decrypt` 操作：

```
{
    "eventVersion": "1.08",
    "userIdentity": {
        "type": "AWSService",
        "invokedBy": "ses.amazonaws.com"
    },
    "eventTime": "2021-04-22T17:10:51Z",
    "eventSource": "kms.amazonaws.com",
    "eventName": "Decrypt",
    "awsRegion": "us-west-2",
    "sourceIPAddress": "172.12.34.56",
    "userAgent": "ExampleDesktop/1.0 (V1; OS)",
    "requestParameters": {
        "encryptionContext": {
            "aws:ses:arn": "arn:aws:ses:us-west-2:111122223333:ExampleResourceName/ExampleResourceID"
        },
        "keyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-123456SAMPLE",
        "encryptionAlgorithm": "SYMMETRIC_DEFAULT"
    },
    "responseElements": null,
    "requestID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE",
    "eventID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE",
    "readOnly": true,
    "resources": [
        {
            "accountId": "111122223333",
            "type": "AWS::KMS::Key",
            "ARN": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-123456SAMPLE"
        }
    ],
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "eventCategory": "Management",
    "recipientAccountId": "111122223333",
    "sharedEventID": "dc129381-1d94-49bd-b522-f56a3482d088"
}
```

------
#### [ DescribeKey ]

SES 使用 `DescribeKey`操作來驗證與您資源相關聯的客戶受管金鑰是否存在 AWS KMS 於帳戶和區域中。

下面的範例事件會記錄 `DescribeKey` 操作：

```
{
    "eventVersion": "1.08",
    "userIdentity": {
        "type": "AssumedRole",
        "principalId": "AROAIGDTESTANDEXAMPLE:Sampleuser01",
        "arn": "arn:aws:sts::111122223333:assumed-role/Admin/Sampleuser01",
        "accountId": "111122223333",
        "accessKeyId": "AKIAIOSFODNN7EXAMPLE3",
        "sessionContext": {
            "sessionIssuer": {
                "type": "Role",
                "principalId": "AROAIGDTESTANDEXAMPLE:Sampleuser01",
                "arn": "arn:aws:sts::111122223333:assumed-role/Admin/Sampleuser01",
                "accountId": "111122223333",
                "userName": "Admin"
            },
            "webIdFederationData": {},
            "attributes": {
                "mfaAuthenticated": "false",
                "creationDate": "2021-04-22T17:02:00Z"
            }
        },
        "invokedBy": "ses.amazonaws.com"
    },
    "eventTime": "2021-04-22T17:07:02Z",
    "eventSource": "kms.amazonaws.com",
    "eventName": "DescribeKey",
    "awsRegion": "us-west-2",
    "sourceIPAddress": "172.12.34.56",
    "userAgent": "ExampleDesktop/1.0 (V1; OS)",
    "requestParameters": {
        "keyId": "00dd0db0-0000-0000-ac00-b0c000SAMPLE"
    },
    "responseElements": null,
    "requestID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE",
    "eventID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE",
    "readOnly": true,
    "resources": [
        {
            "accountId": "111122223333",
            "type": "AWS::KMS::Key",
            "ARN": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-123456SAMPLE"
        }
    ],
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "eventCategory": "Management",
    "recipientAccountId": "111122223333"
}
```

------

## 進一步了解
<a name="Learn-more-data-at-rest-encryption"></a>

下列資源會提供有關靜態資料加密的詳細資訊。
+ 如需 [AWS Key Management Service 基本概念](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html)的詳細資訊，請參閱《AWS Key Management Service 開發人員指南》**。
+ 如需有關 [AWS Key Management Service的安全最佳實務](https://docs.aws.amazon.com/kms/latest/developerguide/best-practices.html)的詳細資訊，請參閱《AWS Key Management Service 開發人員指南》**。