Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Chilkat/SFTP and key authentication
Message
De
30/06/2022 17:50:57
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Divers
Thread ID:
01684582
Message ID:
01684612
Vues:
92
>Hi there,
>is there anybody who has used chilkat for SFTP-Transfer using key-authentication?
>I tried using ssh-keygen generated key-pairs, also in openssh-format and puTTYgen-keys. All without any success. I can check some of them by using the Rebex Tiny-SFTP-Server and Filezilla but when I try to load a key with Chilkat (9.5.0.77) it fails.
>Can someone point me the right direction?
>Thanks in advance
>Thomas

Thomas, a few points.

1. Try with the latest Chilkat version. Current version is 91 (just launched).

2. Always look at .LastErrorText (or its variants). What's in there is usually quite informative and able to provide meaningful hints.

3. Can you share your code? This works for me (using OpenSSH generated keys stored at a Rebex server as authorized_keys, as you already tried).
* assume globally unlocked Chilkat
* and skipping error handling

* connect to the SFTP server
m.sftp = CREATEOBJECT("Chilkat_9_5_0.SFTP")
m.sftp.Connect("localhost", 2222)

* load the OpenSSH private key
m.sshk = CREATEOBJECT("Chilkat_9_5_0.SSHKey")
m.pkt = m.sshk.LoadText(GETFILE("pem"))
m.sshk.password = "secret"
m.sshk.FromOpenSshPrivateKey(m.pkt)

* authenticate using the private key
m.sftp.AuthenticatePk("tester", m.sshk)

* upload example
m.sftp.InitializeSftp()
m.fh = m.sftp.OpenFile("test.jpg", "writeOnly", "createTruncate")
m.sftp.UploadFile(m.fh, GETFILE("jpg"))
m.sftp.CloseHandle(m.fh)
----------------------------------
António Tavares Lopes
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform