Host key verification for Android

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
klopotsky
Posts: 6
Joined: Fri 06 Dec 2019 15:01

Host key verification for Android

Post by klopotsky » Tue 04 Feb 2020 06:42

Image

I'm trying to make a connection for Android in FMX project. When I do:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
  ScSSHClient1.Connected := True;
  ScSSHChannel1.Connected := True;

  if ScSSHChannel1.Connected then Label1.Text := 'Connected'
  else Label1.Text := 'Not Connected'
end;

an error "Object not found" occurs in the procedure:

Code: Select all

procedure TForm1.ScSSHClient1ServerKeyValidate(Sender: TObject;
  NewServerKey: TScKey; var Accept: Boolean);
var
  Key: TScKey;
  fp: string;
begin
  ScFileStorage1.Path := TPath.GetDocumentsPath;  // Папка на Android

  Key := ScFileStorage1.Keys.FindKey(ScSSHClient1.HostName);

  if (Key = nil) or not Key.Ready then begin
    NewServerKey.GetFingerPrint(haMD5, fp);

    NewServerKey.KeyName := ScSSHClient1.HostName;
    ScFileStorage1.Keys.Add(NewServerKey);
    Accept := True;
  end;
end;
This is the full text of the test program:

Code: Select all

unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
  Uni, ScSSHChannel, ScSSHClient,
  ScBridge, CRVio, ScUtils, FMX.StdCtrls, FMX.Controls.Presentation,
  System.IOUtils;

type
  TForm1 = class(TForm)
    ScFileStorage1: TScFileStorage;
    ScSSHClient1: TScSSHClient;
    ScSSHChannel1: TScSSHChannel;
    Button1: TButton;
    Label1: TLabel;
    procedure ScSSHClient1ServerKeyValidate(Sender: TObject;
      NewServerKey: TScKey; var Accept: Boolean);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}
{$R *.LgXhdpiPh.fmx ANDROID}

procedure TForm1.ScSSHClient1ServerKeyValidate(Sender: TObject;
  NewServerKey: TScKey; var Accept: Boolean);
var
  Key: TScKey;
  fp: string;
begin
  ScFileStorage1.Path := TPath.GetDocumentsPath;  // Папка на Android

  Key := ScFileStorage1.Keys.FindKey(ScSSHClient1.HostName);

  if (Key = nil) or not Key.Ready then begin
    NewServerKey.GetFingerPrint(haMD5, fp);

    NewServerKey.KeyName := ScSSHClient1.HostName;
    ScFileStorage1.Keys.Add(NewServerKey);
    Accept := True;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ScSSHClient1.Connected := True;
  ScSSHChannel1.Connected := True;

  if ScSSHChannel1.Connected then Label1.Text := 'Connected'
  else Label1.Text := 'Not Connected'
end;

end.
Нow to do Host key verification for Android correctly?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Host key verification for Android

Post by ViktorV » Thu 06 Feb 2020 15:58

Thank you for the information. We have reproduced the issue and investigation is in progress. We will inform you when we have any results.

klopotsky
Posts: 6
Joined: Fri 06 Dec 2019 15:01

Re: Host key verification for Android

Post by klopotsky » Fri 07 Feb 2020 05:11

Thank you for support. As soon as you find a solution, on the same day, I will buy this component. Sincerely, Alexander, Brest, Belarus.

gtDelphi
Posts: 3
Joined: Tue 03 Mar 2020 15:41

Re: Host key verification for Android

Post by gtDelphi » Tue 03 Mar 2020 15:44

Has this been fixed or is there a work around solution? I'm having the same issue.

gtDelphi
Posts: 3
Joined: Tue 03 Mar 2020 15:41

Re: Host key verification for Android

Post by gtDelphi » Tue 03 Mar 2020 18:41

no matter what I do ... seems to be a internal problem that I can't seem to create a work around... spent the last 6 hours trying to create a work around.

:D86911EC Scbridge.TScFileStorage.InternalLoad(Scbridge.TScStorageItem*)

instead of letting you create your own file system, ScSSHClient1 requires it's own file system :(

I can only guess that since I don't have anything in that file system, it's probably in error because nothing exists? Who knows... no source-code, trial version ... complete fail!

