wodSFTP ActiveX with PrivateKey authentication in - WeOnlyDo Discussion board

wodSFTP ActiveX with PrivateKey authentication in (wodSFTP / wodSFTP.NET / wodSFTPdll)

by koo, Tuesday, July 27, 2004, 14:54 (7424 days ago)

The Delphi demo of the wodSFTP ActiveX used Password authentication.
And the online help gives the solution of PrivateKey authentication in VB and VC.

I tried to follow the VC code and did not know how to change
a SAFEARRAY type to a OleVariant type.And I also failed to use
KEY object in WODSSHKeyLib_TLB.(I am a newbie...)

Can you tell me how can I use the PrivateKey authentication in Delphi?
(load the PrivateKey file (id_dsa eg) and connect to the SSH server)

Tnank You very much.

Re: wodSFTP ActiveX with PrivateKey authentication

by wodSupport, Tuesday, July 27, 2004, 15:17 (7424 days ago) @ koo

Koo,

I will try to make sample for you and send it on your email. If you didn't post correct email, please contact us at general@weonlydo.com

Regards,
Kreso

Re: wodSFTP ActiveX with PrivateKey authentication

by koo, Wednesday, July 28, 2004, 03:16 (7423 days ago) @ wodSupport

Thank you for your fast reply.

My mail address is correct and I will wait for your mail.

By the way, I have 2 types of environment:Delphi4 on WinNT and
Delphi7 on Win2000.So I wish I could get a general solution.

It may be a stupid question.
If the program uses the key object,I shall release the dll
besides the ocx,shall not I?

Re: wodSFTP ActiveX with PrivateKey authentication

by wodSupport, Thursday, July 29, 2004, 17:19 (7422 days ago) @ koo

Thank you for your fast reply.

My mail address is correct and I will wait for your mail.

By the way, I have 2 types of environment:Delphi4 on WinNT and
Delphi7 on Win2000.So I wish I could get a general solution.

It may be a stupid question.
If the program uses the key object,I shall release the dll
besides the ocx,shall not I?

Yes, wodKeys is a DLL. You will need to create it on the fly and release later on. But there's easier way - when you import wodKeys.DLL using Project->Import from type library, then it will appear on 'ActiveX' tab and you can just drop it on the form. Did you try that?

Re: wodSFTP ActiveX with PrivateKey authentication

by koo, Friday, July 30, 2004, 09:50 (7421 days ago) @ wodSupport

Thank you for your reply.

Yes,I have imported it.(By the way,the icon is original.)

I loaded a privatekey file(DSA key) which is created
by ssh-keygen included in OpenSSH package with a passphrase.
No error occured ,and the PrivateKey property
of key object was setted.But I can not connect to the server.

I tried to use a puppy privateKey file and failed again.
(Puppy can connect to the server with the key file.)

I even failed in a VB program as follows.

Dim key As New Keys

Sftp.HostName = SSHServer
Sftp.Authentication = authPubkey
Sftp.Login = user1

key.Load C:id_dsa , who am i
Sftp.PrivateKey = key.PrivateKey(DSAkey)

Sftp.Timeout = 30
Sftp.Connect

Maybe I made some mistake,but I have no idea.
If you can not give me a Delphi sample now,
Would you please give me a VB sample?

Thank you very much.

Re: wodSFTP ActiveX with PrivateKey authentication

by wodSupport, Monday, August 02, 2004, 03:31 (7418 days ago) @ koo

Koo,

I'm sorry I didn't send you example yet - I'm out of town (vacation times...) and couldn't get my hands on Delphi at the moment. I hope I'll be able to do it middle of August.

About your code - assuming you got no errors, only thing I can think is that wodSFTP was destroyed while trying to connect. Did you declare it as local? If so, set Blocking = 1.

What kind of server are you connecting to? OpenSSH? If so, I suggest you telnet to the server (yes, telnet, not ssh, with some other client), stop SSH service, and start it in debug mode, with

sshd -ddd

command. This way you can see actual errors you're getting, and perhaps find some way out of it.

One more thing - seems that 'Connect' method is a reserved word in Delphi. Sometimes wodSFTP's Connect method will be renamed to Connect1 by Delphi wrappers. Can you check this? Perhaps you didn't initiate connection at all?

As for VB samples, there should be samples in Program Files\WeOnlyDo.Com\wodSFTP\Samples\XYZ, many of them, even for Delphi. Can you take a look?

Regards,
Kreso

Re: wodSFTP ActiveX with PrivateKey authentication

by koo, Monday, August 02, 2004, 05:50 (7418 days ago) @ wodSupport

Thank you for your reply.

Anyway,It is not emergent.I hope You can have a good vacation.

‡@I can use connect method in delphi
(In fact,Delphi allows me to do that)

‡AWhen I set the bolocking property to True(VB and delphi),
A Invaild username or password reported by server error occured.

‡BI have seen the sample bound with Demo.(vb,delphi,vc and asp)
They works with the password authentication.
They works perfectly but they are not helpful to me.

‡CI will restart SSH server in debug mode and
try to find some clue.By the way,I am using OpenSSH
on AIX.

Re: wodSFTP ActiveX with PrivateKey authentication

by wodSupport, Wednesday, August 11, 2004, 20:48 (7409 days ago) @ koo

Koo,

if this issue is not solved, please send me email to techsupport@weonlydo.com and we'll figure it out. I have delphi available now for tests.

Kreso

Re: wodSFTP ActiveX with PrivateKey authentication

by wodSupport, Friday, August 13, 2004, 22:26 (7406 days ago) @ wodSupport

Following code works, make sure public key is copied on the server on appropriate place. wodSFTP ActiveX has to be imported in Delphi:
[code]procedure TForm1.FormCreate(Sender: TObject);
var
v: Variant;
begin
wodSFTP1.Hostname := 'put_your_host';
wodSFTP1.Login := 'put_your_login';
wodSFTP1.Authentication := 2;
wodSFTP1.Blocking := true;

v := CreateOleObject('WeOnlyDo.Keys.1');
v.Load('mykey.ppk');
wodSFTP1.PrivateKey := v.PrivateKeyData[0];
wodSFTP1.Connect();
end;[/code]

Re: wodSFTP ActiveX with PrivateKey authentication

by davi_dk, Thursday, November 10, 2005, 15:02 (6953 days ago) @ wodSupport

Hi

I have tried to implement the ActiveX component to my c++builder6.
Works fine, but I would like to use it loading a public key and add it's passphrase to it. I think my problem is that I need to somehow import the wodKeys dll into the builder, but I fail to see how this should be done. I'm not able to find it anywhere.

Davi

Following code works, make sure public key is copied on the server on appropriate place. wodSFTP ActiveX has to be imported in Delphi:
[code]procedure TForm1.FormCreate(Sender: TObject);
var
v: Variant;
begin
wodSFTP1.Hostname := 'put_your_host';
wodSFTP1.Login := 'put_your_login';
wodSFTP1.Authentication := 2;
wodSFTP1.Blocking := true;

v := CreateOleObject('WeOnlyDo.Keys.1');
v.Load('mykey.ppk');
wodSFTP1.PrivateKey := v.PrivateKeyData[0];
wodSFTP1.Connect();
end;[/code]

Re: wodSFTP ActiveX with PrivateKey authentication

by wodSupport, Thursday, November 10, 2005, 16:25 (6953 days ago) @ davi_dk

I think you can try to use line like this:

wodSFTP1.PrivateKey := v;

since wodSFTP will accept LPDISPATCH in PrivateKey property.