EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Problem at Key.LoadPrivateKey(KeyFile), wrong password

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#1195
Posted: 09/13/2006 02:48:38
by Peter Calum (Basic support level)
Joined: 09/13/2006
Posts: 2

I have at SimpleSFTPClient which are going to use rsa keys. I have generated a key pair in puTTYgen and the private key has a passphrase. When i load the private key i get error 3373, wrong password in private key, but i set SimpleSFTPClient. user and pass to the correct values, and i get logged in to the server, but only with password authorization.
// code snip
SFTPClient.ClientHostName := User;
SFTPClient.ClientUserName := Pass;
SFTPClient.Username := User;
SFTPClient.Password := Pass;

KeyStorage.Clear;
Key := TElSSHKey.Create;
if FileExists(KeyFile) then LogWrite('Keyfile '+Keyfile+' found, passprase = '+Pass);
LogWrite('Loader Keyfile '+Keyfile+' error : '+inttostr(Key.LoadPrivateKey(KeyFile)));

if (KeyFile = '') and FileExists(KeyFile) and
(Key.LoadPrivateKey(KeyFile) = 0) then
begin
KeyStorage.Add(Key);
LogWrite('Keyfile '+Keyfile+' loaded');
SFTPClient.AuthenticationTypes := SFTPClient.AuthenticationTypes or SSH_AUTH_TYPE_PUBLICKEY;
end
else begin
SFTPClient.AuthenticationTypes := SFTPClient.AuthenticationTypes and not SSH_AUTH_TYPE_PUBLICKEY;
LogWrite('Keyfile '+Keyfile+' NOT loaded');
end;
Key.Free;
13-09-2006 09:42:16 Starting SFTP connection to : 172.17.16.200 ,User : pemca, Password : *********
13-09-2006 09:42:16 Keyfile pemca.ppk fundet, passprase = pemca01
13-09-2006 09:42:16 Loader Keyfile pemca.ppk error : 3337
13-09-2006 09:42:16 Keyfile pemca.ppk NOT loaded
13-09-2006 09:42:16 Mainstate change to : CONNECT from : MAINIDLE
13-09-2006 09:42:16 ClientSocket calling nslookup
13-09-2006 09:42:16 ClientSocket is connecting
13-09-2006 09:42:20 Mainstate change to : CONNECTED from : CONNECT
13-09-2006 09:42:20 Mainstate : CONNECTED
13-09-2006 09:42:20 Socket connection established, establishing SFTP connection
13-09-2006 09:42:20 Mainstate change to : SFTPCONNECT from : CONNECTED
13-09-2006 09:42:20 Server key [b96e86c5843008647dfd2ef606c063e4] received
13-09-2006 09:42:20 Authentication succeeded
13-09-2006 09:42:20 Mainstate change to : SFTPCONNECTED from : SFTPCONNECT
13-09-2006 09:42:21 Sftp connection established succesfully
#1196
Posted: 09/13/2006 02:56:16
by Eugene Mayevski (EldoS Corp.)

I don't see where you pass the password to the Key object.


Sincerely yours
Eugene Mayevski
#1201
Posted: 09/13/2006 03:51:27
by Peter Calum (Basic support level)
Joined: 09/13/2006
Posts: 2

i also found out, it should be --
Key.LoadPrivateKey(KeyFile, pass)

thanks
peter

Reply

Statistics

Topic viewed 3317 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!