I tried to write some codes outside of libssh and it works. I will try to merge these codes into libssh and submit a patch.
On Mon, 2009-12-21 at 10:10 +0100, Andreas Schneider wrote: > On Monday 21 December 2009 05:21:29 you wrote: > > Hi, > > Hi, > > > Recently I am trying to use privatekey_from_file without a public key. I > > think I can do it by: > > > > privatekey_from_file -> publickey_from_privatekey -> publickey_to_string > > > > yes, this is the way, but it doesn't work. > > > But in order to call privatekey_from_file, I have to tell it the key > > type (RSA or DSS). Previously I could get the key type from > > publickey_from_file, but now I can't since I don't have the public key > > file. > > That's more or less the problem, we should read the first line and then > comapre it with RSA_HEADER_BEGIN and DSA_HEADER_BEGIN to find out the type. > It > is on my todo list but I haven't had the time to do it. > > > > > I know it's quite easy to tell the keytype from the private key file by > > simply read the first line... but any reason why this cannot be done > > automatically inside libssh? > > > > It should be implemented this way but it isn't. I wanted to do that for > 0.4.1. > If you have time feel free to fix it. > > Read the first line and then comapre it with RSA_HEADER_BEGIN and > DSA_HEADER_BEGIN. Then set the type. > > The next step should be in the auth functions to check for public keys. If > there is none get it from the private key ... > > If you have time, feel free to implement it. I don't know when I will have > the > time to fix it. There is more stuff which needs to be cleaned up. > > Cheers, > > > -- andreas >
