You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Child pages
  • WHM API 1 Functions - convertopensshtoputty
Skip to end of metadata
Go to start of metadata

Description

This function converts an OpenSSH private key to a PuTTY key.

Warning:

Do not transfer private keys over insecure ports.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/convertopensshtoputty?api.version=1&file=KeyFile
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/convertopensshtoputty?api.version=1&file=KeyFile
 Command Line
whmapi1 convertopensshtoputty file=KeyFile


Notes:

  • Unless otherwise noted, you must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
	"data": {
		"key": "PuTTY-User-Key-File-2: ssh-rsa\nEncryption: aes256-cbc\nComment: imported-openssh-key\nPublic-Lines:12\nAAAAB3NzaC1yc2EAAAABIwAAAgEAuuth41YYyWABsRKexJXgSMD8FvIBFCptUfZP \n4U/6R41FvL/RS+99kq1WL/KASsKRoEA5uc0axM+iNgZtKuemQYGUZNvN+8X8sC/l \nE6GF7X3Pvj2Ml4AlD7TQv0WQZUp9xn+SlOti+3pYh+S56vzNjvdifO7U5mPGW/81 \n9N4vGhG3ThaAgETwkL33CM2LeNRuvoWpeQcuzEVX2aOvHQZqOvV15fTjZ64ZGL3i \nUDtKmeaHs4tMqgNIUXgn1P1V4TgPvTIfopH8FBX3g1pD15XD3vn+XHLwia0505c5 \n+QM+jElS3HHb0vrrDo3S+8koXLWp07wu/GYrvBd5+MlsSV7bpr7lmWj8uMQjc0ap \neZe+eb/MteadWnqIPeOVuracssCvDLqXEPK2KjhFMPqBTepNhZaJHRfvkodPm43C \n50nhqzrNoxFvXb1rfCjPPqGfhuSZhlCmo2FDiZPKdl0X7bhzDIvMVikyqJP06bqK \ny9iclyQv0VPfyCIx/VDcVclIoUa8A49nAinXHKeUx9QUNBHv8wXdyz7W41jQa+++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b4qotlprLeK \n7dJslpNnrD/MSvbJZ/ZoAX+xyDxUMeq/83Xv30i5/wh00QBY4Cv5NTDU4rPoVmQm \nEWGW5aQx34in4JHY5bK3F4BvVYm7MscKLHoU8/OeKVAgzNcatUgPlN43FG9SX0AE \npP3EYlVADSfULdbfBn9dZDidAiDMXnCv9259J65zA64tuT9XluinHXVs5PA/f5vm \nrZPQhAzGThw7h9L6rGYGfSKd9KYoTwf8kSOA6WU7OEyhfTvCdaW76vPi4CRW2M/Y \nRHX0IUdv3VxfKb4WnXFeQl6LshmGB1T2mbMyfThlqUCGAvPJyWDtZ6OpOUl3CK87 \n3jhFzO7t5wruhuWZ3RcISVsrdqcjgCrKy6Q9y+HbLJoNY40BkJm7f6WeV+hHn7o1 \nod7JiqDGq3Qk+ECEdexvqdRQS7BWgO7xudGFk+WFY02zoGvq5DMviNfsxqhM06P+ \nJgEinB8xPPCOPzi6q8T1y1Pz44gmluM15/QRX4z0Mwz6UQasVC/NsZxdfoNGtCy0 \nc2DAscy4zsiKhZMlLr0loPYycO2bOit6E5eYkrACJR2115/ZgVwzvzdmc/INJCxG\n3TvKYbeuv/tkolt56uJWGfMF2ZrfLJaaQ0iAiUyMep/keLP2bJ4Y97o+03BtQszZ \nzixXvzeQAX97WdBaUJU0C3mCKDOtkv4RWZ8hXV5v0m2tm7xbXVBzF22Pej2iHDKx \nGQkciskBRwQM4bDZorkcO+WnGn6uPbtw5v/AuIUqB1UNAcehWN6UTiFNveP4hLYu \niRGWnZZ+uTbip91PNXSxXzb9yMWV2qSVIsZvud8kpR8ttL26Z4ySUKkFuPrgUeTe\nELnOF3GP6Ixk+IkwxU575w==\nPrivate-MAC: 1dfa6a4c8297d31e4cfadbf61aac8b4c5ca75584\n"
	},
	"metadata": {
		"version": 1,
		"result": 1,
		"command": "convertopensshtoputty",
		"reason": "OK"
	}
}
 Output (XML)
<result>
    <metadata>
        <result>1</result>
        <version>1</version>
        <command>convertopensshtoputty</command>
        <reason>OK</reason>
    </metadata>
    <data>
        <key>
            PuTTY-User-Key-File-2: ssh-rsa Encryption: aes256-cbc Comment: imported-openssh-key Public-Lines: 12 
