wodKey Load method - WeOnlyDo Discussion board

wodKey Load method (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Bernhard K, Tuesday, June 19, 2018, 14:14 (149 days ago)

Hi,
I have one further problem with wodSFTP in Embarcadero Delphi.

I successfully can parametrize the SFTP component and use a Putty-generated private key file (.ppk) for authentication to connect to an SFTP-Server.
The wodKeys manual states that instead of loading the key from a file it is also possible to directly load it from a string with the load method, but I am not able to do this:

var v: variant;
KeyData:variant; //I also tried string;
begin
KeyData := '-----BEGIN RSA PRIVATE KEY-----.......';
CoInitialize(nil);
SFTP := TwodSFTP.Create(nil);
SFTP.Hostname := xxx;
SFTP.Login := xxx;
SFTP.Authentication := 2;
SFTP.Timeout := 10000;
SFTP.Blocking := false;
SSHKey := CreateOleObject('WeOnlyDo.Keys.1');
SSHKey.Load(KeyData);

Here a EOLESysError exception (wrong variable type) is raised and I cannot continue.

So how can I successfully use an RSA private key that is stored in a string?

Thanks,
Bernhard

wodKey Load method

by Jasmine, Tuesday, June 19, 2018, 14:38 (149 days ago) @ Bernhard K

Hi Bernhard,

When you declared key as string, did you receive sam error?

Are you able to load key from file?

Any chance you can send us EXE that demonstrates the problem, with sample key? We would like to debug it under the hood to see why this happens.

Thanks,
Jasmine

wodKey Load method

by Bernhard K, Tuesday, June 19, 2018, 16:03 (149 days ago) @ Jasmine

Hi,
when using Load with a string I get "Failed to import string from file' error...
I will prepare an exe but this will take some time!

Thanks for your excellent support!
Regards, Bernhard