EldoS | Feel safer!

Software components for data protection, secure storage and transfer

An invalid IP address was specified (System.FormatException)

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.
#26534
Posted: 09/20/2013 00:31:18
by Christian Hermann (Basic support level)
Joined: 09/20/2013
Posts: 17

Hello,

i try to connect to a ftps with your SecureBlackbox.FTPS modul.


Code
private async Task DoConnect(ConnectionSettings settings)
        {


            if (Client.Active)
            {
                return;
            }

            FileStream F;
            int R;

            lvLog.Items.Clear();
            Client.Address = settings.Host; //100% ok
            Client.Port = settings.Port; //100% ok
            Client.Username = settings.Username; //100% ok
            Client.Password = settings.Password; //100% ok
            Client.Versions = (short)(Client.Versions + SBSSLConstants.Unit.sbTLS12);

            if (File.Exists(settings.CertFileName))
            {
                try
                {
                  
                    F = new FileStream(settings.CertFileName, FileMode.Open, FileAccess.Read);

                    R = Cert.LoadFromStreamPFX(F, settings.CertPassword, (int)F.Length);
                    if (R == 0)
                    {
                        FUseCert = true;
                        Log("Certificate loaded", false);
                    }
                    else
                    {
                        Log("Failed to load certificate, PFX error " + R.ToString(), true);
                    }
                }
                catch (Exception E)
                {
                    MessageBox.Show(E.Message);
                    Log(E.Message, true);
                }
            }
            else
            {
                //TODO:
            }

            Client.UseSSL = true;
            Client.EncryptDataChannel = true;
            Client.AuthCmd = SBSimpleFTPS.Unit.acAuthTLS;
            Client.PassiveMode = true;
            Client.SSLMode = SBSSLCommon.TSBSSLMode.smExplicit;
            FNeededIndex = 0;
            ElMemoryCertStorage.Clear();

            //Verbinden
            try
            {
                await Client.OpenAsync();
                 Log("Connected", false);
                _connectionInfoViewModel.Connected = true;
                await Client.LoginAsync();
                 Log("Logged in", false);
                 _connectionInfoViewModel.LoggedIn = true;
                
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }


The exception was thrown in:

Code
private void Client_OnCertificateValidate(object Sender, SBX509.TElX509Certificate X509Certificate, ref bool Validate)
        {
            Log("Veri", false);
            TSBCertificateValidity Validity = TSBCertificateValidity.cvInvalid;
            int Reason = 0;
            if ((X509Certificate.Chain == null) || (X509Certificate.Chain.get_Certificates(0) == X509Certificate))
            {
                CertificateValidator.ValidateForSSL(X509Certificate, Client.RemoteHost, Client.RemoteIP, TSBHostRole.hrServer, null, false, false, DateTime.Now, ref Validity, ref Reason);
                Validate = (Validity == TSBCertificateValidity.cvOk) || (Validity == TSBCertificateValidity.cvSelfSigned);
            }
            else
            {
                Validate = true;
            }
        }


The problem is: it worked yesterday .... now i have a new license key: but same problem.

The ip is 100% corret.

The server log seems ok:
Quote
Fri Sep 20 06:54:53 2013 [pid 28084] CONNECT: Client "<my ip>"
Fri Sep 20 06:54:53 2013 [pid 28084] FTP response: Client "<my ip>", "220 v1"
Fri Sep 20 06:54:53 2013 [pid 28084] FTP command: Client "<my ip>", "AUTH TLS"
Fri Sep 20 06:54:53 2013 [pid 28084] FTP response: Client "<my ip>", "234 Proceed with negotiation."



Any ideas? Thank you,

kind regards chris

EDIT:
Using .NET SecureBlackbox: 10
#26535
Posted: 09/20/2013 00:55:29
by Eugene Mayevski (EldoS Corp.)

Looks like the server presents the certificate with the IP address in it, and that IP address is not parsed right (most likely it's malformed as the IP is parsed by .NET Framework so there's unlikely to be an error in our code). However, in order to solve the problem, we need to reproduce it locally. If it's possible to connect to the server (we don't need username/password), please post the address either here or to HelpDesk. Helpdesk is confidential.

On a side note, if you have a license, please link the license ticket to your user account. The ticket itself and the procedure of its use are specified in the registration e-mail that was sent to you upon license purchase. If you don't have the license ticket, please contact the person from which you have obtained the license key (the one in your source code) for a license ticket.

NOTE: please don't post license keys and license tickets to the forum. If you need to clarify something about your license, please use HelpDesk.


Sincerely yours
Eugene Mayevski
#26537
Posted: 09/20/2013 01:15:15
by Christian Hermann (Basic support level)
Joined: 09/20/2013
Posts: 17

Thank you, ticket is out :)

Reply

Statistics

Topic viewed 1628 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!