Private key errors
Hi everyone,
I try to implement ssh connection in my package for atom.io, with private key and I have some problems...
- It's possible to have only the private key file and not the passphrase ? Because without it, I encountered an error which says that I have not...
- With it, I have an other error message
Unable to parse private key while generating public key (expected sequence). I've seen in the library sources but it seems to be the conditionprivKey[0] === 0x30which fails. Any idea ? My private key is not well formated ?
Thank you in advance for your answers :)
You only need a passphrase if your private key is encrypted. Is it possible you could create a new private key using the same parameters that also exhibits the problem that you could then post somewhere so that I could reproduce it?
Also, having a passphrase usually saved in the clear like that is not ideal (unless maybe you prompt for it first). Using an ssh key agent is better for encrypted private keys.
I saw the same issue. Reading in the key as a buffer rather than utf8 or ascii fixed the problem, though I am still seeing authentication errors that I need to track down - those may well be my problem.
@damoore Can you provide an example key file that works when passing as a Buffer but not a string? It should work either way.
I discovered that my ultimate problem was that I was passing in too many parameters. i.e. if I was connecting using a password, then I should not pass in keys and a passphrase. I think even passing them in as undefined caused trouble, but I did not go back and check this. Once I changed my code to pass in just the parameters I was using, everything worked. I am reading my keys now as utf8, which means I get a string rather than a buffer from readFile, so strings work.