Welcome to the Xceed Community | Help
Community Search  
More Search Options

Use Xceed FTP on a 64Bit architecture

Sort Posts: Previous Next
  •  05-30-2007, 6:31 AM Post no. 5240

    Use Xceed FTP on a 64Bit architecture

    Hi,

    We get an error when using an FTPS Windows Service on a 64bit computer.


    We don't have any problem using this same Windows Service on a 32bit computer.

    Is there a way to solve this problem ?
    The service is currently build with 'Any CPU' mode.

    setting this to x86 mode will fix the problem ?




    Message: Xceed.Ftp.FtpSslException: An SSL error occurred while sending a command. ---> Xceed.Utils.Security.SecurityException: An error occured while communicating with the remote host. ---> Xceed.Utils.Security.Ssl.Shared.SslException: The pulic key should be at least 512 bits.

    at Xceed.Utils.Security.Ssl.Shared.HandshakeLayer.ProcessCertificate(HandshakeMessage message, Boolean client)
    at Xceed.Utils.Security.Ssl.Shared.ClientHandshakeLayer.ProcessMessage(HandshakeMessage message)
    at Xceed.Utils.Security.Ssl.Shared.HandshakeLayer.ProcessMessages(RecordMessage message)
    at Xceed.Utils.Security.Ssl.Shared.RecordLayer.ProcessBytes(Byte[] buffer, Int32 offset, Int32 size)
    at Xceed.Utils.Security.Ssl.Shared.SocketController.OnReceive(IAsyncResult ar)
    --- End of inner exception stack trace ---
    at Xceed.Utils.Security.Ssl.SecureSocket.EndSend(IAsyncResult asyncResult)
    at Xceed.Ftp.Engine.FtpCommandChannel.SendString(String command)
    --- End of inner exception stack trace ---
    at Xceed.Ftp.Engine.FtpCommandSequence.EndExecute(IAsyncResult asyncResult)
    at Xceed.Ftp.FtpClient.Authenticate(FtpCommandChannel commandChannel, AuthenticationFtpCommand authCommand, DataChannelProtectionFtpCommand protCommand)
    at Xceed.Ftp.FtpClient.Authenticate(AuthenticationMethod authenticationMethod, VerificationFlags verificationFlags, Certificate clientCertificate, DataChannelProtection dataProtection)

  •  05-31-2007, 9:24 AM Post no. 5241 in reply to 5240

    Re: Use Xceed FTP on a 64Bit architecture

    the problem has been solved.

    thanks
  •  06-12-2007, 5:25 AM Post no. 5242 in reply to 5241

    Re: Use Xceed FTP on a 64Bit architecture

    I have like problem.
    Can you post solution ?
  •  06-12-2007, 11:36 AM Post no. 5243 in reply to 5242

    Re: Use Xceed FTP on a 64Bit architecture

    Are you in .NET 1.1 or 2.0? Which version of our product are you using exactly (X.X.XXXX...)?

    André
    Software Developer
    Xceed Software Inc.
  •  05-23-2008, 7:58 AM Post no. 12468 in reply to 5243

    Re: Use Xceed FTP on a 64Bit architecture

    We are using visual studio 2005, The latest version of Xceed, .net 2.0 and vista ultimate on a x64 system.

    I have tried this on both a  32 bit and a 64 bit system. 

     

    ================================================================
    The error provided is:
    ================================================================

     Xceed.Ftp.FtpSslException: An SSL error occurred while sending a command. ---> Xceed.Utils.Security.SecurityException: An error occured while communicating with the remote host. ---> Xceed.Utils.Security.Ssl.Shared.SslException: The certificate could not be verified.
       at Xceed.Utils.Security.Ssl.Shared.HandshakeLayer.VerifyChain(CertificateChain chain, Boolean client)
       at Xceed.Utils.Security.Ssl.Shared.HandshakeLayer.ProcessCertificate(HandshakeMessage message, Boolean client)
       at Xceed.Utils.Security.Ssl.Shared.ClientHandshakeLayer.ProcessMessage(HandshakeMessage message)
       at Xceed.Utils.Security.Ssl.Shared.HandshakeLayer.ProcessMessages(RecordMessage message)
       at Xceed.Utils.Security.Ssl.Shared.RecordLayer.ProcessBytes(Byte[] buffer, Int32 offset, Int32 size)
       at Xceed.Utils.Security.Ssl.Shared.CompatibilityLayer.ProcessServerHello(Byte[] bytes, Int32 offset, Int32 size)
       at Xceed.Utils.Security.Ssl.Shared.CompatibilityLayer.ProcessHello(Byte[] bytes, Int32 offset, Int32 size)
       at Xceed.Utils.Security.Ssl.Shared.SocketController.OnReceive(IAsyncResult ar)
       --- End of inner exception stack trace ---
       at Xceed.Utils.Security.Ssl.SecureSocket.EndSend(IAsyncResult asyncResult)
       at Xceed.Utils.Security.Ssl.SecureSocket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
       at Xceed.Ftp.Engine.FtpCommandChannel.SendString(String command)
       --- End of inner exception stack trace ---
       at Xceed.Ftp.Engine.FtpCommandSequence.EndExecute(IAsyncResult asyncResult)
       at Xceed.Ftp.FtpClient.Authenticate(FtpCommandChannel commandChannel, AuthenticationFtpCommand authCommand, DataChannelProtectionFtpCommand protCommand)
       at Xceed.Ftp.FtpClient.Authenticate(AuthenticationMethod authenticationMethod, VerificationFlags verificationFlags, Certificate clientCertificate, DataChannelProtection dataProtection)
       at ConsoleApplication2.Module1.Example() in c:\work\PeopleSoft\ConsoleApplication2\ConsoleApplication2\Module1.vb:line 107

     

     

    ================================================================
    the code to call is:
    ================================================================

    Imports Microsoft.VisualBasic
    Imports System
    Imports System.IO
    Imports Xceed.Ftp
    Imports Xceed.FileSystem

    Module Module1

        Sub Main()
            Example()
        End Sub


        Public Sub Example()

            ' We will connect to the following FTP server, using the specified
            ' username and password.
            Dim hostname As String = xxxxxxxxxx
            Dim username As String = xxxxxxxxxx
            Dim password As String = xxxxxxxxxx

            Dim connection As FtpConnection = Nothing
           
            Try
                ' Connecting securely and authenticating are two distinct
                ' methods of establishing a secure connection with an FTP
                ' server. In the first case, the Secure FTP server may require
                ' an SSL connection to be established the very first thing. We
                ' call this an IMPLICIT SSL connection. In the second case,
                ' the connection is established in clear text and a special
                ' FTP command must be sent to the Secure FTP  server to change
                ' the connection into an SSL/TLS connection. We call this an
                ' EXPLICIT SSL connection.
                Dim client As New FtpClient()

                Dim clientCert As Certificate = Nothing

                ' Most FTP servers that support explicit TLS authentication accept a
                ' normal connection on port 21.

                'connection = New FtpConnection( _
                '  hostname, _
                '  21, _
                '  username, _
                '  password, _
                '  AuthenticationMethod.Tls, _
                '  VerificationFlags.None, _
                '  Nothing, _
                '  DataChannelProtection.Private, _
                '  False)

                client.Connect(hostname)

                ' You must then authenticate before logging-in, using the
                ' Authenticate method. When securing the connection explicitly,
                ' you can indicate if you wish to secure data connections as
                ' well, using the overload which takes a DataChannelProtection
                ' parameter. The default value is "Clear".
                client.Authenticate( _
                  AuthenticationMethod.Tls, VerificationFlags.None, clientCert, _
                  DataChannelProtection.Private)

                client.Login(username, password)
                Console.WriteLine("Logged-in!")

                ' In order to consult the server certificate, we must advise
                ' for the CertificateReceived event.
                AddHandler connection.CertificateReceived, AddressOf OnCertificateReceived

                ' And to allow WinForms actions within the above event, we'll need
                ' to redirect the call to the main thread. To achieve this, we must
                ' set the SynchronizingObject property of the FtpConnection.
                ' Keep in mind that the library will then pump messages by calling Application.DoEvents().
                '            connection.SynchronizingObject = m_resultsForm

                ' Let's trace commands and replies to the console.
                connection.TraceWriter = Console.Out



                ' Now that the connection object is instanciated, we can proceed with a simple listing
                ' of the current directory.
                Dim folder As FtpFolder = New FtpFolder(connection)

                Dim items As FileSystemItem() = folder.GetItems(False)

                For Each item As FileSystemItem In items
                    Console.WriteLine(vbCrLf & item.HostedFullName)
                Next item

            Catch except As Exception ' FileSystemException
                Console.WriteLine(vbCrLf & except.ToString())
                Dim bob As String = Console.Read()

            Finally

                If Not connection Is Nothing Then
                    connection.Dispose()

                    ' Unsubscribe from events.       
                    RemoveHandler connection.CertificateReceived, AddressOf OnCertificateReceived
                End If
            End Try

        End Sub

        Private Sub OnCertificateReceived(ByVal sender As Object, ByVal e As CertificateReceivedEventArgs)

            ' The Status argument property tells you if the server certificate was accepted
            ' based on the VerificationFlags you provided.
            If e.Status <> VerificationStatus.ValidCertificate Then
                Console.WriteLine(vbCrLf & "The server certificate is invalid: {0}", e.Status.ToString())
                Console.WriteLine(vbCrLf & e.ServerCertificate.ToString())

                ' You have three choices here.
                '  1) Refuse the certificate by setting e.Action to VerificationAction.Reject,
                '     thus making the authentication fail. This is e.Action's default value
                '     when the server certificate isn't valid
                '  2) Set e.Flags to less restrictive criterias and ask the library to
                '     validate the certificate again by setting e.Action to
                '     VerificationAction.VerifyAgain.
                '  3) Force the library to accept this certificate by setting e.Action to
                '     VerificationAction.Accept.
                ' We'll do #1 or #3, depending on the user's answer.
                Console.WriteLine(vbCrLf & "Do you want to accept this certificate anyway? [Y/N]")
                Dim answer As Integer = Console.Read()

                If Microsoft.VisualBasic.ChrW(answer) = "y"c _
                Or Microsoft.VisualBasic.ChrW(answer) = "Y"c Then
                    e.Action = VerificationAction.Accept
                End If
            Else
                ' e.Action's default value is VerificationAction.Accept
                Console.WriteLine(vbCrLf & "Valid certificate received from server.")
            End If

        End Sub

    End Module

     

     

     

  •  05-26-2008, 3:31 PM Post no. 12506 in reply to 12468

    Re: Use Xceed FTP on a 64Bit architecture

    What do you do when receiving the certificate?  If it is not valid (as the exception indicates) and you do not accept it in the event handler, then the exception will be thrown.
    André
    Software Developer
    Xceed Software Inc.
  •  02-17-2011, 8:30 PM Post no. 29889 in reply to 5241

    Re: Use Xceed FTP on a 64Bit architecture

    Just ran into this same error. How did you resolve it? Thanks a lot!

     

    Danielle

  •  05-30-2012, 11:50 AM Post no. 32184 in reply to 12468

    Re: Use Xceed FTP on a 64Bit architecture

    I am also facing the same issue. Secure FTP does not work with newer ftp version.
    How do you resolve it?

     

    --Raj 

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.