

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# CA 証明書を使用してクライアント証明書を作成する
<a name="create-device-cert"></a>

独自の認証局 (CA) を使用してクライアント証明書を作成できます。クライアント証明書は、使用 AWS IoT 前に に登録する必要があります。クライアント証明書の登録オプションの詳細については、 を参照してください[クライアント証明書の登録](register-device-cert.md)

## クライアント証明書の作成 (CLI)
<a name="create-device-cert-cli"></a>

**注記**  
 AWS IoT コンソールでこの手順を実行することはできません。

**を使用してクライアント証明書を作成するには AWS CLI**

1. キーペアを生成します。

   ```
   openssl genrsa -out device_cert_key_filename.key 2048
   ```

1. クライアント証明書の CSR を作成します。

   ```
   openssl req -new \
       -key device_cert_key_filename.key \
       -out device_cert_csr_filename.csr
   ```

   以下に示しているように、いくつかの情報の入力を求められます。

   ```
   You are about to be asked to enter information that will be incorporated
   into your certificate request.
   What you are about to enter is what is called a Distinguished Name or a DN.
   There are quite a few fields but you can leave some blank
   For some fields there will be a default value,
   If you enter '.', the field will be left blank.
   -----
   Country Name (2 letter code) [AU]:
       State or Province Name (full name) []:
       Locality Name (for example, city) []:
       Organization Name (for example, company) []:
       Organizational Unit Name (for example, section) []:
       Common Name (e.g. server FQDN or YOUR name) []:
       Email Address []:
   
       Please enter the following 'extra' attributes
       to be sent with your certificate request
       A challenge password []:
       An optional company name []:
   ```

1. CSR からクライアント証明書を作成します。

   ```
   openssl x509 -req \
       -in device_cert_csr_filename.csr \
       -CA root_CA_cert_filename.pem \
       -CAkey root_CA_key_filename.key \
       -CAcreateserial \
       -out device_cert_filename.pem \
       -days 500 -sha256
   ```

 この時点で、クライアント証明書は作成されていますが、まだ登録されていません AWS IoT。クライアント証明書を登録する方法とタイミングについては、 を参照してください[クライアント証明書の登録](register-device-cert.md) 