Recently I encountered a cryptic error while using SharpSSH. The error message on the surface read wonderfully detailed: Auth fail. Appearently authorization failed somewhere in the program. After hours of wasted debugging with the source code it seemed to fail in the SignatureDSA.sign() method just as the DSACryptoServiceProvider called the ImportParameters() method with the DSA key.
Needless to say I was astonished to why the authorization was failing, as I had succesfully connected to a test SFTP server using nearly identical login set up as the production server (same login method: no password, DSA 1024 bits private key etc.). Not only that, I could even login to the production SFTP server without problems using both WinSCP and FileZilla.
All of these factors delayed me in figuring out the real cause and the solution. Well, scratch cause (blame SharpSSH), check solution. Turns out the private key was generated with only 1023 bits (missing one small, but yet so significant bit). This seems to happen quite frequently when using Putty Generator for generating key pairs, so watch out. Make sure it says 1024 bits in the signature summary when generating those key pairs *makes movement with arm thus making the statement more clear*!
Oh and I’m not bashing SharpSSH, it’s a great effort by Tamil and a great product for those of us who don’t want to pay yearly licences for trivial, simple file transfers to a SFTP server.
Hopefully this helped out someone.