【问题标题】:SFTP Authentication using private RSA Key in libcurl在 libcurl 中使用私有 RSA 密钥进行 SFTP 身份验证
【发布时间】:2013-02-27 14:36:14
【问题描述】:

我正在使用stfp server,但它需要RSA密钥身份验证,这里我想在我的sftp服务器上上传文件。

所以请任何人告诉我如何在 C 中以编程方式使用 RSA 的私钥验证我的 SFTP 服务器。我想在 C 中做这件事

我正在使用这个link 作为参考

但是这里没有提到如何使用 RSA 密钥对这个 SFTP 进行身份验证。

谢谢

【问题讨论】:

    标签: c curl libcurl sftp


    【解决方案1】:

    对于公钥身份验证,我添加了以下选项:

    const char* path_to_my_public_key = "~/.ssh/id_rsa.pub";
    const char* path_to_my_private_key = "~/.ssh/id_rsa";
    
    curl_easy_setopt(m_curl, CURLOPT_SSH_AUTH_TYPES, CURLSSH_AUTH_PUBLICKEY);
    curl_easy_setopt(m_curl, CURLOPT_SSH_PUBLIC_KEYFILE, path_to_my_public_key);
    curl_easy_setopt(m_curl, CURLOPT_SSH_PRIVATE_KEYFILE, path_to_my_private_key);
    

    【讨论】:

      猜你喜欢
      • 2023-02-08
      • 2013-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多