Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Chilkat/SFTP and key authentication
Message
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
01684582
Message ID:
01684615
Views:
41
And again, it does not work. I generated, as written before, a key-pair with Chilkat and tried the following eyample from the Chilkat-example-page:
( The keys generated work well when I use filezilla to check them)
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.

loSftp = CreateObject('Chilkat_9_5_0.SFtp')

* Load a .ppk PuTTY private key.
loPuttyKey = CreateObject('Chilkat_9_5_0.SshKey')
lcPpkText = loPuttyKey.LoadText("d:\ssh2\chilkat_rsa_priv.ppk")

* "secret" is the actual password for the above PPK.
loPuttyKey.Password = "Muehlematt"
lnSuccess = loPuttyKey.FromPuttyPrivateKey(lcPpkText)
IF (lnSuccess <> 1) THEN
    ? loPuttyKey.LastErrorText
    RELEASE loSftp
    RELEASE loPuttyKey
    CANCEL
ENDIF

lcSshHostname = "sftp.clnet.bpm.ch"
lnSshPort = 22
SET STEP ON
* Connect to an SSH/SFTP server
lnSuccess = loSftp.Connect(lcSshHostname,lnSshPort)
IF (lnSuccess <> 1) THEN
    ? loSftp.LastErrorText
    loSFTP.Disconnect()
    RELEASE loSftp
    RELEASE loPuttyKey
    CANCEL
ENDIF
* Authenticate with the SSH server using a username + private key.
* (The private key serves as the password.  The username identifies
* the SSH user account on the server.)
lnSuccess = loSftp.AuthenticatePk("ediholste",loPuttyKey)
IF (lnSuccess <> 1) THEN
    ? loSftp.LastErrorText
    loSFTP.Disconnect()
    RELEASE loSftp
    RELEASE loPuttyKey
    CANCEL
ENDIF

? "OK, the connection and authentication with the SSH server is completed."

* This example is only to show the connection + authentication using a PuTTY private key...
loSFTP.Disconnect()
RELEASE loSftp
RELEASE loPuttyKey
And the lasterortext is:
ChilkatLog:
AuthenticatePk:
DllDate: Mar 19 2019
ChilkatVersion: 9.5.0.77
UnlockPrefix: HOLSTE.CB1042020
Architecture: Little Endian; 32-bit
Language: ActiveX
VerboseLogging: 0
Component successfully unlocked using purchased unlock code.
login: ediholste
idleTimeoutMs: 30000
sshAuthenticatePk:
keyFingerprint: ssh-rsa 2048 0f:9b:22:77:28:f1:75:3d:ad:ee:07:29:0e:33:ea:12
requestUserAuthService:
sendServiceRequest:
svcName: ssh-userauth
SentServiceReq: ssh-userauth
--sendServiceRequest
ssh-userauth service accepted.
--requestUserAuthService
Using an RSA key.
Sent public-key request.
AuthList: publickey,password
rsaSigLen: 256
Sent public-key request with signature.
Authentication failed or partial success. (4)
PartialSuccess4: 0
AuthList: publickey,password
Publickey authentication failed..
--sshAuthenticatePk
Failed.
--AuthenticatePk
--ChilkatLog

I am starting to look for some other component ti use...

Best regards

Thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform