Loading a OpenSSH public key and saving it as WODC - WeOnlyDo Discussion board

Loading a OpenSSH public key and saving it as WODC (General questions)

by cyman, Monday, February 14, 2011, 20:15 (4842 days ago)

Hi there,

This is a bit urgent.
We have a SFTP server based on the sample code you provided for public key authentication. However, we can't figure out how to import a client's public key (from OpenSSH) into the system.

If you look at the sample code, the certificate is received and then saved in a weird format that contains binary data and ssh-dss . We want to be able to convert public keys from openSSH or whatever to this raw format. Connecting directly with the key is NOT an option. How can we do this?

Re: Loading a OpenSSH public key and saving it as

by cyman, Monday, February 14, 2011, 20:22 (4842 days ago) @ cyman

Just to clarify, the format the demo SFTP server saves in is NOT the stardard OpenSSH key... See below:
SAMPLE PUBLIC KEY FILE SAVED BY WodSFTPServer:
(binary gook)ssh-dds(binary gook)SDFKFGLDFJKLDmvdlfkndlfkgnerg e

SAMPLE STANDARD OPENSSH PUBLIC KEY FILE:
ssh-dss AAAAB3NzaC1kc3MAAACBAIwEgZBTHIgAHoeaAt9Y503CAts8D9+MNj/Nd/HfT1lPP7XEBmjB1oq3ZHqHs1JF3hDmyywarx+frkgoUypOZtWFSyw4iUnsC/GmV79qu3qcfLmoR9Cz3NjVYoiNO5yvR8f+xN5RUp05Xm4ivpX0dLAd42QQVwcLzJMD25susEEDAAAAFQD+y3+g3zz6j9+RXJz96wgk9FzT2wAAAIBJMUK1HtpxFQdyAXMgiFp9Lv7R3cT+a0WfflX0hYTDuA9HkxFvYUvhcspvkN/9rpt/NAVdVQoenQpgQr6Gkik+9lmp+NMaoykjz9tm0zA6qLBz2gQXL26Z2lkq4fWRKrjpBmeQWivqXsPg3ojvSpkva05h2XUxemPq0XKPLRxVLgAAAIAVnEqZCPs7rMmqkd2w020utlXROWSd9dZPa/HIwqZS9H0lMKVkRoTrOAwOVpFCOzVS6tT4/ALNJNz/KHKUtY4z67zeqQxCNUO1SeLi2pUSAIg7J8EXd7AvVLSWi/TSbKMLUW6mQCrAZ7Q9YPv34bYv5HgweW5TezvMjyeTBUaXAw== www-data@mk

Re: Loading a OpenSSH public key and saving it as

by woddrazen, Monday, February 14, 2011, 20:34 (4842 days ago) @ cyman

Hi,


I added this code inside wodFtpServer LoginCertificate Event and when user connects, public key is displayed correctly:
[code]MsgBox Certificate.PublicKeyOpenSSH[/code]
If problem persist, is there any chance you can send us some test key that will duplicate your problem on our side?

Here is public key I received in wodFtpServer:
--------------------------------------------------------------------------
ssh-dss AAAAB3NzaC1kc3MAAACBAKFJeIAWC/Ms3pDfrzZ1bahItpd90V4gz2DKhYZQM1i0kqbHOTgeQEoT8CUxTJVsyRPcqFdx6KpOb6zD6zvOlSeVKRuLU7v02MGdeky4xu28EVGB77QWImsKnyrnp5SJWOEjSQj+kmb0VXJzvgYM6baaJsNHL7FiN92xab9dXBx9AAAAFQCViXHkibEWH7NPDflUhqoRKmAhOQAAAIBG9Cbb+QCvxMjC1qJYC7ZcHrSe5sjZ1nuppyRXzncZTJZZb/Ip51ztpaSzdsb7dHfkkhVqMz6zbkSmKn85Sp5CRR14/GfL9Gif252UUW+tQwSBW4KnKmrBPcy105t9yPiKYG8IpbZxTg4+tT7hY5QZjMPq9Xd439Dvrk+DCoOJhQAAAIAUpyLtaIP+rfABQZ6mMpvsNtac004L5212Ux6ha/J9SEnyAeN9EEMuhZPBxrqK0/gMDYTbCrk+9OgxNEWnzFwqD+kh/I+HmQnudhddeqWWDOOAZRQXm8GKvPcKmsAjf7OiVe+yhefbGXfof+VzpcjkDoKrLS/4tleCG5J2mNjFcA==
--------------------------------------------------------------------------


Regards,
Drazen

Re: Loading a OpenSSH public key and saving it as

by cyman, Monday, February 14, 2011, 22:29 (4841 days ago) @ woddrazen

We cannot use the LoginCertificate routine. We need to receive the public key by email and save it to a raw, compatible format.

Re: Loading a OpenSSH public key and saving it as

by woddrazen, Monday, February 14, 2011, 22:42 (4841 days ago) @ cyman

Hi,


What happens if you receive from your user public key in OpenSSH format and then compare it with Certificate.PublicKeyOpenSSH value inside LoginCertificate Even?


Drazen

Re: Loading a OpenSSH public key and saving it as

by cyman, Monday, February 14, 2011, 23:05 (4841 days ago) @ woddrazen

It's complicated, but that isn't an option either because we can't change the production code at this time. This is why we need to simple convert it.

Isn't there some way to open a OpenSSH public key and convert it to the raw key data?


Re: Loading a OpenSSH public key and saving it as

by wodDamir, Wednesday, February 16, 2011, 15:20 (4840 days ago) @ cyman

Hi Cyman,

If I understood correctly, you're using wodFtpServer. In that case, please update to the latest version.

We've changed PublicKeyLoad method so that it now accepts keys in OpenSSH format too. Once you load it, you can convert it to any other format supported.

Hope this helps.

Regards,
Damba