Setting Up SFTP Public Key Authorization

The example below demonstrates how to set up the SFTP Public Key Authorization for the SFTP Client component.

sftp.Server := 'sftp-host';
sftp.Port := 22;

sftp.UserKey.Clear();
sftp.UserKey.PrivateKeyFile := 'rsa-private-key';
sftp.UserKey.PassPhrase := 'private-key-password';
sftp.UserName := 'user-name';

sftp.Open();

Alternatively, you can load the private key from a stream, Delphi string list, or array of bytes.

sftp.UserKey.Load(privateKeyBytes);

Feedback

Add Feedback
I get the following error "unknow key format" (EclCryptError)
clSFtp1.UserKey.PrivateKeyFile := 'C:\private_key.ppk';
or
filename := 'C:\private_key.ppk';
stream := TFileStream.Create(filename, fmOpenRead);
clSFtp1.UserKey.Load(stream);

it is therefore not possible for me to add my private key for my connection

can you help me, please?

EPFC Support (December 12, 2019 at 12:31 PM)
I have the same "unknown key format" problem
Charles Nunes (March 26 at 11:10 PM)

Add Feedback