EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Struggling getting FTPSClient working on Silverlight

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#15488
Posted: 01/13/2011 10:13:28
by Martin Eckart (Basic support level)
Joined: 01/13/2011
Posts: 8

I executed the FTPS sample successfully and would like to do the same using the Silverlight version of ELDOS dll's. I am using FileZilla as FTPServer.

Here an extract of relevant code:

TElSimpleFTPSClient ftpClient = new TElSimpleFTPSClient();
ftpClient.Address = Application.Current.Host.Source.DnsSafeHost;
ftpClient.Port = 21;
ftpClient.Username = "anonymous";
ftpClient.Password = "test";
ftpClient.Versions = 6;
ftpClient.AuthCmd = SBSimpleFTPS.Unit.acAuto;
ftpClient.UseSSL = true;
ftpClient.EncryptDataChannel = true;
ftpClient.SSLMode = SBSimpleFTPS.Unit.smExplicit;
ftpClient.Open();
ftpClient.Login();

After calling the Open method I can see the welcome message in FTP Log, but there is no authentication going on. The method comes back immediately and when calling the Login method the following Exception gets thrown:

{System.NullReferenceException: Object reference not set to an instance of an object.
at SBSimpleFTPS.TElSimpleFTPSClient.ReadReply(String& ReplyString)
at SBSimpleFTPS.TElSimpleFTPSClient.GetReply(Boolean Wait)
at SBSimpleFTPS.TElSimpleFTPSClient.Login()
at MessengerClient.FtpSelection.ConnectViaEldos()
at MessengerClient.FtpSelection.EldosButton_Click(Object sender, RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)}

Can you help me here? If that would work we would most likely purchase the full version for our scenario.
#15489
Posted: 01/13/2011 10:52:51
by Vsevolod Ievgiienko (EldoS Corp.)

Hello.

Check if server also uses explicit SSL mode. Both client and server must use the same SSL mode.
#15490
Posted: 01/13/2011 11:07:20
by Martin Eckart (Basic support level)
Joined: 01/13/2011
Posts: 8

It is set. As mentioned on the very first line, I have tried the exact same code using the FTPS sample (which is .NEt 2.0 WinForms). Therefore I really assume it has do something specific to Silverlight, maybe with the Silverlight dll's from ELDOS?
#15491
Posted: 01/13/2011 11:21:36
by Eugene Mayevski (EldoS Corp.)

Silverlight components are subject to restrictions imposed by Microsoft on Socket class in non-trusted applications (and web applets). All complaints in regards to those problems should be directed to Microsoft.


Sincerely yours
Eugene Mayevski
#15492
Posted: 01/13/2011 11:25:54
by Martin Eckart (Basic support level)
Joined: 01/13/2011
Posts: 8

Agreed. But I am already running out of browser including leveraged trust. I already am able to get to the ftp Server using port 21 which shows the welcome message. I don't think this is a MS fault.
Since you are offering Silverlight 4 versions of your dll's, have you ever tested them successfully in a Silverlight 4 scenario?

Cheers,
Martin
#15493
Posted: 01/13/2011 11:47:04
by Eugene Mayevski (EldoS Corp.)

Yes, of course, the components were tested with SL 4 and we have clients that successfully use socket-based components in Silverlight.

I think the best we could do is that you sent us a test case which we could run and check in our conditions. This can be done by posting the test here (zipped source code and project file only please, no Bin and Obj folders). Having a test case would help us solve the problem more efficiently than by just guessing from piece of code what might be wrong.


Sincerely yours
Eugene Mayevski
#15494
Posted: 01/13/2011 12:03:45
by Martin Eckart (Basic support level)
Joined: 01/13/2011
Posts: 8

Hi Eugene,

Attached is my test project. Thanks for your support, I do appreciate that!

Cheers,
Martin


[ Download ]
#15497
Posted: 01/13/2011 13:14:38
by Eugene Mayevski (EldoS Corp.)

First of all, you are not referencing right assemblies.

You need to reference

