This project is read-only.

PrivateKeyFile

Jul 15, 2011 at 3:47 PM

Hi i am trying to assuciate the folowing keyfile but it returns an error, it is connected with the regex can you tell me a way to solve the problem?

 

PuTTY-User-Key-File-2:ssh-rsa

Encryption: none

Comment: rsa-key-20110620

PublicLines:6

AAAAB3NzaC1yc2EAAAABJQAAAQEApd/PknbO8QgAzCQsLJhj6wxAy3XnTFDu1Dd6WYm+2dKuOUpQbZtourU8KiraeSpeqMZdeec1uDCqp4NKXVzf65l+

yHS9DWEX1N0caacDQA/m28N+dpQTE3xc02d1JBBDORRBGfokQNDAf+l74ZxMVm/7provcH/u4LyEv0FqY9otTr2CkSw9zvARgs2e6ruUWXMbiFqTd9jPX

JjiUjQfTYmxOXi+nN+w3vvFYsObid63hYT/fgnrcdWPpvMnQ2PC2Ivg9fHe5rNlYKRB5dNr/qZT8t3TQc/tGFVQYQ/X1MtaUwq3EFugJswOyuNNrpGR+E83dr0e+a9sN0gIoNL8rw==

Private-Lines:14

AAABAGuYF/BNEJxYN95cpwgrfxUBB283uKA0fz2LxPvO+FXwcQKREZM0X5uz0/+tGBc+E+MY4q/v635kwbjD3TWkBt4Csxo94mmLFmCPbGA0+zB5BHLfq/njgf7NNUrbUub1yr09kgMDHm87T

G6lSW+/VBxkUDTLy76YLD6/eLNos7Zi83Rsfb4ksU/FAJ4bxwZsKCF33QKUhc33M9WtAHsd+yborr3j86EWCPNsuwWhBh/kNB5cSpCmsp5l5FrN9K98A9nvPGd+a9a1U6IK2uN3lsAF8nUruC5Klw

Plja62ZCOEFvP3TlYOKuMybx+nShxBa6SF7Ahhfgrq6UeL+PtuQe0AAACBAO7nTmGP3xEy22FYSO1IUnGyFInD9xU0TjtaJaWU3AK4iyRXrqKPDyvUDYAD3bY0Sxg6QWTk+Qca5nHg+dYnsE/bnpK

xIEee9t2/ZIv8vVfNsG7ci3GTVw8lMHdD0g38+RkN/ihHoOUGdstt24qTDoKLFdt2rH25qF7heYR155SNAAAAgQCxvp00fCnwlm+kjBnezde6HnByYGkv+1gkGQiGqjSOuQJ/fQqvICPh6Pv6YOL75Gk

kRx/8+g/mTWddufvNN9RCYkcmeplbsg+mshmkdRMLyOy59wRQZxs1InhJWo9Ey7vzN5n2BA+OV2eCtuXbhUjez5WQHc+pmdzlsiwO/KFtKwAAAIARrn0n03VGUQBlKHCCGKBEsTyAuWCIeujvy

9vjiY/9yZvTwtJ4oUOQiywl7WDYxz0Z7yCyoGvLup9yxDHpO+lLmIwRGzJrFCdsH6LYVWuZKSh7yCdmGAPj9tl1kVS4iZypTHu46c94l4IwP53Tp5c4Am+H3NH2KyZ5iSQfhB809w==

Private-MAC: 657f9550adf169d292d44a2ef74e9eaf0463f04e

 

Thks,

Coordinator
Jul 15, 2011 at 3:51 PM

It looks like you providing key using wrong format.
See this post for some examples.

Hope it helps.

Thanks,
Oleg

Jul 15, 2011 at 3:57 PM

The problem is that this is the format that the client is expecting...i am stucked in this problem...

Jul 15, 2011 at 4:16 PM

any ideas?

Coordinator
Jul 15, 2011 at 4:33 PM

well,

the format that it apears in the post I gave you is a standard form that , at least from what I understand.

Even putty, when it uses its own format, then it converts internally into this one.

So I guess what I sugesst is to write some function which wil convert from your format into this one.

 

Oleg

Jul 18, 2011 at 12:09 PM

I am generating a key with Putty Key, with 2048bits, with SSH-2 RSA in public mode....

