Generating a private key using Putty

Aron Schiffenbauer
Aron Schiffenbauer used Ask the Experts™
on
In trying to create a private key using Putty and then trying to import it using IPswitch. I was given the public key from the  vendor
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Putty is an ssh client.

Putty doesn't generate keypairs, Putty uses keypairs.

To generate a keypair, you'll do something like this...

ssh-keygen -q -N 'unique-long-passphrase' -b 2048 -t rsa -f ~/.ssh/keyfile.rsa -C 'Use for keyfile'

Open in new window


This will produce a keyfile.rsa (private key) + keyfile.rsa.pub (public file) you can use anywhere a keypair is used.
Dr. KlahnPrincipal Software Engineer

Commented:
It is not normally necessary to generate keys for PuTTY, as a server's public key is normally part of the initial interchange.  However, for some specific cases it is required.

https://www.ssh.com/ssh/putty/windows/puttygen

https://www.ssh.com/ssh/putty/linux/puttygen
Your question is not completely clear.

It's not possible to generate a private key from a given public key.  Otherwise, you'd be able to decrypt everyone's keys and eavesdrop on them or take over their sessions.

You probably got a server's public key to verify the identity.  Normally, on linux/unix, you put that server public key in your ~/.ssh/known_hosts file so that you can bypass the initial server fingerprint prompt.  With putty, it's a little trickier, and it's easier to have them give you the server fingeprint so that you can compare it during your first connection.  You'll need to open and convert the key to a REG_SZ value to enter into the registry with the following name format encryption_type@IP_or_Hostname to place into the registry hive at HKCU\Software\SimonTatham\Putty\SshHostKeys\

If you need to generate a private/public key pair to use for ssh keys to a server, then you use puttygen as Dr Klahn linked.  This creates a personal putty private key (ppk) and a public key that you would place on the server.  You then use pagent.exe to load the ppk and connect to the server without having to use your password all the time.
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Aron SchiffenbauerSenior System Analyst

Author

Commented:
Im using a application called IPswitch  to SFTP,I have the public key but to create a connection its asking me for a private key. Can someone please assist me with this?
Thanks
I'm not familiar with paid SSH/SFTP programs such as IPswitch, since ssh tools are available for free or built in to the OS..  Please upload a screen capture to show the window you're referring to.  It's not quite making sense why it would ask for a private key, unless the server may be set to force Public Key Authentication and you have to create a key pair.
Aron SchiffenbauerSenior System Analyst

Author

Commented:
the vendor sent me their public keys. When trying to import them into IPSwitch, its asking me for a private key which I created in GenPutty. The error message is unsupported format.
KeyA.png
keyB.png
keyC.png
You're generally not supposed to send a private key to someone else.  The public key isn't one you're supposed to load that way.  It's one you're supposed to use to compare and verify the server identification.  Normally, you'd just send the fingerprint.  Have you tried connecting to the server using a username and password scheme.

You won't be able to load a public key as a private key.  They're stored in different text formats for a reason.  What instructions did your vendor give you when they sent the key?
Aron SchiffenbauerSenior System Analyst

Author

Commented:
this is what they said For SSH key pair authentication, attached is our SSH key for Test and production.
they gave me the host server, name and two public keys

This is a quote from them

"For SSH key pair authentication, attached is our SSH keys for Test and production.  We preferred authentication method. the vendor requires Partner's SSH public key when they return this form".
If that is the exact text they sent you, then English may not be their first language.

I think they sent you the public keys for you to put in the ~/.ssh/authorized_keys file on your server for them to connect without a password.  It's difficult to exactly decipher what they mean with those sentences.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial