Using a Certificate in wodSFTP.NET - WeOnlyDo Discussion board

Using a Certificate in wodSFTP.NET (General questions)

by tyrven, Thursday, September 14, 2006, 00:13 (6645 days ago)

Is there an example of how to use a certificate to connect via SFTP via wodsSFTP.NET? The examples on this site use the ActiveX/COM version, which appears to ship with a key/cert manager class; does this class or a comparable class ship with the .NET version? If not, is there any sample code that demonstrates how to import a standard private key format (such as OpenSSH, PEM, PuTTY, etc) into .NET using something like the RSACryptoServiceProvider? Or at least how to convert one of these b64 formats to Microsoft's binary blob format?

Re: Using a Certificate in wodSFTP.NET

by wodDrazen, Thursday, September 14, 2006, 00:20 (6645 days ago) @ tyrven

Hi Jaremy,


You can find example how to connect to server with private key in wodSFTP.NET here:

http://www.weonlydo.com/index.asp?kb=1&View=entry&CategoryID=5&EntryID=62

Hope this helps.


Regards,
Drazen


Re: Using a Certificate in wodSFTP.NET

by tyrven, Thursday, September 14, 2006, 01:41 (6645 days ago) @ wodDrazen

You can find example how to connect to server with private key in wodSFTP.NET here...

OK. I actually need this for FtpDLX.NET. I would assume the code would be fairly similar - is there an additional assembly that I need to gain access to the WeOnlyDo.Security.Cryptography.KeyManager class? .NET isn't able to find the Security namespace in WeOnlyDo using the DLX DLL).

I could use SFTP.NET - but it seems that FtpDLX.NET has a few additional features (all managed code, standard FTP support, recursion, etc) that would be handy to have available.

Thoughts?
Jeremy

Re: Using a Certificate in wodSFTP.NET

by wodSupport, Thursday, September 14, 2006, 01:53 (6645 days ago) @ tyrven

Jeremy,

quite different, since wodFtpDLX.NET uses NET's classes. You should use RSA key from RSACryptoServiceProvider class (same applies for DSA). In order to convert key from wodSFTP.NET as discussed in previous post, install wodSFTP.NET to get wodKeyManager and convert the key (you need to do it just once). Load key to wodKeyManager, then export it to string using wodKeyManager.ToXmlString method. Then code like this should work in wodFtpDLX.NET:[code] System.Security.Cryptography.RSACryptoServiceProvider rsakey = new System.Security.Cryptography.RSACryptoServiceProvider();
rsakey.FromXmlString( );
Ftp1.PrivateKey = rsakey;
Ftp1.Authentication = WeOnlyDo.Client.Authentications.PublicKey;
[/code]

Hope I helped.
Kreso

Re: Using a Certificate in wodSFTP.NET

by tyrven, Thursday, September 14, 2006, 02:29 (6645 days ago) @ wodSupport

Hah OK that'll work! Any plans to bake the crypto helper class into the .NET version in the future? Seems a bit of a kludge to round trip this through the other version - and there don't appear to be a lot of other resources available for converting the common base 64 formats to either of Microsoft's formats (blob or XML-encoded).

Regardless, this should solve my problem and I really appreciate your help!