can you help?

 

Coordinator
Jul 18, 2011 at 4:42 PM

hhm, I think currently I am not supporting 2048 but not sure.

But i am reimplementing encryptions now, so it could be suported in other platforms, and I am just about to get to private key encryption so I will take a look at 2048 key as well then.

Jul 18, 2011 at 6:03 PM

Hi ogcjme

Please tell me in detail what you are doing to create those keys, exact buttons and everything. I will try help, but I need to know every click you do to create those keys.

Jul 19, 2011 at 9:54 AM

i used the aplication Putty Key Generator Parameters : SSH-2RSA and the option Save Private Key

 

 

Many Thks

Jul 27, 2011 at 6:03 PM

Any news?

 

thks

Coordinator
Jul 27, 2011 at 7:39 PM

sorry, not yet,

 

I did however just done with RSA key encryption.

So now I am doing everything internally.

I want to finish project refactoring to add support for Silverlight and WP7

Almost done with it, I am going to skip DSS support in Silverlight for now.

So as soon as I am done with that, I want to make new release and then I will start working on this and other issues.

 

Also, did you add it as an issue already? if not please do, this way I wont forget about it.

 

Thanks,

Oleg

Coordinator
Jul 29, 2011 at 4:07 PM

Hey,

 

I just created RSA 2048 key and managed to connect using it.

Can you please double check it again and see if it works for you too? Please download latest code from the source code tab.

I reimplemented RSA key authentication, without paying any specific attention to number of bits, but I suspect that new code doesnt care how many bits and still works.

 

I used this command to generate a new RSA 2048 key:

ssh-keygen -t rsa -b 2048

Thanks,

Oleg

Jul 29, 2011 at 4:30 PM
Same error Invalid private key file.

