CDN加速

SSH密钥对创建

更新时间:2021-06-08 17:24:09
适用产品:边缘云主机

接口描述

实例在创建时可以指定使用密钥对,在此之前需要先创建密钥对。

请求参数

参数名称类型必填描述
keypairobject密钥对组
namestring密钥对名称,必须保持唯一,否则会创建失败
publicKeystring导入的公钥信息。导入公钥最大长度为1024字节。如果未指定该参数,系统将自动生成。

返回参数

参数名称类型描述
keypairobject密钥对对象
namestring密钥对名称
publicKeystring密钥对应publicKey信息
privateKeystring密钥对应privateKey信息,如果请求参数中给了publicKey,则不会返回privateKey,否则返回系统生成的私钥。

示例

示例说明
请求示例
复制
POST /osKeypairs
{
    "keypair": {
        "name": "keypair-1",
        "publicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGgB4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0lRE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYcpSxsIbECHw== Generated-by-Nova",
    }
返回示例
复制
{
    "keypair": {
        "name": "keypair-1",
        "publicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGgB4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0lRE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYcpSxsIbECHw== Generated-by-Nova",
        "privateKey": "-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAqfox1VqNw9CVYriJew6foAw3ab97lgMNIf3mFKIfHjc6dws0
/dqQ/HxRI7h38x+huVfaWhux+Rri57s3Blu1YLg8nxoAVvMT24ZeOmLogOQoNomK
8dHb6Hsg1kWzDd03Jj+UQi7QxjZWJA8qkk94CfY0lDhaQKxHd7Tn2Hxk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