

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

# 在 中建立私有 CA AWS 私有 CA
<a name="create-CA"></a>

您可以使用本節中的程序來建立根 CAs或次級 CAs，進而產生符合您組織需求的可稽核信任關係階層。您可以使用 AWS 管理主控台、 AWS CLI或 的 PCA 部分來建立 CA AWS CloudFormation。

如需更新您已建立之 CA 組態的相關資訊，請參閱 [在 中更新私有 CA AWS 私有憑證授權單位](PCAUpdateCA.md)。

如需有關使用 CA 為您的使用者、裝置和應用程式簽署終端實體憑證的資訊，請參閱 [發行私有終端實體憑證](PcaIssueCert.md)。

**注意**  
從您帳戶的建立時間開始，會針對每個私有 CA 每月向您收取費用。  
如需最新的 AWS 私有 CA 定價資訊，請參閱 [AWS 私有憑證授權單位 定價](https://aws.amazon.com/private-ca/pricing/)。您也可以使用[AWS 定價計算器](https://calculator.aws/#/createCalculator/certificateManager)來預估成本。  


**Topics**
+ [建立私有 CA 的 CLI 範例](#create-ca-cli-examples)

------
#### [ Console ]

**使用 主控台建立私有 CA**

1. <a name="Create-CA-console"></a>完成下列步驟，以使用 建立私有 CA AWS 管理主控台。

   **開始使用 主控台**

   登入 AWS 您的帳戶，並在 開啟 AWS 私有 CA 主控台**[https://console.aws.amazon.com/acm-pca/home](https://console.aws.amazon.com/acm-pca/home)**。
   + 如果您在沒有私有 CAs的區域中開啟主控台，則會顯示簡介頁面。選擇**建立私有 CA**。
   + 如果您要在已建立 CA 的區域中開啟 主控台，則**私有憑證授權機構**頁面會開啟，其中包含您的 CAs清單。選擇**建立 CA**。

1. <a name="PcaCreateCaMode"></a>在**模式選項**下，選擇 CA 所發行憑證的過期模式。
   + **一般用途** – 發行可設定任何過期日期的憑證。這是預設值。
   + **短期憑證** – 發行有效期間最長為 7 天的憑證。在某些情況下，短期有效期間可以取代撤銷機制。

1. <a name="PcaCreateCaType"></a>在主控台的**類型選項**區段中，選擇您要建立的私有憑證授權單位類型。
   + 選擇**根**會建立新的 CA 階層。這個 CA 是以自我簽署的憑證為基礎的。它可做為階層中其他 CAs和終端實體憑證的最終簽署授權。
   + 選擇**次級**會建立 CA，該 CA 必須由階層中其上方的父 CA 簽署。次級 CAs通常用於建立其他次級 CAs或向使用者、電腦和應用程式發行終端實體憑證。
**注意**  
AWS 私有 CA 當您的次級 CA 的父 CA 也由 託管時， 會提供自動簽署程序 AWS 私有 CA。您只需選擇要使用的父 CA。  
您的次級 CA 可能需要由外部信任服務提供者簽署。若是如此， AWS 私有 CA 會為您提供憑證簽署請求 (CSR)，您必須下載並使用該請求來取得已簽署的 CA 憑證。如需詳細資訊，請參閱[安裝由外部父 CA 簽署的次級 CA 憑證](PCACertInstall.md#InstallSubordinateExternal)。

1. <a name="PcaCreateCaName"></a>在**主體辨別名稱選項**下，設定私有 CA 的主體名稱。您必須至少為下列其中一個選項輸入值：
   + **Organization (O)** – 例如，公司名稱
   + **Organization Unit (OU)** – 例如，公司內的部門
   + **國家名稱 (C)** – 兩個字母的國家代碼
   + **狀態或省名稱** – 狀態或省的全名
   + **地區名稱** – 城市的名稱
   + **通用名稱 (CN)** – 識別 CA 的人類可讀取字串。
**注意**  
您可以在發出時套用 APIPassthrough 範本，進一步自訂憑證的主旨名稱。如需詳細資訊和詳細範例，請參閱 [使用 APIPassthrough 範本發行具有自訂主旨名稱的憑證](PcaIssueCert.md#custom-subject-1)。

   由於備份憑證是自我簽署的，因此您為私有 CA 提供的主題資訊可能比公有 CA 包含的內容更為稀疏。如需構成主體辨別名稱的每個值的詳細資訊，請參閱 [RFC 5280](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.4)。

1. <a name="PcaCreateKeyAlg"></a>在**金鑰演算法選項**下，選擇金鑰演算法和演算法強度。預設值為 RSA 2048。您可以從下列演算法中選擇：
   + ML-DSA-44
   + ML-DSA-65
   + ML-DSA-87
   + RSA 2048
   + RSA 3072
   + RSA 4096
   + ECDSA P256
   + ECDSA P384
   + ECDSA P521

1. <a name="PcaCreateRevocation"></a>在**憑證撤銷選項**下，您可以從兩種方法中選擇與使用憑證的用戶端共用撤銷狀態：
   + **啟用 CRL 分佈**
   + **開啟 OCSP**

   您可以為您的 CA 設定這些撤銷選項之一、兩者都無法設定。雖然是選用的，但建議使用 受管撤銷做為[最佳實務](ca-best-practices.md)。在完成此步驟之前，請參閱 [規劃您的 AWS 私有 CA 憑證撤銷方法](revocation-setup.md) 以取得每個方法的優點、可能需要的初步設定，以及其他撤銷功能的相關資訊。
**注意**  
如果您在未設定撤銷的情況下建立 CA，您可以隨時稍後進行設定。如需詳細資訊，請參閱[在 中更新私有 CA AWS 私有憑證授權單位](PCAUpdateCA.md)。

   若要設定**憑證撤銷選項**，請執行下列步驟。

   1. 在**憑證撤銷選項**下，選擇**啟用 CRL 分佈**。

   1. 在 **S3 儲存貯體 URI** 下，從清單中選擇現有的儲存貯體。

      當您指定現有的儲存貯體時，您必須確保為帳戶和儲存貯體停用 BPA。否則，建立 CA 的操作會失敗。如果成功建立 CA，您仍然必須手動連接政策，才能開始產生 CRLs。使用中所述的其中一個政策模式[Amazon S3 中 CRLs存取政策](crl-planning.md#s3-policies)。如需詳細資訊，請參閱[使用 Amazon S3 主控台新增儲存貯體政策。](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-bucket-policy.html)

   1. 展開其他組態選項的 **CRL 設定**。
      + 選擇**啟用分割**以啟用 CRLs的分割。如果您未啟用分割，您的 CA 會受到撤銷憑證數量上限的限制。如需詳細資訊，請參閱 [AWS 私有憑證授權單位 配額](https://docs.aws.amazon.com/general/latest/gr/pca.html#limits_pca)。如需分割 CRLs的詳細資訊，請參閱 [CRL 類型](crl-planning.md#crl-type)。
      + 新增**自訂 CRL 名稱**，為您的 Amazon S3 儲存貯體建立別名。此名稱包含在由 RFC 5280 定義的「CRL 分佈點」延伸中 CA 發行的憑證中。若要透過 IPv6 使用 CRLs，請將其設定為儲存貯體的雙堆疊 S3 端點，如[透過 IPv6 使用 CRLs](crl-planning.md#crl-ipv6)中所述。
      + 新增**自訂路徑**，為 Amazon S3 儲存貯體中的檔案路徑建立 DNS 別名。
      + 輸入 CRL 將保持**有效的有效天數**。預設值為 7 天。對於線上 CRLs，有效期間為 2-7 天很常見。 AWS 私有 CA 會嘗試在指定期間的中點重新產生 CRL。

1. 針對**憑證撤銷選項**，選擇**開啟 OCSP**。

   1. 在**自訂 OCSP 端點 * - 選用***欄位中，您可以為非 Amazon OCSP 端點提供完整網域名稱 (FQDN)。若要透過 IPv6 使用 OCSP，請將此欄位設定為雙堆疊端點，如[透過 IPv6 使用 OCSP](ocsp-customize.md#ocsp-ipv6) 中所述。

當您在此欄位中提供 FQDN 時， 會將 FQDN AWS 私有 CA 插入每個發行憑證的 *Authority Information Access* 延伸，以取代 OCSP AWS 回應程式的預設 URL。當端點收到包含自訂 FQDN 的憑證時，它會查詢 OCSP 回應的定址。若要讓此機制正常運作，您需要採取兩個額外動作：
     + 使用代理伺服器將到達自訂 FQDN 的流量轉送至 OCSP AWS 回應程式。
     + 將對應的 CNAME 記錄新增至您的 DNS 資料庫。
**提示**  
如需使用自訂 CNAME 實作完整 OCSP 解決方案的詳細資訊，請參閱 [自訂 的 OCSP URL AWS 私有 CA](ocsp-customize.md)。

     例如，以下是自訂 OCSP 的 CNAME 記錄，如 Amazon Route 53 所示。  
****    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/privateca/latest/userguide/create-CA.html)
**注意**  
CNAME 的值不得包含通訊協定字首，例如 "http：//" 或 "https：//"。

1. <a name="PcaCreateAddTagsUnder"></a>在**新增標籤**下，您可以選擇為 CA 加上標籤。標籤是做為中繼資料的鍵/值對，可用來識別和整理 AWS 資源。如需 AWS 私有 CA 標籤參數的清單，以及如何在建立後將標籤新增至 CAs的說明，請參閱 [為您的私有 CA 新增標籤](PcaCaTagging.md)。
**注意**  
若要在建立程序期間將標籤連接至私有 CA，CA 管理員必須先將內嵌 IAM 政策與 `CreateCertificateAuthority`動作建立關聯，並明確允許標記。如需詳細資訊，請參閱[Tag-on-create：在建立時將標籤連接至 CA](auth-InlinePolicies.md#tag-on-create)。

1. <a name="PcaCreateAcmPerms"></a>在 **CA 許可選項**下，您可以選擇將自動續約許可委派給 AWS Certificate Manager 服務主體。只有在授予此許可時，ACM 才能自動續約此 CA 產生的私有終端實體憑證。您可以隨時使用 AWS 私有 CA [CreatePermission](https://docs.aws.amazon.com/privateca/latest/APIReference/API_CreatePermission.html) API 或 [create-permission](https://docs.aws.amazon.com/cli/latest/reference/acm-pca/create-permission.html) CLI 命令指派續約許可。

   預設是啟用這些許可。
**注意**  
AWS Certificate Manager 不支援自動續約短期憑證。

1. <a name="PcaCreatePricing"></a>在**定價**下，確認您了解私有 CA 的定價。
**注意**  
如需最新的 AWS 私有 CA 定價資訊，請參閱 [AWS 私有憑證授權單位 定價](https://aws.amazon.com/private-ca/pricing/)。您也可以使用[AWS 定價計算器](https://calculator.aws/#/createCalculator/certificateManager)來預估成本。

1. <a name="complete-create-ca"></a>在您檢查所有輸入資訊的準確性之後，請選擇**建立 CA**。CA 的詳細資訊頁面會開啟，並將其狀態顯示為**待定憑證**。
**注意**  
在詳細資訊頁面上，您可以選擇**動作**、**安裝 CA 憑證**，或稍後返回**私有憑證授權單位**清單並完成適用於您案例的安裝程序，以完成設定 CA：  
[安裝根 CA 憑證](PCACertInstall.md#InstallRoot)
[安裝由 託管的次級 CA 憑證 AWS 私有 CA](PCACertInstall.md#InstallSubordinateInternal)
[安裝由外部父 CA 簽署的次級 CA 憑證](PCACertInstall.md#InstallSubordinateExternal)

------
#### [ CLI ]

使用 [create-certificate-authority](https://docs.aws.amazon.com/cli/latest/reference/acm-pca/create-certificate-authority.html) 命令來建立私有 CA。您必須指定 CA 組態 （包含演算法和主體名稱資訊）、撤銷組態 （如果您計劃使用 OCSP 和/或 CRL)，以及 CA 類型 （根或次級）。組態和撤銷組態詳細資訊包含在您提供做為命令引數的兩個檔案中。您也可以選擇性地設定 CA 使用模式 （用於發行標準或短期憑證）、連接標籤，並提供冪等字符。

如果您要設定 CRL，則必須先有安全的 Amazon S3 儲存貯體，*才能*發出**create-certificate-authority**命令。如需詳細資訊，請參閱[Amazon S3 中 CRLs存取政策](crl-planning.md#s3-policies)。

CA 組態檔案會指定下列資訊：
+ 演算法的名稱
+ 用於建立 CA 私密金鑰的金鑰大小
+ CA 用來簽署自己的憑證簽署請求、CRLs 和 OCSP 回應的簽署演算法類型
+ X.500 主旨資訊

OCSP 的撤銷組態會定義具有下列資訊的`OcspConfiguration`物件：
+ `Enabled` 旗標設定為「true」。
+ （選用） 宣告為 值的自訂 CNAME`OcspCustomCname`。

CRL 的撤銷組態會定義具有下列資訊的`CrlConfiguration`物件：
+ `Enabled` 旗標設定為「true」。
+ CRL 過期期間，以天為單位 (CRL 的有效期間）。
+ 將包含 CRL 的 Amazon S3 儲存貯體。
+ （選用） 決定 CRL 是否可公開存取的 [S3ObjectAcl](https://docs.aws.amazon.com/privateca/latest/APIReference/API_CrlConfiguration.html#privateca-Type-CrlConfiguration-S3ObjectAcl) 值。在此範例中，公開存取會遭到封鎖。如需詳細資訊，請參閱[使用 CloudFront 啟用 S3 封鎖公開存取 (BPA)](crl-planning.md#s3-bpa)。
+ （選用） S3 儲存貯體的 CNAME 別名，包含在 CA 發行的憑證中。如果 CRL 無法公開存取，這將指向分佈機制，例如 Amazon CloudFront。
+ （選用） 具有下列資訊的`CrlDistributionPointExtensionConfiguration`物件：
  + `OmitExtension` 旗標設定為「true」或「false」。這會控制 CDP 延伸模組的預設值是否寫入 CA 發行的憑證。如需 CDP 延伸模組的詳細資訊，請參閱 [判斷 CRL 分佈點 (CDP) URI](crl-planning.md#crl-url)。如果 OmitExtension 為「true」，則無法設定 CustomCname。
+ （選用） S3 儲存貯體中 CRL 的自訂路徑。
+ （選用） [CrlType](https://docs.aws.amazon.com/privateca/latest/APIReference/API_CrlConfiguration.html#privateca-Type-CrlConfiguration-CrlType) 值，決定 CRL 是完成還是分割。如果未提供，CRL 將預設為完成。

**注意**  
您可以透過同時定義`OcspConfiguration`物件和`CrlConfiguration`物件，在相同的 CA 上啟用這兩個撤銷機制。如果您未提供**--revocation-configuration**參數，則預設會停用這兩個機制。如果您稍後需要撤銷驗證支援，請參閱 [更新 CA (CLI)](PCAUpdateCA.md#ca-update-cli)。

如需 CLI 範例，請參閱下一節。

------

## 建立私有 CA 的 CLI 範例
<a name="create-ca-cli-examples"></a>

下列範例假設您已使用有效的預設區域、端點和登入資料來設定`.aws`組態目錄。如需有關設定 AWS CLI 環境的資訊，請參閱[組態和登入資料檔案設定](https://docs.aws.amazon.com/cli/latest/reference/cli-configure-files.html)。為了便於閱讀，我們在範例命令中以 JSON 檔案的形式提供 CA 組態和撤銷輸入。視需要修改範例檔案以供您使用。

除非另有說明，否則所有範例都使用下列`ca_config.txt`組態檔案。

**檔案：ca\$1config.txt**

```
{
   "KeyAlgorithm":"RSA_2048",
   "SigningAlgorithm":"SHA256WITHRSA",
   "Subject":{
      "Country":"US",
      "Organization":"Example Corp",
      "OrganizationalUnit":"Sales",
      "State":"WA",
      "Locality":"Seattle",
      "CommonName":"www.example.com"
   }
}
```

### 範例 1：建立已啟用 OCSP 的 CA
<a name="example_1"></a>

在此範例中，撤銷檔案會啟用預設 OCSP 支援，這會使用 AWS 私有 CA 回應程式來檢查憑證狀態。

**檔案： revoke\$1config.txt for OCSP**

```
{
   "OcspConfiguration":{
      "Enabled":true
   }
}
```

**命令**

```
$ aws acm-pca create-certificate-authority \
     --certificate-authority-configuration file://ca_config.txt \
     --revocation-configuration file://revoke_config.txt \
     --certificate-authority-type "ROOT" \
     --idempotency-token 01234567 \
     --tags Key=Name,Value=MyPCA
```

如果成功，此命令會輸出新 CA 的 Amazon Resource Name (ARN)。

```
{
	"CertificateAuthorityArn":"arn:aws:acm-pca:region:account:
       certificate-authority/CA_ID"
}
```

**命令**

```
$ aws acm-pca create-certificate-authority \
	--certificate-authority-configuration file://ca_config.txt \
	--revocation-configuration file://revoke_config.txt \
	--certificate-authority-type "ROOT" \
	--idempotency-token 01234567 \
	--tags Key=Name,Value=MyPCA-2
```

如果成功，此命令會輸出 CA 的 Amazon Resource Name (ARN)。

```
{
    "CertificateAuthorityArn":"arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566"
}
```

使用下列命令來檢查 CA 的組態。

```
$ aws acm-pca describe-certificate-authority \
      --certificate-authority-arn "arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566" \
      --output json
```

此描述應包含下列區段。

```
"RevocationConfiguration": {
   ...
   "OcspConfiguration": {
      "Enabled": true
   }
   ...
}
```

### 範例 2：建立已啟用 OCSP 和自訂 CNAME 的 CA
<a name="example_2"></a>

在此範例中，撤銷檔案會啟用自訂的 OCSP 支援。`OcspCustomCname` 參數以完整網域名稱 (FQDN) 做為其值。

當您在此欄位中提供 FQDN 時， 會將 FQDN AWS 私有 CA 插入每個發行憑證的 *Authority Information Access* 延伸，以取代 OCSP AWS 回應程式的預設 URL。當端點收到包含自訂 FQDN 的憑證時，它會查詢 OCSP 回應的定址。若要讓此機制正常運作，您需要採取兩個額外動作：
+ 使用代理伺服器將到達自訂 FQDN 的流量轉送至 OCSP AWS 回應程式。
+ 將對應的 CNAME 記錄新增至您的 DNS 資料庫。

**提示**  
如需使用自訂 CNAME 實作完整 OCSP 解決方案的詳細資訊，請參閱 [自訂 的 OCSP URL AWS 私有 CA](ocsp-customize.md)。

例如，以下是自訂 OCSP 的 CNAME 記錄，如 Amazon Route 53 所示。


****  

| 記錄名稱 | Type | 路由政策 | 差異化器 | 值/將流量路由到 | 
| --- | --- | --- | --- | --- | 
|  alternative.example.com  | CNAME | 簡便 | - | proxy.example.com | 

**注意**  
CNAME 的值不得包含通訊協定字首，例如 "http：//" 或 "https：//"。

**檔案： revoke\$1config.txt for OCSP**

```
{
   "OcspConfiguration":{
      "Enabled":true,
      "OcspCustomCname":"alternative.example.com"
   }
}
```

**命令**

```
$ aws acm-pca create-certificate-authority \
	--certificate-authority-configuration file://ca_config.txt \
	--revocation-configuration file://revoke_config.txt \
	--certificate-authority-type "ROOT" \
	--idempotency-token 01234567 \
	--tags Key=Name,Value=MyPCA-3
```

如果成功，此命令會輸出 CA 的 Amazon Resource Name (ARN)。

```
{
    "CertificateAuthorityArn":"arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566"
}
```

使用下列命令來檢查 CA 的組態。

```
$ aws acm-pca describe-certificate-authority \
      --certificate-authority-arn "arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566" \
      --output json
```

此描述應包含下列區段。

```
"RevocationConfiguration": {
   ...
   "OcspConfiguration": {
      "Enabled": true,
      "OcspCustomCname": "alternative.example.com"
   }
   ...
}
```

### 範例 3：使用連接的 CRL 建立 CA
<a name="example_3"></a>

在此範例中，撤銷組態會定義 CRL 參數。

**檔案： revoke\$1config.txt**

```
{
   "CrlConfiguration":{
      "Enabled":true,
      "ExpirationInDays":7,
      "S3BucketName":"amzn-s3-demo-bucket"
   }
}
```

**命令**

```
$ aws acm-pca create-certificate-authority \
      --certificate-authority-configuration file://ca_config.txt \
      --revocation-configuration file://revoke_config.txt \
      --certificate-authority-type "ROOT" \
      --idempotency-token 01234567 \
      --tags Key=Name,Value=MyPCA-1
```

如果成功，此命令會輸出 CA 的 Amazon Resource Name (ARN)。

```
{
    "CertificateAuthorityArn":"arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566"
}
```

使用下列命令來檢查 CA 的組態。

```
$ aws acm-pca describe-certificate-authority \
      --certificate-authority-arn "arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566" \
      --output json
```

此描述應包含下列區段。

```
"RevocationConfiguration": {
   ...
   "CrlConfiguration": {
      "Enabled": true,
      "ExpirationInDays": 7,
      "S3BucketName": "amzn-s3-demo-bucket"
   },
   ...
}
```

### 範例 4：建立已連接 CRL 且已啟用自訂 CNAME 的 CA
<a name="example_4"></a>

在此範例中，撤銷組態會定義包含自訂 CNAME 的 CRL 參數。

**檔案： revoke\$1config.txt**

```
{
   "CrlConfiguration":{
      "Enabled":true,
      "ExpirationInDays":7,
      "CustomCname": "alternative.example.com",
      "S3BucketName":"amzn-s3-demo-bucket"
   }
}
```

**命令**

```
$ aws acm-pca create-certificate-authority \
      --certificate-authority-configuration file://ca_config.txt \
      --revocation-configuration file://revoke_config.txt \
      --certificate-authority-type "ROOT" \
      --idempotency-token 01234567 \
      --tags Key=Name,Value=MyPCA-1
```

如果成功，此命令會輸出 CA 的 Amazon Resource Name (ARN)。

```
{
    "CertificateAuthorityArn":"arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566"
}
```

使用下列命令來檢查 CA 的組態。

```
$ aws acm-pca describe-certificate-authority \
      --certificate-authority-arn "arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566" \
      --output json
```

此描述應包含下列區段。

```
"RevocationConfiguration": {
   ...
   "CrlConfiguration": {
      "Enabled": true,
      "ExpirationInDays": 7,
      "CustomCname": "alternative.example.com",
      "S3BucketName": "amzn-s3-demo-bucket",
   ...
   }
}
```

### 範例 5：建立 CA 並指定使用模式
<a name="example_5"></a>

在此範例中，建立 CA 時會指定 CA 用量模式。如果未指定，用量模式參數預設為 GENERAL\$1PURPOSE。在此範例中， 參數設定為 SHORT\$1LIVED\$1CERTIFICATE，這表示 CA 將發行有效期間最長為 7 天的憑證。在設定撤銷不方便的情況下，快速遭到入侵的短期憑證會在正常操作中過期。因此，此範例 CA 缺少撤銷機制。

**注意**  
AWS 私有 CA 不會對根 CA 憑證執行有效性檢查。

```
$ aws acm-pca create-certificate-authority \
	     --certificate-authority-configuration file://ca_config.txt \
	     --certificate-authority-type "ROOT" \
	     --usage-mode SHORT_LIVED_CERTIFICATE \
	     --tags Key=usageMode,Value=SHORT_LIVED_CERTIFICATE
```

使用 中的 [https://docs.aws.amazon.com/cli/latest/reference/acm-pca/describe-certificate-authority.html](https://docs.aws.amazon.com/cli/latest/reference/acm-pca/describe-certificate-authority.html)命令 AWS CLI 來顯示所產生 CA 的詳細資訊，如下列命令所示：

```
$ aws acm-pca describe-certificate-authority \
	     --certificate-authority-arn arn:aws:acm:region:account:certificate-authority/CA_ID
```

```
{
	   "CertificateAuthority":{
	      "Arn":"arn:aws:acm-pca:region:account:certificate-authority/CA_ID",
	      "CreatedAt":"2022-09-30T09:53:42.769000-07:00",
	      "LastStateChangeAt":"2022-09-30T09:53:43.784000-07:00",
	      "Type":"ROOT",
	      "UsageMode":"SHORT_LIVED_CERTIFICATE",
	      "Serial":"serial_number",
	      "Status":"PENDING_CERTIFICATE",
	      "CertificateAuthorityConfiguration":{
	         "KeyAlgorithm":"RSA_2048",
	         "SigningAlgorithm":"SHA256WITHRSA",
	         "Subject":{
	            "Country":"US",
	            "Organization":"Example Corp",
	            "OrganizationalUnit":"Sales",
	            "State":"WA",
	            "Locality":"Seattle",
	            "CommonName":"www.example.com"
	         }
	      },
	      "RevocationConfiguration":{
	         "CrlConfiguration":{
	            "Enabled":false
	         },
	         "OcspConfiguration":{
	            "Enabled":false
	         }
	      },
	...
```

### 範例 6：為 Active Directory 登入建立 CA
<a name="example_6"></a>

您可以建立適合在 Microsoft Active Directory (AD) 的企業 NTAuth 存放區中使用的私有 CA，在該處可以發行卡片登入或網域控制程式憑證。如需將 CA 憑證匯入 AD 的資訊，請參閱[如何將第三方憑證授權機構 (CA) 憑證匯入 Enterprise NTAuth 存放區](https://learn.microsoft.com/en-us/troubleshoot/windows-server/windows-security/import-third-party-ca-to-enterprise-ntauth-store)。

Microsoft [certutil](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/certutil) 工具可透過叫用 **-dspublish**選項，在 AD 中發佈 CA 憑證。在整個樹系中信任使用 certutil 發佈至 AD 的憑證。使用群組政策，您也可以限制對整個樹系子集的信任，例如網域中的單一網域或一組電腦。若要讓登入正常運作，也必須在 NTAuth 存放區中發佈發行 CA。如需詳細資訊，請參閱[使用群組政策將憑證分發至用戶端電腦](https://learn.microsoft.com/en-us/windows-server/identity/ad-fs/deployment/distribute-certificates-to-client-computers-by-using-group-policy)。

此範例使用下列`ca_config_AD.txt`組態檔案。

**檔案：ca\$1config\$1AD.txt**

```
{
   "KeyAlgorithm":"RSA_2048",
   "SigningAlgorithm":"SHA256WITHRSA",
   "Subject":{
      "CustomAttributes":[
         {
            "ObjectIdentifier":"2.5.4.3",
            "Value":"root CA"
         },
         {
            "ObjectIdentifier":"0.9.2342.19200300.100.1.25",
            "Value":"example"
         },
         {
            "ObjectIdentifier":"0.9.2342.19200300.100.1.25",
            "Value":"com"
         }
      ]
   }
}
```

**命令**

```
$ aws acm-pca create-certificate-authority \
	     --certificate-authority-configuration file://ca_config_AD.txt \
	     --certificate-authority-type "ROOT" \
	     --tags Key=application,Value=ActiveDirectory
```

如果成功，此命令會輸出 CA 的 Amazon Resource Name (ARN)。

```
{
	"CertificateAuthorityArn":"arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566"
	}
```

使用下列命令來檢查 CA 的組態。

```
$ aws acm-pca describe-certificate-authority \
      --certificate-authority-arn "arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566" \
      --output json
```

此描述應包含下列區段。

```
...

"Subject":{
   "CustomAttributes":[
      {
         "ObjectIdentifier":"2.5.4.3",
         "Value":"root CA"
      },
      {
         "ObjectIdentifier":"0.9.2342.19200300.100.1.25",
         "Value":"example"
      },
      {
         "ObjectIdentifier":"0.9.2342.19200300.100.1.25",
         "Value":"com"
      }
   ]
}
...
```

### 範例 7：使用連接的 CRL 和從發行的憑證中省略的 CDP 延伸來建立事項 CA
<a name="example_7"></a>

您可以建立私有 CA，以適配發行Matter 智慧家庭標準的憑證。在此範例中， 中的 CA 組態會`ca_config_PAA.txt`定義事項產品認證授權機構 (PAA)，並將廠商 ID (VID) 設定為 FFF1。

**檔案：ca\$1config\$1PAA.txt**

```
{
   "KeyAlgorithm":"EC_prime256v1",
   "SigningAlgorithm":"SHA256WITHECDSA",
   "Subject":{
      "Country":"US",
      "Organization":"Example Corp",
      "OrganizationalUnit":"SmartHome",
      "State":"WA",
      "Locality":"Seattle",
      "CommonName":"Example Corp Matter PAA",
	  "CustomAttributes":[
      {
        "ObjectIdentifier":"1.3.6.1.4.1.37244.2.1",
        "Value":"FFF1"
      }
    ]
  }
}
```

撤銷組態會啟用 CRLs，並設定 CA 從任何發行的憑證中省略預設 CDP URL。

**檔案： revoke\$1config.txt**

```
{
   "CrlConfiguration":{
      "Enabled":true,
      "ExpirationInDays":7,
      "S3BucketName":"amzn-s3-demo-bucket",
	  "CrlDistributionPointExtensionConfiguration":{
		"OmitExtension":true
	  }
   }
}
```

**命令**

```
$ aws acm-pca create-certificate-authority \
      --certificate-authority-configuration file://ca_config_PAA.txt \
      --revocation-configuration file://revoke_config.txt \
      --certificate-authority-type "ROOT" \
      --idempotency-token 01234567 \
      --tags Key=Name,Value=MyPCA-1
```

如果成功，此命令會輸出 CA 的 Amazon Resource Name (ARN)。

```
{
    "CertificateAuthorityArn":"arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566"
}
```

使用下列命令來檢查 CA 的組態。

```
$ aws acm-pca describe-certificate-authority \
      --certificate-authority-arn "arn:aws:acm-pca:us-east-1:111122223333:certificate-authority/11223344-1234-1122-2233-112233445566" \
      --output json
```

此描述應包含下列區段。

```
"RevocationConfiguration": {
   ...
   "CrlConfiguration": {
      "Enabled": true,
      "ExpirationInDays": 7,
      "S3BucketName": "amzn-s3-demo-bucket",
	  "CrlDistributionPointExtensionConfiguration":{
		"OmitExtension":true
	  }
   },
   ...
}
...
```