SecureBlackbox.dll
SecureBlackbox.SSLCommon.dll
SecureBlackbox.SSLClient.dll
SecureBlackbox.FTPS.dll

Please update your project and test it then - maybe adding the references will fix the problem completely.

Next, your code doesn't handle OnCertificateValidate event. If you are trying to connect using SSL, then you *must* handle this event. Without handling the event the component won't work. SSL client checks presence of the handler and throws an exception, but FTPSClient, which wraps the ssl client, doesn't do such check so there's no error code yet no progress as well.

Next, adding LicenseKey.der doesn't do anything and it can be safely removed. But this doesn't influence anything.

Finally, I got the following errors while trying to compile the solution. We don't have much experience with Silverlight and WPF, so I don't know how to act further. All files were unpacked from archive correctly and both Page.xaml.cs and Page.xaml files are available.

C:\Projects\SecureBlackbox\Test\DotNET\SSL\SL_FTPS_2\Page.xaml.cs(23,13): error CS0103: The name 'InitializeComponent' does not exist in the current context
C:\Projects\SecureBlackbox\Test\DotNET\SSL\SL_FTPS_2\Page.xaml.cs(125,40): error CS0103: The name 'txtMessage' does not exist in the current context
C:\Projects\SecureBlackbox\Test\DotNET\SSL\SL_FTPS_2\Page.xaml.cs(141,25): error CS0103: The name 'lblMessages' does not exist in the current context
C:\Projects\SecureBlackbox\Test\DotNET\SSL\SL_FTPS_2\Page.xaml.cs(142,25): error CS0103: The name 'scrollViewer' does not exist in the current context
C:\Projects\SecureBlackbox\Test\DotNET\SSL\SL_FTPS_2\Page.xaml.cs(142,61): error CS0103: The name 'scrollViewer' does not exist in the current context
C:\Projects\SecureBlackbox\Test\DotNET\SSL\SL_FTPS_2\App.xaml.cs(24,13): error CS0103: The name 'InitializeComponent' does not exist in the current context
C:\Projects\SecureBlackbox\Test\DotNET\SSL\SL_FTPS_2\FtpSelection.xaml.cs(19,13): error CS0103: The name 'InitializeComponent' does not exist in the current context
C:\Projects\SecureBlackbox\Test\DotNET\SSL\SL_FTPS_2\FtpSelection.xaml.cs(119,13): error CS0103: The name 'lstFiles' does not exist in the current context
C:\Projects\SecureBlackbox\Test\DotNET\SSL\SL_FTPS_2\FtpSelection.xaml.cs(120,13): error CS0103: The name 'lstFiles' does not exist in the current context
C:\Projects\SecureBlackbox\Test\DotNET\SSL\SL_FTPS_2\FtpSelection.xaml.cs(125,27): error CS0103: The name 'lstFiles' does not exist in the current context
C:\Projects\SecureBlackbox\Test\DotNET\SSL\SL_FTPS_2\FtpSelection.xaml.cs(282,25): error CS0103: The name 'statusLabel' does not exist in the current context
C:\Projects\SecureBlackbox\Test\DotNET\SSL\SL_FTPS_2\FtpSelection.xaml.cs(283,25): error CS0103: The name 'statusLabel' does not exist in the current context
#15501
Posted: 01/14/2011 02:06:48
by Martin Eckart (Basic support level)
Joined: 01/13/2011
Posts: 8

Fixing the references did not do the trick. Neither does the OnCertificateValidate event handler.

Unfortunately extracting the zip file and then compiling works fine for me, so I cannot tell you what exactly is going wrong on your machine. Do you have Silverlight 4 Toolkit installed?

Any other ideas?
#15502
Posted: 01/14/2011 02:12:07
by Eugene Mayevski (EldoS Corp.)

I have everything installed, and I have also found a FTPS test application for Silverlight 4, which means that FTPS client was tested separately (which confirms that it should work).

I will try to build a fresh SL application in the evening and see if it exposes the problem.


Sincerely yours
Eugene Mayevski
Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages

Reply

Statistics

Topic viewed 4698 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!