AAAAB3NzaC1yc2EAAAABIwAAAgEAuuth41YYyWABsRKexJXgSMD8FvIBFCptUfZP 
4U/6R41FvL/RS+99kq1WL/KASsKRoEA5uc0axM+iNgZtKuemQYGUZNvN+8X8sC/l 
E6GF7X3Pvj2Ml4AlD7TQv0WQZUp9xn+SlOti+3pYh+S56vzNjvdifO7U5mPGW/81 
9N4vGhG3ThaAgETwkL33CM2LeNRuvoWpeQcuzEVX2aOvHQZqOvV15fTjZ64ZGL3i 
UDtKmeaHs4tMqgNIUXgn1P1V4TgPvTIfopH8FBX3g1pD15XD3vn+XHLwia0505c5 
+QM+jElS3HHb0vrrDo3S+8koXLWp07wu/GYrvBd5+MlsSV7bpr7lmWj8uMQjc0ap 
eZe+eb/MteadWnqIPeOVuracssCvDLqXEPK2KjhFMPqBTepNhZaJHRfvkodPm43C 
50nhqzrNoxFvXb1rfCjPPqGfhuSZhlCmo2FDiZPKdl0X7bhzDIvMVikyqJP06bqK 
y9iclyQv0VPfyCIx/VDcVclIoUa8A49nAinXHKeUx9QUNBHv8wXdyz7W41jQa+++ 
Ih3Yc4o9rpV95DDmKp7iF6kFk4aVjIWDgEsPTaL28wlvUyazoW5TAGPHDrRJoedU 
ag8KDRNPrGbKYu3CvoINiz0sshyCvr1gjKNG75Cwe+L4hXIkaw8wlCpwFq8VSX70 RS9Pei8= Private-Lines: 28 
bb31s+xsiAv1+pclnmvreEYdxvuVmbeWMjUWJd4Y4TKIAyLEItsXNs078qn1QAZ+ 
Wj6t+0HcnhuUVICHyCyJrp++1g4OtzTAHRczaD5ybhb9ktSe1qlnszKD1Rg5/o+B 
61h6kvMcZyuNSjtPkmqQ3XIh8OFYybB2oJXY7gJQzfRuRwk8dx9YWtIR4438Nbv5 
ecTzGUDWvx+AfYzC4X/UIGiRy8AftfiBQyA+c1OFyg37qM1SLYnZYmIpSf5GsQ3A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EdexvqdRQS7BWgO7xudGFk+WFY02zoGvq5DMviNfsxqhM06P+ 
JgEinB8xPPCOPzi6q8T1y1Pz44gmluM15/QRX4z0Mwz6UQasVC/NsZxdfoNGtCy0 
c2DAscy4zsiKhZMlLr0loPYycO2bOit6E5eYkrACJR2115/ZgVwzvzdmc/INJCxG
3TvKYbeuv/tkolt56uJWGfMF2ZrfLJaaQ0iAiUyMep/keLP2bJ4Y97o+03BtQszZ 
zixXvzeQAX97WdBaUJU0C3mCKDOtkv4RWZ8hXV5v0m2tm7xbXVBzF22Pej2iHDKx 
GQkciskBRwQM4bDZorkcO+WnGn6uPbtw5v/AuIUqB1UNAcehWN6UTiFNveP4hLYu 
iRGWnZZ+uTbip91PNXSxXzb9yMWV2qSVIsZvud8kpR8ttL26Z4ySUKkFuPrgUeTe
ELnOF3GP6Ixk+IkwxU575w== Private-MAC: 1dfa6a4c8297d31e4cfadbf61aac8b4c5ca75584
                                </key>
        </data>
    </result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
userstring

The private key file's owner.

Note:

  • In cPanel & WHM version 11.50 and earlier, this parameter is required.
  • In cPanel & WHM version 11.52 and later, you can specify this parameter, but the system does not use it.

A valid username.

username
file string

Required

The private key file's name.

A valid filename.KeyFile


passphrasestring

The private key file's passphrase.

This parameter defaults to a blank string.

A valid and secure passphrase.12345luggage
keep_fileBoolean

Whether to keep the OpenSSH file on the server after conversion.

This parameter defaults to 1.

  • 1 — Keep the file.
  • 0 — Delete the file.
0

Returns

ReturnTypeDescriptionPossible valuesExample
keystring

The converted key file's text.

A valid string.

 Click to view...
PuTTY-User-Key-File-2: ssh-rsa Encryption: aes256-cbc Comment: imported-openssh-key Public-Lines: 12 
AAAAB3NzaC1yc2EAAAABIwAAAgEAuuth41YYyWABsRKexJXgSMD8FvIBFCptUfZP
4U/6R41FvL/RS+99kq1WL/KASsKRoEA5uc0axM+iNgZtKuemQY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