> ## Documentation Index
> Fetch the complete documentation index at: https://translations.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Management API を使用した Customer Managed Keys の設定方法を学習します

# Management API を使用して Customer Managed Keys を設定する

Auth0 は、エンベロープ暗号化キー階層の最上位にある Auth0 Environment Root Key を使用して、テナントのシークレットとデータを保護します。Auth0 Environment Root Key と Customer Provided Root Key は、対応する Auth0 Cloud Service Provider (AWS または Azure) のハードウェアセキュリティモジュール (HSM) に保存されます。

<div id="bring-your-own-key">
  ## Bring Your Own Key
</div>

Bring Your Own Key を使用すると、[Key Management Editor ロール](/ja/docs/get-started/manage-dashboard-access/add-dashboard-users)を持つユーザーは、[Auth0 Management API](https://auth0.com/docs/api/management/v2) を使用して、既定の Auth0 Environment Root Key を独自の Customer Provided Root Key に置き換えることができます。お客様は、独自の暗号マテリアルを含む独自の Root Key を安全にアップロードして、次のことを実現できます。

* Environment Root Key に関する独自の鍵生成要件および来歴要件を満たす
* Environment Root Key に関する特定の鍵インストール要件または有効期間要件を満たす
* Customer Provided Root Key のコピーをお客様の施設内に保管する。

<Warning>
  Bring Your Own Key で独自の Customer Provided Root Key をインポートすると、その削除を除き、Customer Provided Root Key のライフサイクル管理を Auth0 が行う権限を暗黙的に取り消すことになります。
</Warning>

次の手順に従って、<Tooltip tip="Management API: お客様が管理タスクを実行できるようにする製品です。" cta="用語集を表示" href="/ja/docs/glossary?term=Management+API">Management API</Tooltip> を使用して Customer Provided Root Key を作成および管理できます。

1. [Create the new encryption key](https://auth0.com/docs/api/management/v2/keys/post-encryption) エンドポイントを呼び出して Bring Your Own Key プロセスを開始し、暗号マテリアルを持たない、事前にアクティブ化された Customer Provided Root Key の `kid` (キー識別子) を取得します。

   <Callout icon="file-lines" color="#0EA5E9" iconType="regular">
     このエンドポイントは、キーの一意の識別子である `kid` 値を返します。
   </Callout>
2. [Create the public wrapping key](https://auth0.com/docs/api/management/v2/keys/post-encryption-wrapping-key) エンドポイントを呼び出して、公開ラッピングキーを作成し、返します。
3. お使いの環境で独自の暗号マテリアルを生成し、それを公開ラッピングキーでラップ (暗号化) して、Wrapped Encryption Key (Customer Provided Root Key) を作成します。
4. [Import the encryption key](https://auth0.com/docs/api/management/v2/keys/post-encryption-key) エンドポイントを呼び出して、Customer Provided Root Key を Auth0 にインポートします。

<div id="cryptographic-material-requirements">
  ## 暗号マテリアルの要件
</div>

キー管理システムを使用して、公開ラッピングキーで独自の暗号マテリアルをラップし、Wrapped Encryption Key を作成します。Auth0 のクラウドサービスプロバイダー (AWS または Azure) に応じて、[CKM\_RSA\_AES\_KEY\_WRAP](https://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226894) アルゴリズムのパラメーターには、次の設定を使用します。

<div id="auth0-on-aws-cloud">
  ### AWS クラウド上の Auth0
</div>

* 公開ラッピングキーの長さ: 3072 ビット
* アルゴリズム: CKG\_MGF1\_SHA256
* CKM\_AES\_KEY\_WRAP\_PAD 用の一時 AES キーの長さ: 256 ビット
* お客様が提供するルートキーのタイプ: 長さ 256 ビットの AES 対称キー

<div id="auth0-on-azure-cloud">
  ### Azure クラウド上の Auth0
</div>

* 公開ラッピングキーの長さ: 2048 ビット
* アルゴリズム: CKG\_MGF1\_SHA-1
* CKM\_AES\_KEY\_WRAP\_PAD 用の一時 AES キー長: 256 ビット
* Customer Provided Root Key のタイプ: 2048 ビットの RSA 秘密鍵
* 秘密鍵のエンコーディング: PKCS #8 - ASN.1 DER

<div id="permissions">
  ## 権限
</div>

暗号化キーのエンドポイントへのアクセスを付与するには、次の権限を使用します。

| 権限                       | 説明                                                                                                                                              |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `read:encryption_keys`   | ユーザーは Auth0 テナント内のキーを検索して取得できます。これには、`/api/v2/keys/encryption` および `/api/v2/keys/encryption/{kid}` エンドポイントの読み取りが含まれます。                          |
| `create:encryption_keys` | ユーザーは、`/api/v2/keys/encryption` および `/api/v2/keys/encryption/{kid}/wrapping-key` エンドポイントを使用して、自身の Customer Provided Root Key と公開ラッピングキーを作成できます。 |
| `delete:encryption_keys` | ユーザーは、`/api/v2/keys/encryption/{kid}` エンドポイントを使用して、自身の Customer Provided Root Key を削除できます。                                                      |
| `update:encryption_keys` | ユーザーは、`/api/v2/keys/encryption/{kid}` エンドポイントを使用して、自身の Customer Provided Root Key をインポートできます。                                                   |

<div id="endpoints">
  ## エンドポイント
</div>

* 既存の現在の Environment Root Key または Customer Provided Root Key、および Tenant Master Key に関する情報を取得するには、[Get all encryption keys](https://auth0.com/docs/api/management/v2/keys/get-encryption-keys) エンドポイントを使用します。
* 指定したキーの情報を取得するには、[Get the encryption key by its key id](https://auth0.com/docs/api/management/v2/keys/get-encryption-key) エンドポイントを使用します。
* 事前有効化された Customer Provided Root Key のプレースホルダーを作成するには、[Create the new encryption key](https://auth0.com/docs/api/management/v2/keys/post-encryption) エンドポイントを使用します。
* 暗号マテリアルをラップするための 公開ラッピングキー を取得するには、[Create the public wrapping key](https://auth0.com/docs/api/management/v2/keys/post-encryption-wrapping-key) エンドポイントを使用します。
* 新しい Customer Provided Root Key マテリアルをインポートするには、[Import the encryption key](https://auth0.com/docs/api/management/v2/keys/post-encryption-key) エンドポイントを使用します。
* 既存の Customer Provided Root Key を削除し、Bring Your Own Keys の使用を停止するには、[Delete the encryption key by its key id](https://auth0.com/docs/api/management/v2/keys/delete-encryption-key) エンドポイントを使用します。キー階層の再暗号化には Auth0 Environment Root Key が使用されます。この操作が既存のデータや認証フローに悪影響を及ぼすことはありません。

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  テナントで Customer Managed Keys 機能が有効になっていない場合、API エンドポイントを呼び出すと、`This feature is not enabled for this tenant` エラーが返されます。
</Callout>
