Load Key from DB (General questions)
by Dk, Friday, February 24, 2006, 09:22 (6847 days ago)
Hi,
I am able to connect and upload using login/private key combination provided the key is loaded from a file.
But our requirement is to store the private key in database (MS SQL) and then authenticate the login using that information.
Any ideas on storing and loading the key from db ?
Thanks
Dk.
Re: Load Key from DB
by wodDrazen, Friday, February 24, 2006, 10:13 (6847 days ago) @ Dk
Hi,
Load method will accept raw key data (one that starts with ---- BEGIN RSA PRIVATE KEY----) to be passed as argument, instead of filename, so you can basically store raw key data to a database, then retrieve it later on and pass to Load method.
Hope I helped.
Regards,
Drazen
Re: Load Key from DB
by Dk, Monday, February 27, 2006, 12:32 (6843 days ago) @ wodDrazen
Hi,
The key was successfully saved in the the db. When i tried to load it using the following code snippet it threw an exception: Failed to open key file
KeyManager keyMgr = new WeOnlyDo.Security.Cryptography.KeyManager();
SSHKeyTypes keyType = keyMgr.Load(System.Text.Encoding.Default.GetString(this.PrivateKey));
this.Privatekey has the exact key information as in the key file.
Please help
Thanks
Dk.
Re: Load Key from DB
by wodSupport, Monday, February 27, 2006, 13:32 (6843 days ago) @ Dk
My mistake.
I thought you're using ActiveX. wodKeyManager.NET currently doesn't have option to use full raw data with Load method.
But we can add that - give us a day or so.
Kreso
Re: Load Key from DB
by wodSupport, Tuesday, February 28, 2006, 00:27 (6843 days ago) @ wodSupport
DK,
I double checked, wodKeyManager.NET will already Load key from string raw data. This code works correctly for me: [code]WeOnlyDo.Security.Cryptography.KeyManager km = new WeOnlyDo.Security.Cryptography.KeyManager();
string a;
a = -----BEGIN RSA PRIVATE KEY-----\r\nMIICWQIBAAKBgQD........Qtz1ekkOeOic=\r\n-----END RSA PRIVATE KEY----- ;
km.Load(a);
Console.WriteLine(km.PublicKeyOpenSSH(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey));
[/code]
Kreso
Re: Load Key from DB
by Dk, Tuesday, February 28, 2006, 06:48 (6843 days ago) @ wodSupport
Hi,
The version on the keymanager dll that i am using is 1.0.0.2, does this have the overloaded load method that can work with the key itself rather than the file name ? I doubt. Since it throws an exception Failed to open key file .
Do i have to upgrade ? If yes please send me the information.
Thanks
Dk.
Re: Load Key from DB
by wodSupport, Tuesday, February 28, 2006, 13:40 (6842 days ago) @ Dk
Dk,
yes, please update your version. You can do it at
http://www.weonlydo.com/index.asp?update=1
Kreso
Re: Load Key from DB
by Dk, Wednesday, March 01, 2006, 05:44 (6842 days ago) @ wodSupport
Hi
The update page requires an email id and its that of a person who left the company, is there any other way to get an update ?
Thanks
Dk.
Re: Load Key from DB
by wodSupport, Wednesday, March 01, 2006, 06:52 (6842 days ago) @ Dk
Yes it is, please send email to sales@weonlydo.com describing the situation, send us old email and we will update your records in our database.
Kreso