Link to home
Start Free TrialLog in
Avatar of Aron Schiffenbauer
Aron Schiffenbauer

asked on

How to create private keys

I was given public keys by vender , Im trying to connect to server through  WS _FTP utility .  I genertaed a set of keys using putty.  Im trying to import the private key that I created through Putty and receiving an error invalid format when trying to import  as my private keys through WS_FTP.

Thanks
Aron
Avatar of David Favor
David Favor
Flag of United States of America image

You can't connect to any site using a public key.

When a keypair is generated, the public key is added to the site you'll be accessing.

Then the private key is sent to your, which you'll use to access a site.

For example, if you use ssh-keygen to create foo.rsa + foo.rsa.pub, then...

foo.rsa.pub is added to the target site's authorized_keys files.

foo.rsa is then used for ssh connections to the target site.
Avatar of Aron Schiffenbauer
Aron Schiffenbauer

ASKER

but I don't want to regenerate the public keys again, I was already given them by the vendor
? just don't know how import private keys
Thai is what the company sent me If authentication method is SSH key pair, please find the attached SSH public keys for Test and Production.
The vendor's public key / certificate is there to allow you to make sure you're connecting to their servers and not being hit with a man-in-the-middle (MITM) attack. That's usually the only purpose of their public key.

YOUR key pair is different. You're generating a key pair - a private and public key - for your own use.

Basically, your private key is used to generate a digital signature, and your public key is used to validate your digital signature (so you have to provide them with your public key). So it's like an identity - when you connect to a remote server and you're using a key pair for authorization, your system is using your private key to generate this special digital signature that represents you, and then it's being sent over to the remote server. Then the remote server uses your public key (which you provided to them) to check whether your digital signature is valid or not. If it's valid, then it means that the person trying to log in can only be YOU, since YOU should be the only one with access to your private key.

(The above is a bit of an oversimplification of the technical details, but it's conceptually accurate).

If you're using public certificates, then usually the certificates have to be issued by a certificate authority on the remote side, but that all depends on what you're actually doing and whether you need a certificate or just a key pair.
but when I try and connect to the site using those public keys, its asking me for private keys as well. the problem is I don't have the private key.
so your saying either way I have to generate my own set of keys ( public and private)
and send them my public key?
even thought they did not ask me for any public keys?
Lets assume SSH is involved here...

ssh-keygen  will create one KeyValue pair.
(Those cannot be genereted independently.., a public key can be derived from the private key)

So you generate a Keypair in one go.
You KEEP the private key (store it in .ssh local subdirectory or import into putty, or winscp...)

The public key can be sent to any party whose systems you want to access, they will setup an account with the public key put in the authorized_keys file in that account.
For SSH, you're not dealing with certificates - you're dealing with just key pairs. So when you SSH over to the remote server, your computer will get the remote server's public keys. If they match what they sent you separately, then you know you're connecting safely to their servers and not being hit with a MITM attack.
so your saying either way I have to generate my own set of keys ( public and private)
and send them my public key?

Yes, that's correct. If you're on Linux, then this is usually as simple as running ssh-keygen. It will generate both a private and a public key for you.
Im trying to understand, sorry, I should import the public keys named A1 they sent me and great my own set of keys B1 and import the private key from B1 and send them my public key for B1?
Yes, that's correct.
Im still trying to import a private key using IPSWITCH . I created the private using putty, the public keys were supplied to me by the vendor.I receive invalid format when trying to import the private key which again I saved through putty.
I am able to get by importing my public key from my vendor but get invalid format when trying to import saved private key created through putty.
Thanks
Putty has its own format for keys, but you can choose to export them from Putty in a variety of formats. In PuttyGen, there's a "Conversions" menu that lets you export the key in either ssh.com or OpenSSH format. One of those should work, depending on what your system is expecting.

Also, remember that the public key from your vendor is just for validation. It should not be ANY part of generating YOUR public/private key pair.
I just tried creating a key and converted it to both types, still get error message invalid format when trying to import it using IPSWITCH.
I see it was done before sucessfully on this FTP server by anther person before using Putty.
You should probably check the IPSWITCH documentation to see what format it is expecting.
I meant by using putty
can't find any useful information , been trying all day :(
Can you elaborate on the EXACT steps you're taking when trying to import the keys? Example:

1. I run puttygen.
2. I click on button X.
3. I click on menu item X and save it into folder X.
4. In folder X, I see these files: file1, file2.txt, file3.pub, etc...
5. I go into IpSwitch and go to the screen to import the key (screenshot here - black out anything sensitive).
6. I click on button X and it prompts me for the file.
7. I select file X.
8. IpSwitch gives me an error which says... (another screenshot of the exact error)
Maybe the problem is in IPswitch WS_FTP, I'm trying to import public and private keys, instead i begin by clicking on create new key and doing the following. The problem is when I import  in Ipswitch WS_FTP ( the same steps), i don't know where to import too. It does not give me a list of choices.

1) I run Putty Gen and click on generate Keys. (step 1)
2) I see the the public key -PUB File (Step 2)
3) I save private key to a folder on my machine, which holds all the keys. (Step 3)
4)  Trying to create a name for new key in Ipswitch WS_FTP - maybe this is where i go wrong (Step 4).
5) Try to import public key (Step 5)
6) Selected public key (Step 6)
7) I try to import private key which I created in Putty (step 7 and  Step 8)
Thank you
Aron
9) Get invalid format message (step 9)
Step-1.png
Step-2.png
Step-3.png
Step-4.png
Step-5.png
Step-7.png
Step-8.png
Step-9.png
I saw this article, my problem is  i don't see anywhere in IPswitch utility the below option

