Page 1 of 1

VPS with ppk file

Posted: Thu 27 Apr 2017 01:23
by cybsistemas
Hi
Using delphi XE7, secure bridge 8.01 pro and Mydac 9.01 pro
How can I do to connect to a VPS using a ppk file instead of user and password?

Re: VPS with ppk file

Posted: Thu 27 Apr 2017 13:02
by ViktorV
To solve the issue, you should set the TScSSHClient.Authentication property to atPublicKey and the TScSSHClient.PrivateKeyName property to valid key name after importing the ppk file. Example:

Code: Select all

procedure Connect;
var
  Key: TScKey;
begin
  Key := TScKey.Create(ScFileStorage.Keys);
  Key.KeyName := 'key1';
  Key.ImportFrom(Filename);

  ScSSHClient.Authentication := atPublicKey;
  ScSSHClient.KeyStorage := ScFileStorage;
  ScSSHClient.PrivateKeyName := 'key1';
  ScSSHClient.Connect;
end;