Cannot enable private Key based authentication.

0 votes
asked Aug 15 by Nicholas.Bo (120 points)

I have public and private key files.It was generated by Rebex library and cannot load the file in RebexTinySftpServer.exe(XML config file).

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "Saved by Rebex SSH"
AAAAB3NzaC1yc2EAAAADAQABAAAAgQDTztzXfIePFw6zAOh0mGmozmh6G3cv9LYC
rEF2Ad5PLKMJegPlrd5KxRx7fDvnQEkPC8MaHhX3k2074nW3Cxzv9NTB13bZ3tGi
E4yChxynIG6C0qYHgQ/b9QnfJ+rfdFbVX/hMlGbhBO6mvwqHkkVL1crrpY7T80pv
i4QJ7TITWQ==
---- END SSH2 PUBLIC KEY ----
(The pubic Key file is in .pub extension)

-----BEGIN ENCRYPTED PRIVATE KEY-----
MIICxjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQI52Iz7KJj1kQCAggA
MBQGCCqGSIb3DQMHBAi1W+6h0EuxwwSCAoBJmfg2aG0IuEJPC3mlZ2Cbtiin3ajh
9aN4KpEG+x2IkW9WPLsNg9Jjrsd+tW+5ULAvmZQBtB3t8pn2fpeDnrdhTjD8ZQbP
oCVwuNYhG7sknuUk+QwOZED93+L0EbDLApWymGMnG7XObeh08GQQDiRrWI9lfutp
IUslBjFSCAZCVOxswV2XWtJpWFyYp0Y+F6MXJh/zp3fd6+KVhf6B6KoXimr0dJvh
dFxEktLhl3pp6lxwdt0WFEMbC/zUreqyKOxpkHz9GGm+BrkosqW/hpfqCPy4gJpB
r50cHbC6kRecR+g6evMTA+fc7FNAWvxeABdHNrb8FPSwUy9okaw6xMwAQzWpjP4Y
lADsE5R374hPPmfJB4QmtaIlfz4vYXq2MJugfDUlD++SRqXoNDsRWfJYb1MsfZhl
AEBOv7sr/0OTDuAbk506ju7bc7Otci+Z9AbjzXmaVeAei9glOv+v5tzl0pr2OeKI
qT1HSJKQh8WTaQp58nsdM0Aq52IcZUQuveGjbhNk77nqypyijgtBnlEQBXwwcTwm
JQ/mRkHFaLdXsNUsyc8ZZOtFwMNIhz2g4mjvPgcF5v7kZiQwpilwY47nyBTta0zQ
7YjpnO0p44mUqbeXNeZb0Bvy4TDR0nIQT9vli39nvGc/vR9OH+CGK2IZivfFIXcH
XmbSVraxn5nDu/BlnHl8ijuE/9/rvoIibueE5xWyIovuXmtdTK463j6tYjtJWyUP
i+L0GVmeFH+IlqAx7+3h6K75zlSeNJFIb8I/Vkyi/qsINh5MOwjGjSsvI/hoMAcs
/rbWmGqZ/r01qRwlro90z860/V5vm0+CvCvAPUwV1tmWLX3+g7veEmv0
-----END ENCRYPTED PRIVATE KEY-----

Whenever I tried to load the public key like this
<add key="userPublicKeyDir" value="generated_key.pub"/> the tiny server didn't start.How can I fix this issue?There's no error log.Code to connect from client

1 Answer

0 votes
answered Aug 15 by Lukas Pokorny (93,630 points)

The userPublicKeyDir key is supposed to be a directory path, not a file path. This makes it possible to use multiple public keys. Please create a new directory, copy generated_key.pub into it and specify the directory path (can be relative to RebexTinySftpServer.exe's directory) in userPublicKeyDir key's value.

For example:

<add key="userPublicKeyDir" value="C:\MyServer\PublicKeys" />

Or:

<add key="userPublicKeyDir" value="keys" />

This said, you have actually discovered a bug. The server should still start if the key value is a file path and report an error. We will fix this. Thanks for reporting the issue.

...