Hi, i'm using securebridge trial with delphi seattle.
I'm trying to connect to sftp server using the demo (sftpclient), but I don't know how to use my private key.
I saw a selection in dropdownbox. Can i use my own private key (.ppk file) instead of the system generated ? how to do it ?
Secure bridge using private key
Re: Secure bridge using private key
For SSH authentication, two different keys are used: server key and client key. The server key is used to authenticate the SSH server and is checked on the client. Its name is specified in the TScSSHClient.HostKeyName property.
The client key is used to authenticate the client and is checked on the SSH server. Its name is specified in the TScSSHClient.PrivateKeyName property. The private key contains a public key and this pair is one key.
Note that the SFTP server must be preconfigured to support public key authentication for your user. For more information on configuring the SFTP server, please refer to its documentation.
The client key is used to authenticate the client and is checked on the SSH server. Its name is specified in the TScSSHClient.PrivateKeyName property. The private key contains a public key and this pair is one key.
Note that the SFTP server must be preconfigured to support public key authentication for your user. For more information on configuring the SFTP server, please refer to its documentation.
Re: Secure bridge using private key
the server is managed by other vendor, i need to connect to it and i only have username and private key .ppk file
how to do this ?
TScSSHClient.PrivateKeyName := 'C:\privatekey.ppk'
is this correct ?
how to do this ?
TScSSHClient.PrivateKeyName := 'C:\privatekey.ppk'
is this correct ?
Re: Secure bridge using private key
If the SFTP server is configured for public key access, to solve your problem you can use the following recommendations:
- import your private key into the TScStorage successor in the designtime or runtime:
- set the TScSSHClient.Authentication property to atPublicKey;
- in the TScSSHClient.PrivateKeyName property, specify the name of the private key from TScStorage.
Example:
- import your private key into the TScStorage successor in the designtime or runtime:
- set the TScSSHClient.Authentication property to atPublicKey;
- in the TScSSHClient.PrivateKeyName property, specify the name of the private key from TScStorage.
Example:
Code: Select all
procedure Connect;
var
Key: TScKey;
begin
Key: = TScKey.Create (ScFileStorage.Keys);
Key.KeyName: = 'key1';
Key.ImportFrom ('C:\privatekey.ppk');
ScSSHClient.Authentication: = atPublicKey;
ScSSHClient.KeyStorage: = ScFileStorage;
ScSSHClient.PrivateKeyName: = 'key1';
ScSSHClient.Connect;
end;