select From the menu, select Server> Hosts.
I don't the below option select Server> Hosts.
Aron

Importing an SSH user key
If you have an SSH user key from another application (such as an SSH client), you can import it for use with WS_FTP Server.

To import an SSH user key and associate it with a user:

From the menu, select Server > Hosts.  The Hosts page opens.
Select the host to which the user for whom you want to import a key belongs by clicking on the hyperlinked host name. The Host Settings page opens.
From the left navigation menu, select Users. The Users page opens.
Select the user for whom you want to import a key by clicking on the hyperlinked username. The Edit User page appears.
Next to SSH user key, click Select. The Select SSH Key page opens.
Click Import. The Import SSH User Key page opens.
Enter the appropriate information for each of the fields.
Name. Enter a name for the key. This name is for your reference and is never displayed to users.
User key (public). Enter the full path and file name of a key file on your computer, or click Browse.
Click Save.
I see I have to create a trusted host.But I don't see an import button.
I'm unfamiliar with the UI for Steps 3 through 6. It looks like it's trying to generate a new key pair, which you already did with Putty.

So try this:
1. Run puttygen and click on Generate and move the mouse around until the key is prepared.
2. In the Conversions menu/dropdown, click on Export OpenSSH key (the first one, not the new file format one).
3. When it prompts you to save without a password, say yes, and save it as C:\Arons_Folder\id_rsa (no file extension).
4. Highlight EVERYTHING in that top textbox - the one labeled "Public key for pasting into OpenSSH authorized_keysfile:" and copy it to the clipboard.
5. Open up notepad and paste in the contents. The contents should begin with "ssh-rsa" and end with something like "rsa-key-20190305". It'll be one really long line (which might wrap if you have word wrap turned on).
6. Save that file as C:\Arons_Folder\id_rsa.pub
7. Since Notepad likes to add .txt extensions, make sure the file is id_rsa.pub and not id_rsa.pub.txt. Rename if you need to.

Now, I'm not sure how you get to the import public key and private key screens in your UI, but you shouldn't be generating any new key pairs to do it, I don't think. Anyway, try to get to the public key import screen and import C:\Arons_Folder\id_rsa.pub and then for the private key import screen, choose C:\Arons_Folder\id_rsa.

If that still gives you an error, then there's some steps going wrong in the import process. It probably means the keys are imported differently. It's truly hard to say for sure without having the application myself (the last time I used WS_SFTP was almost 20 years ago, and I'd rather not sign up for a trial), but if you still get the same error after the above steps, let me know and I'll sign up and see what the right flow is (alternatively, you could ask their support team for help, too, since it's their product).
But my vender already gave me the public keys. I don’t need to recreate new public keys. I think the vendor did not send me all the information I need.
Thank you for all your time.
Aron
As I mentioned before, these are for YOUR credentials. For now, disregard what the vendor sent you. The vendor's public keys do not play any role in what you're doing at the moment.

The above steps I provided should generate a key pair that will be used for your authentication.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.