Subject: Authentication Using Public Key / Private keys returns LIBSSH2_ERROR_FILE [NC]

Authentication Using Public Key / Private keys returns LIBSSH2_ERROR_FILE [NC]

From: Suresh MUNUGOTI <>
Date: Thu, 16 Jun 2011 10:50:39 +0530


I am trying to authenticate into SFTP server by using the following
function call.

LIBSSH2_API int libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION
                                       const char *username,
                                       unsigned int username_len,
                                       const char *publickey,
                                       const char *privatekey,
                                       const char *passphrase);

The function is returning LIBSSH2_ERROR_FILE .

I cross checked by using the File Zilla client by adding the Private key.
I am successfully authenticated.

The Public/Private key pairs are generated by PuttyGen.

Could you please help me whether i need to change the public and private
files format compatible to LibSSH2.

This message and any attachments (the "message") are confidential, intended solely for the addressee(s), and may contain legally privileged information.
Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration.
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or
Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et susceptibles de contenir des informations couvertes
par le secret professionnel.
Ce message est etabli a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite.
Tout message electronique est susceptible d'alteration.
La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie.

Received on 2011-06-16