quickjs-tart

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

CURLOPT_SSH_PUBLIC_KEYFILE.md (1740B)


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