SFTP with CURLSMBS and Public/Private Key Authorization

My application has used CURLSMBS for plain vanilla FTP uploads for ages, but now the client has changed to SFTP using public-private key authorization. The SFTP example in the MBS documentation shows only simple username/password authorization and I don’t know how/where to set all the options and constants for public-private key authorization and SSH. The customer has supplied me with a puTTY ppk file which appears to contain public and private keys, as well as a “Private-MAC”.

Can someone provide or point me to a complete example for SFTP uploads using CURLSMBS and SSH public-private key authorization?

Thanks in advance.

You need to convert the ppl file to other format like pkcs12 or pem file.

and set properties for curl, e.g. from examples:


c.OptionSSHPrivateKeyfile = "/Users/test/.ssh/id_rsa"
c.OptionSSHPublicKeyfile = "/Users/test/.ssh/id_rsa.pub"
c.OptionUsername = "test"

Thanks, Christian, I will give it a try.

Working! :smiley:


Excellent :slight_smile: