ScSSHClient Failure

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
bauerh
Posts: 11
Joined: Thu 04 Aug 2016 09:25

ScSSHClient Failure

Post by bauerh » Thu 04 Aug 2016 09:35

Hello,
I work with the C ++ Builder Xe

ScSSHClient1->; HostName = "111. 111. 111. 11";
Key->; KeyName = ScSSHClient1->; HostName;
Key->; ImportFrom ("C: \\temp \\PublicKey. TXT");
ScSSHClient1->; Authentication=atPublicKey;
ScSSHClient1->; PrivateKeyName = Key->; KeyName;
ScSSHClient1->; HostKeyName = Key->; KeyName;
ScSSHClient1->; Connect ();

I get the following error message:
The Data can Be signed by a non private key

The Key functions with Firefox->; FireFtp
Can somebody help me?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: ScSSHClient Failure

Post by ViktorV » Thu 04 Aug 2016 12:20

The error most likely occurs due to that in the TScSSHClient.PrivateKeyName property you have specified not the private key, but the public one. This property must contain the private key and its value must differ from the TScSSHClient.HostKeyName property value.
To solve the issue, please specify the private key in the TScSSHClient.PrivateKeyName property and try to reproduce the error.

bauerh
Posts: 11
Joined: Thu 04 Aug 2016 09:25

Re: ScSSHClient Failure

Post by bauerh » Thu 04 Aug 2016 14:38

I have exchanged private key for the publicly Key.
the same error message
Which value needs TScSSHClient. HostKeyName?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: ScSSHClient Failure

Post by ViktorV » Thu 04 Aug 2016 15:25

The TScSSHClient.HostKeyName property should contain the name of the server public key that is stored in KeyStorage. See more details about this property in SecureBridge help: https://www.devart.com/sbridge/docs/tsc ... eyname.htm
Please make sure you have specified the private key in the TScSSHClient.PrivateKeyName property. For this, you can use the TScKey.IsPrivate property. See more details about this property in SecureBridge help: https://www.devart.com/sbridge/docs/tsc ... rivate.htm

bauerh
Posts: 11
Joined: Thu 04 Aug 2016 09:25

Re: ScSSHClient Failure

Post by bauerh » Fri 05 Aug 2016 10:27

I go crazy

I have 3 things

1. IP Adress 111.111.111.11
2. 2. UserName DD
3. 3 PrivateKey FileName= PrivateKey.TXT
-----BEGIN RSA PRIVATE KEY-----
???????????????????????????????
?????????????J+I/hQIL2h8MDgXQ==
-----END RSA PRIVATE KEY-----

any more I do not need



TScKey *Key = ScFileStorage1->Keys->FindKey(ScSSHClient1->HostName);
Key = new TScKey(NULL);

ScSSHClient1->; HostName = "111. 111. 111. 11";
ScSSHClient1->; User = DD
Key->; KeyName = ScSSHClient1->HostName;
Key->ImportFrom("C:\\temp\\PrivateKey.TXT") ;

if(Key->IsPrivate) {ShowMessage("private");}
else {ShowMessage("not private");}

Answer = private

ScSSHClient1->Connect();
Answer = Private key not found

bauerh
Posts: 11
Joined: Thu 04 Aug 2016 09:25

Re: ScSSHClient Failure

Post by bauerh » Mon 08 Aug 2016 06:31

if nobody can help me ?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: ScSSHClient Failure

Post by ViktorV » Mon 08 Aug 2016 12:40

Please check whether the issue is reproduced when connecting to SSH server using our SSHClientApp demo project. You can find the SSHClientApp project in the %SecureBridgeDemos%\SSHClientApp directory. %SecureBridgeDemos% is the SecureBridge Demo projects installation path on your computer.
If the issue is not reproduced on our SSHClientApp demo project, please compose a complete sample demonstrating the described behavior and send it to viktorv*devart*com, in order for us to be able to answer you in more detail.

bauerh
Posts: 11
Joined: Thu 04 Aug 2016 09:25

Re: ScSSHClient Failure

Post by bauerh » Wed 10 Aug 2016 10:57

hello, viktor
many thanks for your help

This has been absent :

void __fastcall TMain1::ScSSHClient1ServerKeyValidate(TObject *Sender, TScKey *NewServerKey,
bool &Accept)
{
String fp, msg;
TScKey *Key = ScFileStorage1->Keys->FindKey(ScSSHClient1->HostName);
if ((Key == NULL) || (!Key->Ready)) {
NewServerKey->GetFingerprint(haMD5, fp);
msg = "The authenticity of the server can not be verified.\n";
msg += "Fingerprint for the key received from server: " + fp + ".\n";
msg += "Key length: " + IntToStr(NewServerKey->BitCount) + " bits.\n";
msg += "Are you sure you want to continue connecting?";

if (MessageDlg(msg, mtConfirmation, TMsgDlgButtons() << mbOK << mbCancel, 0) == mrOk) {
Key = new TScKey(NULL);
try {
Key->Assign(NewServerKey);
Key->KeyName = ScSSHClient1->HostName;
ScFileStorage1->Keys->Add(Key);
}
catch (Exception &exception) {
Key->Free();
throw;
}

Accept = true;
}
}
}
//---------------------------------------------------------------------------

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: ScSSHClient Failure

Post by ViktorV » Wed 10 Aug 2016 11:32

It is good to see that the problem has been solved.
Feel free to contact us if you have any further questions about SecureBridge.

Post Reply