Load Key from DB (General questions)
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
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
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
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
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
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
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
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
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