跳到主要内容

创建密钥对

描述

创建一个密钥对,此接口由系统自动产生密钥对,加密有RSA和DSA两种,用于Linux操作系统的云主机。

如果需要自由密钥,可以使用接口CreateKeyPairWithPublic。

请求参数

参数名参数类型是否必填参数说明
ActionString操作方法:CreateKeyPair
RegionString机房标识,取值参见地域列表
NameString名称
EncryptionString加密方式:
  • RSA
  • DSA
  • DescriptionString描述

    返回参数

    名称类型说明
    ActionString执行的操作
    TaskIdString请求标识
    IdString密钥对标识
    PublicKeyString公钥
    PrivateKeyString密钥

    请求示例

    https://api.chinac.com/v2/?Action=CreateKeyPair
    &Region=cn-wuxi1
    &AccessKeyId=6792aa42d288422ab8dd4654dfe727c4
    &Description=%E6%B5%8B%E8%AF%95
    &Encryption=RSA
    &Name=test1
    &公共参数

    返回示例

    {
    "code": 10000,
    "message": "",
    "data": {
    "id": "sk-mf8hh7tael45k",
    "publicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHdtXoKbrwOKzye70KigwFypLoWvTLwHHDL8XD4gJLMnV7fMt03DSliHrDbmfH1cm/Vi+Jrs5c03L0Pn1Q+n9nz0mTNsgQaz6ftkF53Rs87ndQRFxtN6R9I4j3Bmaib8WktpPCmb+wcCXSal9H3fsAZBSoqqrdc0eGW/L4MK+SO1orL \n",
    "privateKey": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpQIBAAKCAQEAx3bV6Cm68DghlH+ckYZY9sFsy/gRkepay13kkYpT3x0juPa5\ny25wQ/0RYsc9adG+6Eu3rfZgpOCo0u+x/IZMIabyB/AB8mYsAZa+EHqZy09E19/4\nWTNaO7WNzZsfRXGl/hOJif/JxUAqVF35m/rIuKVHTS48nIbBjqhoyRydAoGBAK+LSPIXNlNCFn4besoU\nNr8DSkcOFxoj4co6HoJshZeKPJkU/Q5QtFfXa4GRgJj6Ldgb+VIkJGmZreyYt5bL\nzdTz9FDGo3399KJ462EmK6UwYzvCW76Fb5ygVjy4/nTpdVX1TpwmO0VURwI31aUV\nQ2bCvRxxpFAuXBy50aS/CL7vAoGBAIvnnmOqEuw8uLJV7V9fFzo+9Z7k5wgvedQC\nYlEkHJaGteQ5KijTWJYu7MAgJSQct3kc8l/2Kal6fScZt0wlfHdXtu3v+WK/erKV\nFhsqnNrlDaVzUiYJIwN76Yqu9luiBD/gZJXAeiYlYOjIpwgsM3z1n/7PhpyWL+sy\nymxNdBnVAoGABTbnQ0YfFDLxNnYzDCvY30P6bR4ghQQuIVy8B6Fl8rOCHtxtjqHu\nD/HCRWZoghVe3kJIbwYorpV+g73pYnwO6H1Qkw+LIHuCoKaHYH6ufEuPKFva3T+g\n3q4MK3PYNECURJLq/tql19XDBRhvZyL4+8NNrroD83+6p2kuSkqt57A=\n-----END RSA PRIVATE KEY-----\n",
    "TaskId": "esz8h20170829101457298",
    "Action": "CreateKeyPair",
    "TotalCount": 0
    }
    }