WeOnlyDo.Security.Cryptography.KeyManager.Load usi - WeOnlyDo Discussion board

WeOnlyDo.Security.Cryptography.KeyManager.Load usi (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Tom, Monday, December 14, 2009, 15:05 (5238 days ago)

Hi,

Is there any way to laod the private key from string or stream instead of file input? Or is it possible to extend the base class of KeyManager to do that?
I need this feature for a product that has only database access and no file access. I hope, that I don't have to search again a new component for my product.

Tom

Re: WeOnlyDo.Security.Cryptography.KeyManager.Load

by woddrazen, Monday, December 14, 2009, 15:36 (5238 days ago) @ Tom

H Tom,


Actually you can load private key from a string value in Load Method.

Here is example:
http://www.weonlydo.com/index.asp?kb=1&View=entry&EntryID=73

Example is for our wodKeys component but principle should be same for wodKeyManager.NET.

In example please look as Key.Load Method line how private key should be loaded in.

Let us know how it goes.


Regards,
Drazen

Re: WeOnlyDo.Security.Cryptography.KeyManager.Load

by Tom, Monday, December 14, 2009, 17:10 (5238 days ago) @ woddrazen

Hi Drazen,

Thanks a lot, it works! :-)

My .Net Example with FtpDLX.NET:
================================
WeOnlyDo.Client.FtpDLX ftp1 = new WeOnlyDo.Client.FtpDLX();

ftp1.Hostname = textBox1.Text;
ftp1.Login = textBox2.Text;
ftp1.Password = textBox3.Text;
progressBar1.Minimum = 0;
ftp1.Protocol = WeOnlyDo.Client.Protocols.SFTP;
ftp1.Authentication = WeOnlyDo.Client.Authentications.PublicKey;
WeOnlyDo.Security.Cryptography.KeyManager keyManager = new WeOnlyDo.Security.Cryptography.KeyManager();
keyManager.Load(@ -----BEGIN RSA PRIVATE KEY-----
XXXXX... etc. ...XXXX
-----END RSA PRIVATE KEY----- , textBox3.Text);
ftp1.PrivateKey = keyManager.ToXmlString(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey, true);
ftp1.Blocking = true;
ftp1.Port = System.Convert.ToInt32(textBox4.Text);
ftp1.Connect();

Regards,

Tom

H Tom,


Actually you can load private key from a string value in Load Method.

Here is example:
http://www.weonlydo.com/index.asp?kb=1&View=entry&EntryID=73

Example is for our wodKeys component but principle should be same for wodKeyManager.NET.

In example please look as Key.Load Method line how private key should be loaded in.

Let us know how it goes.


Regards,
Drazen

[:smile:][:smile:][:smile:]