this is so urgent:(



From: [email removed]
To: [email removed]
Date: Fri, 29 Jul 2011 08:08:08 -0700
Subject: Re: PrivateKeyFile [sshnet:265309]

From: olegkap
Hey,

I just created RSA 2048 key and managed to connect using it.
Can you please double check it again and see if it works for you too? Please download latest code from the source code tab.
I reimplemented RSA key authentication, without paying any specific attention to number of bits, but I suspect that new code doesnt care how many bits and still works.

I used this command to generate a new RSA 2048 key:

ssh-keygen -t rsa -b 2048

Thanks,
Oleg
Read the full discussion online.
To add a post to this discussion, reply to this email (sshnet@discussions.codeplex.com)
To start a new discussion for this project, email sshnet@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com
Coordinator
Jul 29, 2011 at 4:48 PM

Can you send me an example of how your private key look like?

Or may be generate a new one that you dont use and can share with me so I could take a look?

The reason you get this exception is because it fails regular expression, that supposed to match all or at least most of private keys.

For example, if you key will match this regular expression:

^-----BEGIN (?\w+) PRIVATE KEY-----\r?\n(Proc-Type: 4,ENCRYPTED\r?\nDEK-Info: (?[A-Z0-9-]+),(?[A-F0-9]{16})\r?\n\r?\n)?(?([a-zA-Z0-9/+=]{1,64}\r?\n)+)-----END \k PRIVATE KEY-----.*

You will not get this error any more.

 

Thanks,

Oleg

Coordinator
Jul 29, 2011 at 4:51 PM

I guess another suggestion is try to generate the key using ssh-keygen like I did and see if it works for you.

 

Thanks,

Oleg

Aug 1, 2011 at 3:33 PM
Hi, thks again for your help , how are you generating your key?
my key is like this:

PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: rsa-key-20110620
Public-Lines: 6
AAAAB3NzaC1yc2EAAAABJQAAAQEAt3NZC4d3LRxgUaDnbMlOQYcLXIIuNPh3mLL0
FcmZf1YASNPLpAc1a7H7lNo27OWkE8NuBrlirsgj0P47ruRUo6yVMtuye6qGnlDb
NLR+Iljo4GCUIfuEVo4jWFFne2FPYs3AxTSJxnKG99VTpn63FeQw/lEAEMEoYqIz
pnEON3pgJsne1E0eDHN32vV+kxQPS/4KwxEQp5FFSisMEP/NQapAE6ad0OGXIHZy
aIJwg63hUk4G/HPiMyIOnsjraj3S9HAidCF2jCkY1LQ1ntJO3bhpED772ZJ3pxZ4
0G9gtgX56KTuF/82w2iQAmWllXzqhn5qgvEjCdDz7wTOZhoJzw==
Private-Lines: 14
AAABAB2/rZMquWFC3y/U50ISzmt9rtC7KhZtey2EzaKrEfj5MHqDNceSd12Se9Ly
9CZqbaJXCuxVafLUWNXIXLSTurLCCltGOJ5urgvVwq6Zz0PXEQHKeOLqhCm2Lz7B
F7MkiWn32hIkMgSBRlGz5A0pTh85wsF060D8unDcCGAuAk4vPjk07EsGiuHyIy4u
QO9PcKYa9xHHZxkmbhdMBsJXY08dp1RiH69/Ur9Ac4Ot9CfglY8lar72zj9wYOUM
vRlEL7NKR9VK1jZz57FtPh/kcowALmTpXsmFcg8KdEN8HjPZhqgz2KklGDw7DdOt
zx3YPThoNqmseCzEpklFIAcyGF0AAACBAPmtZOok9CCLaefgP2NY9YDsTOLjshEQ
V0tC61B5scV14EApHE2YgxMfO5PcBCwGzVoFoODloEDdLAxxM0OZdC10CeG2jX4e
3hZZ1lUoLQ7MctDNpZjzVEf1OO9nsFnlrta7q0Wwc1xQzPoF7DxaCqNF6Qe9kALM
WRbeiW/MkTETAAAAgQC8GJ6Y4LClD7Rhs0OKy7StCgre8bwD0Xeod5WR6N3ODpMi
t4KM03gFuy1riyLi3EztBJu+fTb+zsEB/nHEX6UqBBwwb5vPctWYX2bhXKR9se8k
1E+aYNya/8e8c0Gh5e8PdQ9FqdHE/y9rYx7sA2d4ZL1nBGQ7KWXbofvDwn6X1QAA
AIEAj8kps1Q8GRUyYqF+97SbeMTkvQzg2nm8bQ+6WHwEVYw+g8zOZWElRR5ezO+2
+wme27lZ9TToNWD1zrdJsv3D2QsUHGsI8KMrO+OSmSfWLkmCV6uFE3jIxLErvaIY
lH0S8yK/qpdoLtoS8q/65+X96MZK9E41HokSwjwvCfhF0MI=
Private-MAC: d1631f29c91dabfe638c9234c966993c7bca2546

i have created in putty key generator.






From: [email removed]
To: [email removed]
Date: Fri, 29 Jul 2011 08:48:48 -0700
Subject: Re: PrivateKeyFile [sshnet:265309]

From: olegkap
Can you send me an example of how your private key look like?
Or may be generate a new one that you dont use and can share with me so I could take a look?
The reason you get this exception is because it fails regular expression, that supposed to match all or at least most of private keys.
For example, if you key will match this regular expression:

^-----BEGIN (?\w+) PRIVATE KEY-----\r?\n(Proc-Type: 4,ENCRYPTED\r?\nDEK-Info: (?[A-Z0-9-]+),(?[A-F0-9]{16})\r?\n\r?\n)?(?([a-zA-Z0-9/+=]{1,64}\r?\n)+)-----END \k PRIVATE KEY-----.*

You will not get this error any more.

Thanks,
Oleg
Read the full discussion online.
To add a post to this discussion, reply to this email (sshnet@discussions.codeplex.com)
To start a new discussion for this project, email sshnet@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com
Coordinator
Aug 1, 2011 at 3:37 PM

I generated my key using ssh-keygen.

 

I used this as a refernce.

 

Putty creates a little bit different key, well, its the same but formatted differently.

I know there is a way to convert it from one form to another but dont remeber how.

I know for sure that you can use the key, that was generated by ssh-keygen utility and convert it into the putty version, so I guess there should be a way back.

 

Thanks,

Oleg

Aug 2, 2011 at 9:21 PM
Hi, the key they are asking is a putty generated key, i will try with ssh, how do you create it?


thks


From: [email removed]
To: [email removed]
Date: Mon, 1 Aug 2011 07:37:38 -0700
Subject: Re: PrivateKeyFile [sshnet:265309]

From: olegkap
I generated my key using ssh-keygen.

I used this as a refernce.

Putty creates a little bit different key, well, its the same but formatted differently.
I know there is a way to convert it from one form to another but dont remeber how.
I know for sure that you can use the key, that was generated by ssh-keygen utility and convert it into the putty version, so I guess there should be a way back.

Thanks,
Oleg
Read the full discussion online.
To add a post to this discussion, reply to this email (sshnet@discussions.codeplex.com)
To start a new discussion for this project, email sshnet@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com
Aug 2, 2011 at 9:47 PM
the problem is that i am using windows 7, and the tool to generate keys is PUTTY, the olcy conversion i found is from ssh-keygen keys to PUTTY...
how can i create ssh keys with windows???






From: [email removed]
To: [email removed]
Date: Mon, 1 Aug 2011 07:37:38 -0700
Subject: Re: PrivateKeyFile [sshnet:265309]

From: olegkap
I generated my key using ssh-keygen.

I used this as a refernce.

Putty creates a little bit different key, well, its the same but formatted differently.
I know there is a way to convert it from one form to another but dont remeber how.
I know for sure that you can use the key, that was generated by ssh-keygen utility and convert it into the putty version, so I guess there should be a way back.

Thanks,
Oleg
Read the full discussion online.
To add a post to this discussion, reply to this email (sshnet@discussions.codeplex.com)
To start a new discussion for this project, email sshnet@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com
Coordinator
Aug 3, 2011 at 1:25 AM

Using PuttyGen import exiting *.ppk and then you will have option to "Save private key" and "Save public key" buttons.

You need private key.

Just save it into the file and then use it in your application.

 

Hope it helps.

 

Thanks,

Oleg

Aug 17, 2011 at 7:55 AM

To convert private key from Putty use this:

  1. open puttygen.exe
  2. in menu - File / Load private key , and load your private key generated by puttygen
  3. in menu - Conversion / Export OpenSSH key, and save private key

this save your putty private key in format that ssh.net library need.

Hope it helps.

Staro

Aug 17, 2011 at 12:04 PM
thanks for yorur help, it worked...

one more problem, is it possible to authentificat with the private keys, and a password?


SshClient SFTPTest = new SshClient(Host,Port, User,Keyfiles);

it is missing the parameter password...

Thks

From: [email removed]
To: [email removed]
Date: Tue, 16 Aug 2011 23:55:14 -0700
Subject: Re: PrivateKeyFile [sshnet:265309]

From: staro
To convert private key from Putty use this:
  1. open puttygen.exe
  2. in menu - File / Load private key , and load your private key generated by puttygen
  3. in menu - Conversion / Export OpenSSH key, and save private key
this save your putty private key in format that ssh.net library need.
Hope it helps.
Staro
Read the full discussion online.
To add a post to this discussion, reply to this email (sshnet@discussions.codeplex.com)
To start a new discussion for this project, email sshnet@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com
Coordinator
Aug 17, 2011 at 2:30 PM

Well,

I support multiple ways of authentication but not all of them at the same time.

So what you can do is try to authenticate using private key first, and if it fails then try to authnticate using password.

or vise versa, depends on the application logic.

That's why I didn't embedded this logic into the library cause I think its up to the developer to decide which one to use first and if any.

 

Thanks,

Oleg

Aug 17, 2011 at 2:36 PM
using modzilla, i use them both to authentificate....is there any way to solve it?



Thks


From: [email removed]
To: [email removed]
Date: Wed, 17 Aug 2011 06:31:04 -0700
Subject: Re: PrivateKeyFile [sshnet:265309]

From: olegkap
Well,
I support multiple ways of authentication but not all of them at the same time.
So what you can do is try to authenticate using private key first, and if it fails then try to authnticate using password.
or vise versa, depends on the application logic.
That's why I didn't embedded this logic into the library cause I think its up to the developer to decide which one to use first and if any.

Thanks,
Oleg
Read the full discussion online.
To add a post to this discussion, reply to this email (sshnet@discussions.codeplex.com)
To start a new discussion for this project, email sshnet@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com
Coordinator
Aug 17, 2011 at 2:41 PM

what to you mean you use both of them?

SSH protocol does not allow to use private key and password methods at the same time, only one method after another.

May be you mean that private key is encrypted and you need to use password(passphrase) to decrypt it?