Creating a Key Pair

Scenarios

To ensure system security, it is recommended that you use the key pair authentication mode to authorize users who will log in to an edge instance. Therefore, you must use an existing key pair or create one for remote login authentication.

  • Creating a key pair
    If no key pair is available, create a key pair in which the private key can be used for login authentication. You can create a key pair using either of the following methods:
    • (Recommended) Create a key pair on the management console. After you create the key pair, the public key will be automatically stored in the system, and you need to store the private key in a local directory. For details, see Creating a Key Pair on the Management Console.
    • Create a key pair using puttygen.exe. After you create the key pair, you need to store both the public key and private key locally. For details, see Creating a Key Pair Using puttygen.exe. After you create the key pair, import it by following the instructions provided in Importing a Key Pair. Then, you can use the key pair.
  • Using an existing key pair

    If a key pair is available locally, for example, generated using PuTTYgen, you can import the public key on the management console so that the system maintains the public key file. For details, see Importing a Key Pair.

    If you have stored the public key of the existing key pair by clicking Save public key of puttygen.exe, you cannot import the public key to the management console. Troubleshoot the issue and then use this key pair for remote authentication. For details, see Troubleshooting the Issue that a Key Pair Created Using puttygen.exe Cannot Be Imported to the Management Console.

Constraints and Limitations

  • The following encryption algorithms are supported:
    • SSH-2 (RSA, 1024)
    • SSH-2 (RSA, 2048)
    • SSH-2 (RSA, 4096)
  • The private key is one of the most important methods to protect your edge instances during the remote login. To ensure edge instance security, the private key can be downloaded only once. Therefore, keep it secure.

Creating a Key Pair on the Management Console

  1. Log in to the management console.
  2. Hover on the left menu to display Service List. Under Content Delivery & Edge Computing, select Intelligent EdgeCloud.
  3. In the navigation pane on the left, choose Key Pairs, and click Create Key Pair.
  4. Enter the key pair name and click OK.

    An automatically allocated key pair name consists of KeyPair- and a 4-character random number. Change it to a name that is easy to remember, for example, KeyPair-xxxx_iec.

  5. Download the private key file. The file name will be the key pair name you specify with the suffix .pem. Store the private key file in a secure path. In the displayed Information dialog box, click OK.

    You can download the private key file only once, so keep it secure. When you create an edge service, provide the name of your key pair. Each time you log in to the edge instance using SSH, you will need to provide the private key.

Creating a Key Pair Using puttygen.exe

  1. Download and install PuTTY and PuTTYgen.

    https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

    PuTTYgen is a key generator, which you can use to create a key pair that contains a public key and a private key for PuTTY.

  2. Obtain the public and private keys.

    1. Double-click puttygen.exe to switch to the PuTTY Key Generator page.
      Figure 1 PuTTY Key Generator
    2. Click Generate.

      The key generator automatically generates a key pair that contains a public key and a private key. The public key is shown in the red box in Figure 2.

      Figure 2 Obtaining the public and private keys

  3. Copy the public key content and paste it to a .txt file and save the file in a local directory.

    Do not save the public key by clicking Save public key. Storing a public key by clicking Save public key of puttygen.exe will change the format of the public key content. You cannot import such a key to the management console.

  4. Save the private key file.

    The format in which to save your private key varies depending on application scenarios. To ensure the security of your edge instance, you can only download the private key once.

    • Saving the private key in .ppk format
      When you log in to a Linux edge instance using PuTTY, you must use the .ppk private key. To save the private key in .ppk format, perform the following operations:
      1. On the PuTTY Key Generator page, choose File > Save private key.
        Figure 3 Save private key
      2. Save the converted private key, for example, kp-123.ppk, to your local PC.
    • Saving the private key in .pem format
      When you log in to a Linux edge instance using Xshell or attempt to obtain the password for logging in to a Windows edge instance, you must use the .pem private key for authentication. To save the private key in .pem format, perform the following operations:
      1. Choose Conversions > Export OpenSSH key.

        If you intend to use this private file to obtain the password for logging in to a Windows edge instance, when you choose Export OpenSSH key, do not configure Key passphrase. Otherwise, you cannot obtain the password.

        Figure 4 Export OpenSSH key
      2. Save the private key, for example, kp-123.pem, to your local PC.

  5. Import the public key to the system. For details, see "Copying the public key content" in Importing a Key Pair.

Importing a Key Pair

If you store a public key by clicking Save public key of puttygen.exe, the format of the public key content will change. You cannot import such a key to the management console. Therefore, obtain the public key content in the correct format and import the content to the management console. For details, see section Troubleshooting the Issue that a Key Pair Created Using puttygen.exe Cannot Be Imported to the Management Console.

  1. Log in to the management console.
  2. Hover on the left menu to display Service List. Under Content Delivery & Edge Computing, select Intelligent EdgeCloud.
  3. In the navigation pane on the left, choose Key Pairs.
  4. On the right pane, click Import Key Pair.
  5. Use either of the following methods to import the key pair:

    • Selecting a file
      1. On the Import Key Pair page of the management console, click Select File and select the local public key file, for example, the .txt file saved in 3.

        When you import a key pair, ensure that the public key is imported. Otherwise, the importing will fail.

      2. Click OK.

        After you import the public key, you can change its name.

    • Copying the public key content
      1. Copy the content of the public key in .txt file into the Public Key Content text box.
      2. Click OK.