Tiny SFTP Server fails to read public key file

+1 vote
asked Dec 3, 2020 by CaBabaSiMitralier (130 points)

I am running the Tiny SFTP Server (v1.0.10) with the following config setting:

<add key="userPublicKeyDir" value="c:\Testing\public-keys" />

In that folder I have the following public key file:

C:\Testing\public-keys\openssh-key.pub

This was generated using ssh-keygen and contains the following:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOi5/T8jAV/5/I9TyU8rtpwLAWnqP8DhibX9m56z7wLhcdSeU+v2xlMNh2wir/tC1qfTgN26o72INfYFrD+ZV76LS5RCSsrB4iVWSRgRuEuunXt7M5nWYMsRYMBghRcy1nZVoDwoHyJ21kvhUuleBSwz04QPPRu7Y42ofx7YxIaYi8nZLPZTPyO3zLT/MTLrX/bDfjGe/SVXNRV4QPFZVIZYMsSPYWYPy+RGEpUr+W0KCRU79mhNExpWfk0LI6vORJIyHORnG1G5HTd8Os/MoY+LhbfACTP291iFRMhKmOumzfo/UUWwwMdzEZmTT5cFeeKS0smtfF30S9RRwflxu5 dm\user.name@machine

When I start the Tiny SFTP Server, I get the following error:

User public key 'c:\Testing\public-keys\openssh-key.pub' could not be loaded: Error while decoding key.
No user public keys found in 'c:\Testing\public-keys'.
Public key authentication disabled.

I've tried enabling verbose logging but there is no further information.

Does anybody know what the problem is?

Applies to: Tiny SFTP Server

1 Answer

0 votes
answered Dec 3, 2020 by Lukas Paluzga (890 points)

Try converting the public key to ssh2 format, e.g. using

ssh-keygen.exe -f key.pub -e -m RFC4716 > key2.pub
commented Dec 4, 2020 by CaBabaSiMitralier (130 points)
Thanks, although unfortunately that doesn't appear to have worked.  I get the following error when I start the server:

User public key 'c:\Testing\public-keys\openssh-key2.pub' could not be loaded: Invalid key format


The key is in the following format:

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "2048-bit RSA, converted by dm\user.name@machine from"
AAAAB3NzaC1yc2EAAAADAQABAAABAQDOi5/T8jAV/5/I9TyU8rtpwLAWnqP8DhibX9m56z
7wLhcdSeU+v2xlMNh2wir/tC1qfTgN26o72INfYFrD+ZV76LS5RCSsrB4iVWSRgRuEuunX
t7M5nWYMsRYMBghRcy1nZVoDwoHyJ21kvhUuleBSwz04QPPRu7Y42ofx7YxIaYi8nZLPZT
PyO3zLT/MTLrX/bDfjGe/SVXNRV4QPFZVIZYMsSPYWYPy+RGEpUr+W0KCRU79mhNExpWfk
0LI6vORJIyHORnG1G5HTd8Os/MoY+LhbfACTP291iFRMhKmOumzfo/UUWwwMdzEZmTT5cF
eeKS0smtfF30S9RRwflxu5
---- END SSH2 PUBLIC KEY ----
commented Dec 4, 2020 by Lukas Paluzga (890 points)
It works for me well (Tiny v1.0.10):

...
User public key 'd:\downloads\tiny\keys\key.pub' loaded.
Fingerprint: b4:3a:17:f7:79:aa:01:7a:47:3a:cd:84:29:87:80:2e
Public key authentication enabled.
...

Are you certain that's the file you're loading?
...