Hello!
I didn't get from samples how to use key files to establish ssh connection.
Could you give me any proper sample of using key-files?
For example I have dsa-file generated via PuttyGen(*.ppk file). The file is protected with passphrase.
Thank you for any advise)
Using public key file
The fact is that PuTTY saves keys in its own format. You should export your keys in the OpenSSH or SSH2 format. For that you should load your private key in PuTTY Key Generator, and export it to any available format using the Conversions menu. After that you should import your key in TScStorage, and set the imported key name in the TScSSHClient.HostKeyName property.
After that connect to the SSH server.
You can use the following code:
After that connect to the SSH server.
You can use the following code:
Code: Select all
procedure Connect;
var
Key: TScKey;
begin
Key := TScKey.Create(ScFileStorage.Keys);
Key.KeyName := 'key1';
Key.ImportFrom(Filename);
ScSSHClient.KeyStorage := ScFileStorage;
ScSSHClient.HostKeyName := 'key1';
ScSSHClient.Connect;
end;
I had convert my ppk file with puttygen.exe into openssh key and ssh.com key. If I import the openssh key I get this error:
At the ssh.com key I get the following error :---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EScError with message 'Key is broken'.
---------------------------
Break Continue Help
---------------------------
Please can you help me.---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EScError with message 'Unexpected end of data packet'.
---------------------------
Break Continue Help
---------------------------