Strange certificate key format from wodSFTP- need (General questions)
Hi there,
I used sample SFTP certificate-authentication code provided to save public certificates, but now I cannot read those files... I need to convert them to a standard format, like OpenSSH or PEM. How can I do this?
Here's the thing- It makes no sense to me.. Here is the public key that PuttyGen says belongs to the private key:
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIBhIyRM7vKBdOm3//5FoRzS4Vojn5u1C1B4+ofLG748HW/BwznKYHxUNqWd0SjG77lgOfzJueQSbXIpAcHPEFOUpQ6P5/z5q5k5r6gr2UZBH6ln5T1EkiA8yE41Jk4woOoWnDtcB2Aqn2cqjGZ57YEbypm+NrONclXbBliLkq/QHQ== rsa-key-20130703
But HERE is the Base64 encoding (I converted it from binary) from the .publickey file saved by wodSFTPServer:
AAAAB3NzaC1yc2EAAACAYSMkTO7ygXTpt//+RaEc0uFaI5+btQtQePqHyxu+PB1vwcM5ymB8VDalndEoxu+5YDn8ybnkEm1yKQHBzxBTlKUOj+f8+auZOa+oK9lGQR+pZ+U9RJIgPMhONSZOMKDqFpw7XAdgKp9nKoxmee2BG8qZvjazjXJV2wZYi5Kv0B0AAAABJSU=
So strange... The header is there but the data is different.
THE CODE:
1. During Certificate Login, if it fails, set the Tag to the public key:
If Action = Deny Or Action = SilentDeny Then
AddDebug User.Login + : Certificate Login Denied.
' if not valid then save this for LoginPassword event
User.Tag = Certificate.PublicKey
end if
2. During the LoginPassword..
IF PASSWORD LOGIN CORRECT:
Open App.path & Keys & Login & .publickey For Random As #1 Len = 1
For i = 1 To Len(User.Tag)
a = Mid$(User.Tag, i, 1)
Put #1, i, a
Next i
Close #1
AddDebug User.Login + : Key saved.
' That is how the key is generated
Please help, thanks!
Anything that will let me convert these raw keys into a known format is a big help!
Re: Strange certificate key format from wodSFTP- n
Just a note, for the last line where I say this is how the key is generated , I mean, this is how the public key is saved for the future .
Re: Strange certificate key format from wodSFTP- n
Hi,
Did you try to use:[code]Certificate.PublicKeyOpenSSH[/code]
in that case key will be saved in OpenSSH format. Can you try that maybe?
Let us know how it goes.
Regards,
Drazen
Re: Strange certificate key format from wodSFTP- n
I can't do that because I'm unable to load the file to the wod object.
I cannot get the users to log in again to get the certificates. There are hundreds of users and some users only log in once per year. I need to use the raw public key files that the server saved and convert them.
Is there a way to load that raw certificate data into a wod object and then use those save functions? I didn't see any way to do that. I looked carefully. They all seem to require pem format or some other format in order to load a public key.
Also keep in mind I only have the public keys and not the key pair.
Re: Strange certificate key format from wodSFTP- n
Hi,
I'm not sure if that will help but why don't you store public key into some variable and save it inside LoginPasswords Event?
Drazen
Re: Strange certificate key format from wodSFTP- n
We have 700 users. So, we cannot get them all to log in with their public key in order to get their certificate again.
Some log in once per year.
We need to convert their existing public key in the files we have. Getting them to log in again is not possible.
Unless I misunderstood your recommendation?
The problem is there's no way to restore a key with that format into the Wodkeys object, so far as I can tell?
I will try to upload a sample key in 10 minutes so you can see the binary format. Tho it's the same one as in the examples.
Re: Strange certificate key format from wodSFTP- n
Here is a sample key in that binary format and it's OpenSSH equivalent
https://dl.dropboxusercontent.com/u/10970475/wod_72821d/sample_public_key.zip
Re: Strange certificate key format from wodSFTP- n
I also sent an email with more details.