私はdevart SecureBridgeを使用してSFTP経由の接続を作成していますが、SSHClientの認証タイプを設定する際に問題があります。設定認証タイプSFTP接続delphi
私が試してみると、例外はあります: 'ホスト鍵アルゴリズムのネゴシエーションが失敗しました'。私はそれがプライベート/公開鍵を使用しようとしていると思うが、パスワード認証を使用したい。
ここに私のコードですが、私は誰かが正しい方向に私を導くことを願っています。
oSSHClient := TScSSHClient.Create(nil);
oSFTPClient := nil;
oFileStorage := nil;
oFileStorage := TScFileStorage.Create(nil);
oSSHClient.KeyStorage := oFileStorage;
iColon := pos(':', edHost.text);
oSSHClient.HostName := edHost.Text;
if iColon > 0 then
begin
oSSHClient.Port := StrToIntDef(copy(edHost.Text, iColon+1, length(edHost.Text)), 22);
end;
oSSHClient.User := edUser.Text;
oSSHClient.Password := edPassword.Text;
oSSHClient.Authentication := oSSHClient.Authentication.atPassword; // How am i supposed to set this
oSSHClient.Connect;
EDIT:WORKING CODE OTHERSが見FOR:
oSSHClient := TScSSHClient.Create(nil);
oFileStorage := nil;
try
oFileStorage := TScFileStorage.Create(nil);
oSSHClient.KeyStorage := oFileStorage;
iColon := pos(':', edHost.text);
oSSHClient.HostName := edHost.Text;
if iColon > 0 then
begin
oSSHClient.Port := StrToIntDef(copy(edHost.Text, iColon+1, length(edHost.Text)), 22);
end;
oSSHClient.User := edUser.Text;
oSSHClient.Password := edPassword.Text;
oSSHClient.HostKeyAlgorithms.AsString:='ssh-rsa,ssh-dss';
oSSHClient.OnServerKeyValidate := ScSSHClientServerKeyValidate;
oSSHClient.Authentication := atPassword;
try
try
oSSHClient.Connect;
TestErrorTekst := GetLang('CaptConnectToServerOK');
except
TestErrorTekst := GetLang('CaptConnectToServerFailed');
end;
finally
oSSHClient.Disconnect;
end;
finally
edTest.Text := TestErrorTekst;
oSSHClient.Free;
oFileStorage.Free;
end;
他に誰も飛び込んでいないので、私は明確ではない専門家として意見を述べます。認証はSSL(Secure Sockets Layer)と関係があり、パスワードとは関係ないことは私の理解である。これは暗号化技術であり、クライアントとサーバー間でデータが安全に渡されることを保証します。パスワードは、データが安全であることと同様に、そのデータを使用している人がFTPサイトにアクセスする権利があることを保証するためのセキュリティの追加層です。 – Dsm