

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Impor kunci format PEM dengan CloudHSM CLI
<a name="cloudhsm_cli-key-import-pem"></a>

Gunakan **key import pem** perintah AWS CloudHSM untuk mengimpor kunci format PEM ke modul keamanan perangkat keras (HSM). Anda dapat menggunakannya untuk mengimpor kunci privat yang dihasilkan di luar HSM.

**catatan**  
Gunakan [Ekspor kunci asimetris dengan CloudHSM CLI](cloudhsm_cli-key-generate-file.md) perintah untuk membuat file PEM standar dari kunci publik atau untuk membuat file PEM referensi dari kunci pribadi.

## Jenis pengguna
<a name="cloudhsm_cli-key-import-pem-user-type"></a>

Jenis pengguna berikut dapat menjalankan perintah ini.
+ Pengguna Crypto (CUs)

## Persyaratan
<a name="cloudhsm_cli-key-import-pem-requirements"></a>
+ Untuk menjalankan perintah ini, Anda harus masuk sebagai CU.

## Sintaksis
<a name="cloudhsm_cli-key-import-pem-syntax"></a>

```
aws-cloudhsm > help key import pem
Import key from a PEM file

Usage: key import pem [OPTIONS] --path {{<PATH>}} --label {{<LABEL>}} --key-type-class {{<KEY_TYPE_CLASS>}}
Options:
      --cluster-id {{<CLUSTER_ID>}}
          Unique Id to choose which of the clusters in the config file to run the operation against. If not provided, will fall back to the value provided when interactive mode was started, or error
      --path {{<PATH>}}
          Path where the key is located in PEM format
      --label {{<LABEL>}}
          Label for the imported key
      --key-type-class {{<KEY_TYPE_CLASS>}}
          Key type and class of the imported key [possible values: ec-public, rsa-public]
      --attributes [{{<IMPORT_KEY_ATTRIBUTES>}}...]
          Space separated list of key attributes in the form of KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE for the imported key
  -h, --help
          Print help
```

## Contoh
<a name="cloudhsm_cli-key-import-pem-examples"></a>

Contoh ini menunjukkan bagaimana menggunakan **key import pem** perintah untuk mengimpor kunci publik RSA dari file dalam format PEM.

**Example Contoh: Impor kunci publik RSA**  

```
aws-cloudhsm > key import pem --path /home/example --label example-imported-key --key-type-class rsa-public
{
  "error_code": 0,
  "data": {
    "key": {
      "key-reference": "0x00000000001e08e3",
      "key-info": {
        "key-owners": [
          {
            "username": "cu1",                                   
            "key-coverage": "full"
          }
        ],
        "shared-users": [],
        "key-quorum-values": {
          "manage-key-quorum-value": 0,
          "use-key-quorum-value": 0
        },
        "cluster-coverage": "full"
      },
      "attributes": {
        "key-type": "rsa",
        "label": "example-imported-key",
        "id": "0x",
        "check-value": "0x99fe93",
        "class": "public-key",
        "encrypt": false,
        "decrypt": false,
        "token": true,
        "always-sensitive": false,
        "derive": false,
        "destroyable": true,
        "extractable": true,
        "local": false,
        "modifiable": true,
        "never-extractable": false,
        "private": true,
        "sensitive": false,
        "sign": false,
        "trusted": false,
        "unwrap": false,
        "verify": false,
        "wrap": false,
        "wrap-with-trusted": false,
        "key-length-bytes": 512,
        "public-exponent": "0x010001",
        "modulus": "0x8e9c172c37aa22ed1ce25f7c3a7c936dadc532201400128b044ebb4b96│··3e4930ab910df5a2896eaeb8853cfea0e341227654a8337a7864cc8a87d136f006cfba9e68d0b329│··746c1ad60941668b18699fc8169ff1ec363d0d18292845b2454d6a0b8c5d111b79c047619d460cdf│··be59debbacb66b7abeaf3f3d35dd2b9cfa6b6b7b1258b6866cb4085ac749e9d8552b3a4509e1b86c│··828cc794e22767b4f6b5bc6ff5c96f4b7e60eab305d669cfa2197e85379cb35c659bb58fcd246d48│··d9f6a7f36063b42da025459275aa8e3abedad775387086bd6c198ded868403f4b87ffda5a2d455ac│··aa6cbd00003c31d8d2f51d10cd272b31cf0c4037791f48ad51fb35",
        "modulus-size-bits": 2048
      }
    },
    "message": "Successfully imported key"
  }
}
```