CALL STACK THREAD 1:
System._DbgExcNotify(-393376,0xd651d248,0xd86761ed,0xd651d248,0xd86761ed)
System.NotifyReRaise(0xd651d248,0xd86761ed)
System._RaiseAtExcept(0xd651d248,0xd86761ed)
System._RaiseExcept(0xd651d248)
:D86761EC Scbridge.TScFileStorage.InternalLoad(Scbridge.TScStorageItem*)
:D869B530 Scbridge.TScStorage.Load(Scbridge.TScStorageItem*)
:D869A92C Scbridge.TScStorageList.LoadFromStorage(Scbridge.TScStorageItem*)
:D869AE8E Scbridge.TScStorageList.GetItem(int)
:D869AD34 Scbridge.TScStorageList.FindItem(System.UnicodeString)
:D8675296 Scbridge.TScKeyList.FindKey(System.UnicodeString)
:D86FBF7C Scsshclient.TScSSHClient.DoConnect()
:D86FB2BA Scsshclient.TScSSHClient.SetConnected(bool)
:D86FC7A0 Scsshclient.TScSSHClient.Connect()
Unit1.Tdebug.connectClick(0xf26a7f00,0xd6e15a00)
Fmx.Controls.TControl.Click(0xd6e15a00)
Fmx.Stdctrls.TCustomButton.Click(0xd6e15a00)
Fmx.Controls.TControl.MouseClick(0xd6e15a00,System.Uitypes.mbLeft,0x43390088,185.6667,27.33331)
:D8393002 __stub_in880v89__ZN3Fmx8Controls8TControl10MouseClickEN6System7Uitypes12TMouseButtonENS2_3SetINS2_7Classes17System_Classes__1ELS7_0ELS7_10EEEff
Fmx.Forms.TCommonCustomForm.MouseUp(0xf26a7f00,System.Uitypes.mbLeft,0x88,185.6667,553.3333,true)
Fmx.Platform.Ui.Android.TWindowServiceAndroid.MouseUp(0xd98bc2c0,0xf26a7f00,System.Uitypes.mbLeft,0x88,@0xfffa06a0: { = { = {V = {185.6667, 553.3333}}, = {X = 185.6667, Y = 553.3333}}},true)
Fmx.Platform.Ui.Android.TAndroidMotionManager.ProcessAndroidMouseEvents(0xd7147640)
Fmx.Platform.Ui.Android.TAndroidMotionManager.HandleMotionEvent(0xd7147640,0xd651d1e0)
Fmx.Platform.Ui.Android.TAndroidWindowHandle.TFormViewListener.onTouchEvent(0xd766e5d0,0xd651d1e0)
:D87609C2 L1
:D87609C2 L1

gtDelphi
Posts: 3
Joined: Tue 03 Mar 2020 15:41

Re: Host key verification for Android

Post by gtDelphi » Tue 03 Mar 2020 21:22

I'm glad they gave me a trial version, I'll wait until it works as a trial version before I buy.

I hope they give me a second chance to try it out when it does work.. the 60 days are ticking, and I think I have 59 left. I'll most likely have to buy the professional version to have it working for Android 32/64 bit.

Email me when it works and renew my trial so I can test it before I buy. Thanks!

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Host key verification for Android

Post by ViktorV » Thu 05 Mar 2020 10:17

We continue to investigate the problem and let you know as soon as we get any results. Unfortunately, we cannot tell you the exact time frame.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Host key verification for Android

Post by ViktorV » Fri 06 Mar 2020 14:13

Thank you for the information. We have reproduced and fixed the issue. This fix will be included in the next build of SecureBridge.
We can send you the nightly build of SecureBridge Trial Edition that includes the fix. If you'd like to receive the nightly build, please send us the IDE version number.

klopotsky
Posts: 6
Joined: Fri 06 Dec 2019 15:01

Re: Host key verification for Android

Post by klopotsky » Sat 07 Mar 2020 05:34

Embarcadero RAD Studio 10.3.3 Rio
Yes. I want to receive the nightly build of SecureBridge Trial Edition that includes the fix.
If possible, add an example: "Нow to do Host key verification for Android correctly".

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Host key verification for Android

Post by ViktorV » Tue 10 Mar 2020 12:01

Please try to use night build of SecureBridge Trial Edition with fix for RAD Studio 10.3 RIO at https://download.devart.com/dac/sbridge ... 3_2020.exe and inform us about the results.
The code that posted in your first message, can be used to accomplish your task, but with a slight modification: move the line from the method ScSSHClient1ServerKeyValidate to the method Button1Click and place it before the line ScSSHClient1.Connected := True. For example:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
  ScFileStorage1.Path := TPath.GetDocumentsPath;  // Папка на Android
  ScSSHClient1.Connected := True;
  ScSSHChannel1.Connected := True;

  if ScSSHChannel1.Connected then 
    Label1.Text := 'Connected'
  else 
    Label1.Text := 'Not Connected'
end;

klopotsky
Posts: 6
Joined: Fri 06 Dec 2019 15:01

Re: Host key verification for Android

Post by klopotsky » Thu 12 Mar 2020 04:56

Yes, everything works well!
When I can buy this updated version of SecureBridge?
Will this be a new release?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Host key verification for Android

Post by ViktorV » Thu 12 Mar 2020 13:32

We're not planning to release a new build of SecureBridge this month, however, we can make a nightly build of a licensed version of SecureBridge to include the fix, and send it to you. After purchasing the license, please send us the exact version of your IDE, and we'll send you the nightly build.

Post Reply