quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_SSH_PRIVATE_KEYFILE.md (1808B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_SSH_PRIVATE_KEYFILE
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_SSH_AUTH_TYPES (3)
      9   - CURLOPT_SSH_PUBLIC_KEYFILE (3)
     10 Protocol:
     11   - SFTP
     12   - SCP
     13 Added-in: 7.16.1
     14 ---
     15 
     16 # NAME
     17 
     18 CURLOPT_SSH_PRIVATE_KEYFILE - private key file for SSH auth
     19 
     20 # SYNOPSIS
     21 
     22 ~~~c
     23 #include <curl/curl.h>
     24 
     25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_PRIVATE_KEYFILE,
     26                           char *filename);
     27 ~~~
     28 
     29 # DESCRIPTION
     30 
     31 Pass a char pointer pointing to a *filename* for your private key. If not
     32 used, libcurl defaults to **$HOME/.ssh/id_rsa** or **$HOME/.ssh/id_dsa** if
     33 the HOME environment variable is set, and in the current directory if HOME is
     34 not set.
     35 
     36 If the file is password-protected, set the password with
     37 CURLOPT_KEYPASSWD(3).
     38 
     39 The SSH library derives the public key from this private key when possible. If
     40 the SSH library cannot derive the public key from the private one and no
     41 public one is provided with CURLOPT_SSH_PUBLIC_KEYFILE(3), the transfer
     42 fails.
     43 
     44 The application does not have to keep the string around after setting this
     45 option.
     46 
     47 # DEFAULT
     48 
     49 As explained above
     50 
     51 # %PROTOCOLS%
     52 
     53 # EXAMPLE
     54 
     55 ~~~c
     56 int main(void)
     57 {
     58   CURL *curl = curl_easy_init();
     59   if(curl) {
     60     CURLcode res;
     61     curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
     62     curl_easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE,
     63                      "/home/clarkkent/.ssh/id_rsa");
     64     curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "password");
     65     res = curl_easy_perform(curl);
     66     curl_easy_cleanup(curl);
     67   }
     68 }
     69 ~~~
     70 
     71 # %AVAILABILITY%
     72 
     73 # RETURN VALUE
     74 
     75 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     76 
     77 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     78 libcurl-errors(3).