**Example Contoh: Impor kunci publik RSA dengan atribut opsional**  

```
aws-cloudhsm > key import pem --path /home/example --label example-imported-key-with-attributes --key-type-class rsa-public --attributes verify=true
{
  "error_code": 0,
  "data": {
    "key": {
      "key-reference": "0x00000000001e08e3",
      "key-info": {
        "key-owners": [
          {
            "username": "cu1",                                      
            "key-coverage": "full"
          }
        ],
        "shared-users": [],
        "key-quorum-values": {
          "manage-key-quorum-value": 0,
          "use-key-quorum-value": 0
        },
        "cluster-coverage": "full"
      },
      "attributes": {
        "key-type": "rsa",
        "label": "example-imported-key-with-attributes",
        "id": "0x",
        "check-value": "0x99fe93",
        "class": "public-key",
        "encrypt": false,
        "decrypt": false,
        "token": true,
        "always-sensitive": false,
        "derive": false,
        "destroyable": true,
        "extractable": true,
        "local": false,
        "modifiable": true,
        "never-extractable": false,
        "private": true,
        "sensitive": false,
        "sign": false,
        "trusted": false,
        "unwrap": false,
        "verify": true,
        "wrap": false,
        "wrap-with-trusted": false,
        "key-length-bytes": 512,
        "public-exponent": "0x010001",
        "modulus": "0x8e9c172c37aa22ed1ce25f7c3a7c936dadc532201400128b044ebb4b96│··3e4930ab910df5a2896eaeb8853cfea0e341227654a8337a7864cc8a87d136f006cfba9e68d0b329│··746c1ad60941668b18699fc8169ff1ec363d0d18292845b2454d6a0b8c5d111b79c047619d460cdf│··be59debbacb66b7abeaf3f3d35dd2b9cfa6b6b7b1258b6866cb4085ac749e9d8552b3a4509e1b86c│··828cc794e22767b4f6b5bc6ff5c96f4b7e60eab305d669cfa2197e85379cb35c659bb58fcd246d48│··d9f6a7f36063b42da025459275aa8e3abedad775387086bd6c198ded868403f4b87ffda5a2d455ac│··aa6cbd00003c31d8d2f51d10cd272b31cf0c4037791f48ad51fb35",
        "modulus-size-bits": 2048
      }
    },
    "message": "Successfully imported key"
  }
}
```

## Pendapat
<a name="cloudhsm_cli-key-import-pem-arguments"></a>

**{{<CLUSTER\_ID>}}**  
ID cluster untuk menjalankan operasi ini pada.  
Diperlukan: Jika beberapa cluster telah [dikonfigurasi](cloudhsm_cli-configs-multi-cluster.md).

**{{<PATH>}}**  
Menentukan path file di mana file kunci berada.  
Wajib: Ya

**{{<LABEL>}}**  
Menentukan label yang ditetapkan pengguna untuk kunci yang diimpor. Ukuran maksimum yang diijinkan `label` adalah 126 karakter.  
Wajib: Ya

**{{<KEY\_TYPE\_CLASS>}}**  
Jenis kunci dan kelas kunci yang dibungkus.  
Kemungkinan nilai:  
+ ec-publik
+ rsa-publik
Wajib: Ya

**{{<IMPORT\_KEY\_ATTRIBUTES>}}**  
Menentukan daftar spasi dipisahkan atribut kunci untuk mengatur untuk kunci diimpor dalam bentuk `KEY_ATTRIBUTE_NAME=KEY_ATTRIBUTE_VALUE` (misalnya,`sign=true`). Untuk daftar atribut kunci yang didukung, lihat[Atribut kunci untuk CloudHSM CLI](cloudhsm_cli-key-attributes.md).  
Wajib: Tidak

## Topik terkait
<a name="cloudhsm_cli-key-import-pem-seealso"></a>
+ [Kategori tanda kripto di CloudHSM CLI](cloudhsm_cli-crypto-sign.md)
+ [Kategori verifikasi kripto di CloudHSM CLI](cloudhsm_cli-crypto-verify.md)