From libssh2-devel-bounces@cool.haxx.se  Thu Jan  7 13:33:08 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 107CWd05008785;
	Thu, 7 Jan 2021 13:32:59 +0100
Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com
 [IPv6:2a00:1450:4864:20:0:0:0:52d])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 107CUux2008508
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Thu, 7 Jan 2021 13:30:56 +0100
Received: by mail-ed1-x52d.google.com with SMTP id cw27so7585424edb.5
 for <libssh2-devel@cool.haxx.se>; Thu, 07 Jan 2021 04:30:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
 bh=VTPN4z0bwHQRuK63lJf0lu3MWGjYRy2op1mBYYVPlJI=;
 b=dxMWvqSLNqYxdPyBKSE2vx3izK8aWeFCZaSqCQi5THSVntDz1C2VdCOE6/j5Osf5+N
 3GaVq4iSit3JKRAhok7LqLj1r4wGWZ6eotaynpyxteuaDBHZ+gkxQGhDZ7Cq0r3cymQr
 fbN+OEaXwahbrTnFoq/kGd2mUrIShWwGV/04QBOS6uAjJOQCNLdD7oUK5nJxww0IoXOV
 TZOmnZF90llYgK1CD6HdFLqTvNLGr6lDceVwkAOg8SxMk+X+kR9G0WRBMv0uxT6xjch2
 pSfztVFtgnP/2TIV0KLcAoMC78QSLXc7OmcT3QDgIpg6aODDCujFHjhnnXIfYX7hWP5m
 azTA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to;
 bh=VTPN4z0bwHQRuK63lJf0lu3MWGjYRy2op1mBYYVPlJI=;
 b=HZn1yvdWyY47qsd9fzbz5yjfGr3tqPvu9+i2PAOt/3/fvr0jn9iW7Fh6+RItu3E96f
 hw50Dco93StuG7XJagSE5/UANhGsH/Ox1eX/5z9aGirY4sMooTctjYn3sLtXj68XHM2l
 bLEfCWw7XJNLHG0DO6NfYwg9EItIFFjLrtIkqpLUjnpmQBTd8jWVxuC9eC0bgIe8h0Bf
 1N7ZBwiiaL4QCuA9/NV6QD0GBRfNWT4oqkfSq/tHJhgkpgZRA6BPfMEdt6fOBWcyQhfZ
 m+OKMnE3IIZ+8qW2w6c0CLdVgU6ddo/MgsOhCYTxMUzQ7vsx77ADiGNqRCrqQbV4PjB1
 RAbA==
X-Gm-Message-State: AOAM5339qMQmRKLHUsYg+npN1DHflI2Te/EaBB3mhWj4yeE0TIg79ivH
 bE7jEGxz5wtUj8UzGdVaNVXABOoT2EvKXVF7MoCS5VGa3U8=
X-Google-Smtp-Source: ABdhPJxRRQjIvODwN6I0XANIZD1s7j+I/S/CbGNMozTs/ZVah0haLv5qMIzpjeydhK/ldb7JEJ3xslvxDMl2I2Q4IfA=
X-Received: by 2002:a50:a692:: with SMTP id e18mr1488952edc.233.1610022651675; 
 Thu, 07 Jan 2021 04:30:51 -0800 (PST)
MIME-Version: 1.0
References: <CAMRqreNARN1NJBDs9yDKW996YAVa_LqPr_fMfdvXW9UyJiK8Vg@mail.gmail.com>
 <20201017105328.18797.qmail@stuge.se>
In-Reply-To: <20201017105328.18797.qmail@stuge.se>
From: Geetha <1986geetha@gmail.com>
Date: Thu, 7 Jan 2021 17:59:59 +0530
Message-ID: <CAMRqreOFi7u=aXV6gFx7UTqtPfM0O3Mf=P6thkVGXwoSC1Eppg@mail.gmail.com>
Subject: Re: Libssh2 - wince(windows mobile 6.0) linker error
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: multipart/mixed; boundary="===============2138305177=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============2138305177==
Content-Type: multipart/alternative; boundary="0000000000003bc86b05b84e9c86"

--0000000000003bc86b05b84e9c86
Content-Type: text/plain; charset="UTF-8"

Hi Peter,

Thanks for your reply.

I have established the connection using armv4I platform.. After connection
established libssh2_sftp_init function takes 10 minutes to execute. But
atlast it's successfully initialising the SFTP session. But why it's taking
long time.. any idea would be greatly appreciated.

Thanks and regards,
Geetha

On Sat, Oct 17, 2020, 4:26 PM Peter Stuge <peter@stuge.se> wrote:

> Geetha wrote:
> > For ARMV4i processor I have built the libssh2 but when I linked into
> ARMV4i
> > wrapper project I am facing linker errors.
> >
> > Doubt: can libssh2 work for ARMV4i processor?
>
> Since you have compiled it I expect that it will work. But you must
> provide a correct OpenSSL library as I already wrote.
>
>
> > Below are the errors.
> >
> > 1>------ Build started: Project: Mobiletesting, Configuration: Debug
> > Windows Mobile 6 Professional SDK (ARMV4I) ------
> > 1>Linking...
> > 1>libssh2.lib(openssl.obj) : error LNK2019: unresolved external symbol
> RSA_new referenced in function _libssh2_rsa_new
> > 1>libssh2.lib(openssl.obj) : error LNK2019: unresolved external symbol
> BN_bin2bn referenced in function _libssh2_rsa_new
> > 1>libssh2.lib(openssl.obj) : error LNK2019: unresolved external symbol
> BN_new referenced in function _libssh2_rsa_new
> > 1>libssh2.lib(openssl.obj) : error LNK2019: unresolved external symbol
> RSA_verify referenced in function _libssh2_rsa_sha1_verify
> > 1>libssh2.lib(openssl.obj) : error LNK2019: unresolved external symbol
> DSA_new referenced in function _libssh2_dsa_new
> > 1>libssh2.lib(openssl.obj) : error LNK2019: unresolved external symbol
> DSA_SIG_free referenced in function _libssh2_dsa_sha1_verify
> > 1>libssh2.lib(openssl.obj) : error LNK2019: unresolved external symbol
> DSA_do_verify referenced in function _libssh2_dsa_sha1_verify
> > 1>libssh2.lib(openssl.obj) : error LNK2019: unresolved external symbol
> DSA_SIG_new referenced in function _libssh2_dsa_sha1_verify
> > 1>libssh2.lib(openssl.obj) : error LNK2019: unresolved external symbol
> EC_GROUP_get_curve_name referenced in function
> _libssh2_ecdsa_key_get_curve_type
> > 1>libssh2.lib(openssl.obj) : error LNK2019: unresolved external symbol
> EC_KEY_get0_group referenced in function _libssh2_ecdsa_key_get_curve_type
> > 1>libssh2.lib(openssl.obj) : error LNK2019: unresolved external symbol
> EC_POINT_free referenced in function
> _libssh2_ecdsa_curve_name_with_octal_new
> > 1>libssh2.lib(openssl.obj) : error LNK2019: unresolved external symbol
> EC_KEY_set_public_key referenced in function
> _libssh2_ecdsa_curve_name_with_octal_new
>
> If these are the only errors then I think that you have made progress,
> because it seems that symbols which were missing before can now be found
> by the linker.
>
> But not all neccessary symbols. Which means that your OpenSSL library
> files do not contain all functionality needed by libssh2.
>
> Again, I recommend that you spend the time to learn to build OpenSSL
> yourself, so that you can build an OpenSSL library which suits your
> project.
>
> This also allows you to later update OpenSSL in your final program
> independently, which I consider very important when using a less
> common platform (ie. ARMv4 Windows Mobile).
>
>
> //Peter
> _______________________________________________
> libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>

--0000000000003bc86b05b84e9c86
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Hi Peter,<div dir=3D"auto"><br></div><div dir=3D"auto">Th=
anks for=C2=A0your reply.</div><div dir=3D"auto"><br></div><div dir=3D"auto=
">I have established the connection using armv4I platform.. After connectio=
n established libssh2_sftp_init function takes 10 minutes to execute. But a=
tlast it&#39;s successfully initialising the SFTP session. But why it&#39;s=
 taking long time.. any idea would be greatly appreciated.</div><div dir=3D=
"auto"><br></div><div dir=3D"auto">Thanks and=C2=A0regards,</div><div dir=
=3D"auto">Geetha</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr"=
 class=3D"gmail_attr">On Sat, Oct 17, 2020, 4:26 PM Peter Stuge &lt;<a href=
=3D"mailto:peter@stuge.se">peter@stuge.se</a>&gt; wrote:<br></div><blockquo=
te class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc so=
lid;padding-left:1ex">Geetha wrote:<br>
&gt; For ARMV4i processor I have built the libssh2 but when I linked into A=
RMV4i<br>
&gt; wrapper project I am facing linker errors.<br>
&gt; <br>
&gt; Doubt: can libssh2 work for ARMV4i processor?<br>
<br>
Since you have compiled it I expect that it will work. But you must<br>
provide a correct OpenSSL library as I already wrote.<br>
<br>
<br>
&gt; Below are the errors.<br>
&gt; <br>
&gt; 1&gt;------ Build started: Project: Mobiletesting, Configuration: Debu=
g<br>
&gt; Windows Mobile 6 Professional SDK (ARMV4I) ------<br>
&gt; 1&gt;Linking...<br>
&gt; 1&gt;libssh2.lib(openssl.obj) : error LNK2019: unresolved external sym=
bol RSA_new referenced in function _libssh2_rsa_new<br>
&gt; 1&gt;libssh2.lib(openssl.obj) : error LNK2019: unresolved external sym=
bol BN_bin2bn referenced in function _libssh2_rsa_new<br>
&gt; 1&gt;libssh2.lib(openssl.obj) : error LNK2019: unresolved external sym=
bol BN_new referenced in function _libssh2_rsa_new<br>
&gt; 1&gt;libssh2.lib(openssl.obj) : error LNK2019: unresolved external sym=
bol RSA_verify referenced in function _libssh2_rsa_sha1_verify<br>
&gt; 1&gt;libssh2.lib(openssl.obj) : error LNK2019: unresolved external sym=
bol DSA_new referenced in function _libssh2_dsa_new<br>
&gt; 1&gt;libssh2.lib(openssl.obj) : error LNK2019: unresolved external sym=
bol DSA_SIG_free referenced in function _libssh2_dsa_sha1_verify<br>
&gt; 1&gt;libssh2.lib(openssl.obj) : error LNK2019: unresolved external sym=
bol DSA_do_verify referenced in function _libssh2_dsa_sha1_verify<br>
&gt; 1&gt;libssh2.lib(openssl.obj) : error LNK2019: unresolved external sym=
bol DSA_SIG_new referenced in function _libssh2_dsa_sha1_verify<br>
&gt; 1&gt;libssh2.lib(openssl.obj) : error LNK2019: unresolved external sym=
bol EC_GROUP_get_curve_name referenced in function _libssh2_ecdsa_key_get_c=
urve_type<br>
&gt; 1&gt;libssh2.lib(openssl.obj) : error LNK2019: unresolved external sym=
bol EC_KEY_get0_group referenced in function _libssh2_ecdsa_key_get_curve_t=
ype<br>
&gt; 1&gt;libssh2.lib(openssl.obj) : error LNK2019: unresolved external sym=
bol EC_POINT_free referenced in function _libssh2_ecdsa_curve_name_with_oct=
al_new<br>
&gt; 1&gt;libssh2.lib(openssl.obj) : error LNK2019: unresolved external sym=
bol EC_KEY_set_public_key referenced in function _libssh2_ecdsa_curve_name_=
with_octal_new<br>
<br>
If these are the only errors then I think that you have made progress,<br>
because it seems that symbols which were missing before can now be found<br=
>
by the linker.<br>
<br>
But not all neccessary symbols. Which means that your OpenSSL library<br>
files do not contain all functionality needed by libssh2.<br>
<br>
Again, I recommend that you spend the time to learn to build OpenSSL<br>
yourself, so that you can build an OpenSSL library which suits your<br>
project.<br>
<br>
This also allows you to later update OpenSSL in your final program<br>
independently, which I consider very important when using a less<br>
common platform (ie. ARMv4 Windows Mobile).<br>
<br>
<br>
//Peter<br>
_______________________________________________<br>
libssh2-devel <a href=3D"https://cool.haxx.se/cgi-bin/mailman/listinfo/libs=
sh2-devel" rel=3D"noreferrer noreferrer" target=3D"_blank">https://cool.hax=
x.se/cgi-bin/mailman/listinfo/libssh2-devel</a><br>
</blockquote></div>

--0000000000003bc86b05b84e9c86--

--===============2138305177==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k
ZXZlbCBodHRwczovL2Nvb2wuaGF4eC5zZS9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vbGlic3No
Mi1kZXZlbAo=

--===============2138305177==--

From libssh2-devel-bounces@cool.haxx.se  Thu Jan  7 15:58:12 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 107EvfsL006622;
	Thu, 7 Jan 2021 15:58:03 +0100
Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com
 [IPv6:2607:f8b0:4864:20:0:0:0:32c])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 107Evcj4006610
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Thu, 7 Jan 2021 15:57:39 +0100
Received: by mail-ot1-x32c.google.com with SMTP id i6so6523811otr.2
 for <libssh2-devel@cool.haxx.se>; Thu, 07 Jan 2021 06:57:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
 bh=8/sXFBy4Zu7cbsIPhyWzS5lPXHxuMZa/u7tEe/kBVn8=;
 b=gqG3mJHHXwxfNzU+uGWKeHqLaA6CWXNvjZBKa9+CskPyRztV2vsPmyFOu367+Q2kUn
 BEMMNPT5uaGnAmTatllv4ZElGmjUd2DR5EIA0NBJ1GhKI1C2aYSId6O+MjXAsmvpZrWg
 s5q3fx84ZC8w/N/0NrlXyJjdA2s/3Ys1CfhD22f0ciGnEIzTGYkb0+atnkeLUsM+26QM
 HUqKlsfhuikOmQNYHsCTVAChncFG6WOmnSC8Mu62PSiXsyDbqT1kpDCmw7ujPpOtgEeF
 7LvO2bsJWcaFc1XS+32CEe51Zvp4sTq0Z7eSCdNI1HeNqbnGhjGkt2+pZpXKnEKs3SiO
 2c3w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to;
 bh=8/sXFBy4Zu7cbsIPhyWzS5lPXHxuMZa/u7tEe/kBVn8=;
 b=FG4zEv8IQLKkT0PctfoP+djESzvyscg84BDnoWaoRJTa5SEPSzq2AnzU2mlythMHih
 GIOxrFbAjYuO4AJYN66+vGCyQdxWrN6KwX9PR92MX9sz75SOYEDHMBhij2YcBWYxzgKr
 O3i1XdSkImEwLf91ibWD12EXceZPLeMiKDuT080DjMHGd0CQIPjNhOXrxv9AhZ3qaTSA
 MPixCSZEn9YyJx7nuknzl//qdHXn8+PdK/vCNrQyIEtTr+fjez7B+21xarRxsIW8Zhao
 t7jtgiiS0CABPAomoHyMBbKD193rAWntn0bZniBV6nTN0bmWcHR+olULFxp+aqzpF5rr
 nsrA==
X-Gm-Message-State: AOAM532GwwnDk1X72tEqbw+U6lu4Aa6cp7mU6fjBCerUtRRn8Th6eCnH
 C7VMtjNa0cqwgF0fNix8whTmos8CH1kOx7BnOhwS+EmF
X-Google-Smtp-Source: ABdhPJwoq29kmoGVdp+EEWYvrgjfx+9HHa08moI2UTYTIscVfL4K8T1UywxrjlKZQpI//J0ZIY+T9d228rKIAKhtMjo=
X-Received: by 2002:a9d:7a56:: with SMTP id z22mr6516945otm.317.1610031453675; 
 Thu, 07 Jan 2021 06:57:33 -0800 (PST)
MIME-Version: 1.0
References: <CAGLbYoS+cD7drosWwCb-ooxKidbdpq96To7Ueyhp=NUy9kRD8A@mail.gmail.com>
 <20201228220859.GM31099@funkthat.com>
In-Reply-To: <20201228220859.GM31099@funkthat.com>
From: Scott Weber <scotty2540@gmail.com>
Date: Thu, 7 Jan 2021 08:57:22 -0600
Message-ID: <CAGLbYoSc72ZVRiP-kVXWZ9kcUDkbW5xCm5KCs2tkyzeOk7H1PA@mail.gmail.com>
Subject: Re: Newbie Question on Private Key
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: multipart/mixed; boundary="===============0035785873=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============0035785873==
Content-Type: multipart/alternative; boundary="000000000000dfbf0e05b850a8b6"

--000000000000dfbf0e05b850a8b6
Content-Type: text/plain; charset="UTF-8"

John-Mark,
Thanks.  It's working, and now I have a better understanding.
I was not sure if "Thanks" replies were preferred.  They can clutter up
conversations and mailing lists.

Scott Weber
Scotty2540@gmail.com

On Mon, Dec 28, 2020 at 4:12 PM John-Mark Gurney <jmg@funkthat.com> wrote:

> Scott Weber wrote this message on Mon, Dec 28, 2020 at 09:15 -0600:
> > First correct me if I'm wrong, but the protocol seems to use a PKI, but
> not
> > certificates.  So the public/private exchange is used to generate the
> > symmetric key, like SSL, but there is no requirement for a CA.
>
> Correct, the host has a public/private key pair, and the user MAY have
> a key pair for authentication as well...
>
> > Now connecting as a client, the
> > function libssh2_userauth_publickey_fromfile(...)
> > requires BOTH the public and private key.
> > Why?
> > Having both keys out in the wild seems to be a serious security risk.
>
> This is the user's key...  The key maybe encrypted, which is why the
> passphrase is an argument.  If the client doesn't have access to the
> user's private key, it cannot sign a statement that the server uses to
> verify the public key in .ssh/authorized_keys file...
>
> Note: there is a mode that allows a CA to sign certs that can be used,
> but it is not commonly used, but does have some interesting improvements
> security wise.
>
> > Also, I've done some testing, and it appears that only the private key is
> > needed. I can NULL out the public key.  (and yet the function name is  "
> > ... publickey_fromfile" )
> > Again, why?
>
> Also, I'm looking at the man page, and I believe that this doc is wrong
> (from docs/libssh2_userauth_password_ex.3):
>        publickey   -   Path   name   of   the   public   key   file.
>  (e.g.
>        /etc/ssh/hostkey.pub). If libssh2 is built against OpenSSL, this
> option
>        can be set to NULL.
>
>        privatekey - Path name of the private key file. (e.g.
> /etc/ssh/hostkey)
>
> those e.g. should be ~/.ssh/id_rsa.pub and ~/.ssh/id_rsa..  Though it
> could be other names as well..
>
> The likely reason the public key can be NULL'd out is that the private key
> either contains the public key, or the public key can easily be derived
> from the private key (and it is often safest to do so)...
>
> > I have both keys also on the linux server, but it appears (via the conf)
> > that the server only uses the public key.
> > It would seem that putting the public key "out in the wild" and keeping
> the
> > private key on the server is the normal step, at least when creating SSL
> > handshakes.
>
> I think you may have been confused by the above docs, but you are correct
> that the host private key should NOT be used, and even if you did, it
> would not work...
>
> > Would it function if I placed the private key in the authorized_keys file
> > on the server, and used the public key on the client?
>
> No, it would not.
>
> Hope this helps.
>
> --
>   John-Mark Gurney                              Voice: +1 415 225 5579
>
>      "All that I will do, has been done, All that I have, has not."
> _______________________________________________
> libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>

--000000000000dfbf0e05b850a8b6
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">John-Mark,<div>Thanks.=C2=A0 It&#39;s wor=
king, and now I have a better understanding.</div><div>I was not sure if &q=
uot;Thanks&quot; replies were preferred.=C2=A0 They can clutter up conversa=
tions and mailing lists.<div><br clear=3D"all"><div><div dir=3D"ltr" class=
=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><d=
iv><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div d=
ir=3D"ltr"><div>Scott Weber<br></div><a href=3D"mailto:Scotty2540@gmail.com=
" target=3D"_blank">Scotty2540@gmail.com</a>=C2=A0=C2=A0 <br></div></div></=
div></div></div></div></div></div></div></div></div></div></div></div><br><=
div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Dec=
 28, 2020 at 4:12 PM John-Mark Gurney &lt;<a href=3D"mailto:jmg@funkthat.co=
m">jmg@funkthat.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quot=
e" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)=
;padding-left:1ex">Scott Weber wrote this message on Mon, Dec 28, 2020 at 0=
9:15 -0600:<br>
&gt; First correct me if I&#39;m wrong, but the protocol seems to use a PKI=
, but not<br>
&gt; certificates.=C2=A0 So the public/private exchange is used to generate=
 the<br>
&gt; symmetric key, like SSL, but there is no requirement for a CA.<br>
<br>
Correct, the host has a public/private key pair, and the user MAY have<br>
a key pair for authentication as well...<br>
<br>
&gt; Now connecting as a client, the<br>
&gt; function libssh2_userauth_publickey_fromfile(...)<br>
&gt; requires BOTH the public and private key.<br>
&gt; Why?<br>
&gt; Having both keys out in the wild seems to be a serious security risk.<=
br>
<br>
This is the user&#39;s key...=C2=A0 The key maybe encrypted, which is why t=
he<br>
passphrase is an argument.=C2=A0 If the client doesn&#39;t have access to t=
he<br>
user&#39;s private key, it cannot sign a statement that the server uses to<=
br>
verify the public key in .ssh/authorized_keys file...<br>
<br>
Note: there is a mode that allows a CA to sign certs that can be used,<br>
but it is not commonly used, but does have some interesting improvements<br=
>
security wise.<br>
<br>
&gt; Also, I&#39;ve done some testing, and it appears that only the private=
 key is<br>
&gt; needed. I can NULL out the public key.=C2=A0 (and yet the function nam=
e is=C2=A0 &quot;<br>
&gt; ... publickey_fromfile&quot; )<br>
&gt; Again, why?<br>
<br>
Also, I&#39;m looking at the man page, and I believe that this doc is wrong=
<br>
(from docs/libssh2_userauth_password_ex.3):<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0publickey=C2=A0 =C2=A0-=C2=A0 =C2=A0Path=C2=A0 =
=C2=A0name=C2=A0 =C2=A0of=C2=A0 =C2=A0the=C2=A0 =C2=A0public=C2=A0 =C2=A0ke=
y=C2=A0 =C2=A0file.=C2=A0 =C2=A0 =C2=A0(e.g.<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0/etc/ssh/hostkey.pub). If libssh2 is built again=
st OpenSSL, this option<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0can be set to NULL.<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0privatekey - Path name of the private key file. =
(e.g. /etc/ssh/hostkey)<br>
<br>
those e.g. should be ~/.ssh/id_rsa.pub and ~/.ssh/id_rsa..=C2=A0 Though it<=
br>
could be other names as well..<br>
<br>
The likely reason the public key can be NULL&#39;d out is that the private =
key<br>
either contains the public key, or the public key can easily be derived<br>
from the private key (and it is often safest to do so)...<br>
<br>
&gt; I have both keys also on the linux server, but it appears (via the con=
f)<br>
&gt; that the server only uses the public key.<br>
&gt; It would seem that putting the public key &quot;out in the wild&quot; =
and keeping the<br>
&gt; private key on the server is the normal step, at least when creating S=
SL<br>
&gt; handshakes.<br>
<br>
I think you may have been confused by the above docs, but you are correct<b=
r>
that the host private key should NOT be used, and even if you did, it<br>
would not work...<br>
<br>
&gt; Would it function if I placed the private key in the authorized_keys f=
ile<br>
&gt; on the server, and used the public key on the client?<br>
<br>
No, it would not.<br>
<br>
Hope this helps.<br>
<br>
-- <br>
=C2=A0 John-Mark Gurney=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Voice: +1 415 225 5579=
<br>
<br>
=C2=A0 =C2=A0 =C2=A0&quot;All that I will do, has been done, All that I hav=
e, has not.&quot;<br>
_______________________________________________<br>
libssh2-devel <a href=3D"https://cool.haxx.se/cgi-bin/mailman/listinfo/libs=
sh2-devel" rel=3D"noreferrer" target=3D"_blank">https://cool.haxx.se/cgi-bi=
n/mailman/listinfo/libssh2-devel</a><br>
</blockquote></div></div>

--000000000000dfbf0e05b850a8b6--

--===============0035785873==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k
ZXZlbCBodHRwczovL2Nvb2wuaGF4eC5zZS9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vbGlic3No
Mi1kZXZlbAo=

--===============0035785873==--

From libssh2-devel-bounces@cool.haxx.se  Tue Jan 12 05:52:31 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10C4pqN9021391;
	Tue, 12 Jan 2021 05:52:18 +0100
Received: from mx0a-00190b01.pphosted.com (mx0a-00190b01.pphosted.com
 [IPv6:2620:100:9001:583:0:0:0:1])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10C4plfY021375
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 12 Jan 2021 05:51:49 +0100
Received: from pps.filterd (m0050093.ppops.net [127.0.0.1])
 by m0050093.ppops.net-00190b01. (8.16.0.43/8.16.0.43) with SMTP id
 10C4n9bh023487
 for <libssh2-devel@cool.haxx.se>; Tue, 12 Jan 2021 04:51:43 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com;
 h=from : to : subject :
 date : message-id : references : in-reply-to : content-type :
 mime-version; s=jan2016.eng;
 bh=jX3jsmuUIbDah327xFXwoQpT2j2MaT/nBLoMReaudm0=;
 b=JBgFwPJrC9M3KfwfTVD5b9cwoDcovI6hwdKUncjh37etqvdoq9L7V/fKrraIWAD5X1Vt
 u7XMpLHu4dpZuzB1AOoPHEyM5QnGEQof/Re9yqB+H01ls7zSIkrpsMWdohD/ST6JGbTh
 zHoyqb5FEX1YA+4SgQ4q0j6IpZCMlsQIsFLfxbZp8FhUCT2mNN1RF24cS3wJgLhPYnXg
 k+0XVXT+QEENuT04vkykeoT5wnld+FynxCDuUVenOSkO/EVbNOvDMte2IQ3AlxdnN2a+
 lrEzWj+gKwgpfUHz49oXXOX1S1Tw7w98llF70PsNqP4JHkXa92y0G3kOgYsROAKFS+7b aQ== 
Received: from prod-mail-ppoint4
 (a72-247-45-32.deploy.static.akamaitechnologies.com [72.247.45.32] (may be
 forged)) by m0050093.ppops.net-00190b01. with ESMTP id 3605h8814b-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 12 Jan 2021 04:51:43 +0000
Received: from pps.filterd (prod-mail-ppoint4.akamai.com [127.0.0.1])
 by prod-mail-ppoint4.akamai.com (8.16.0.43/8.16.0.43) with SMTP id
 10C4mtjo002959
 for <libssh2-devel@cool.haxx.se>; Mon, 11 Jan 2021 23:51:42 -0500
Received: from email.msg.corp.akamai.com ([172.27.165.118])
 by prod-mail-ppoint4.akamai.com with ESMTP id 35y8q35wd7-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 11 Jan 2021 23:51:42 -0500
Received: from USTX2EX-DAG3MB3.msg.corp.akamai.com (172.27.165.127) by
 USTX2EX-DAG3MB4.msg.corp.akamai.com (172.27.165.128) with Microsoft SMTP
 Server (TLS) id 15.0.1497.2; Mon, 11 Jan 2021 22:51:42 -0600
Received: from USTX2EX-DAG3MB3.msg.corp.akamai.com ([172.27.165.127]) by
 USTX2EX-DAG3MB3.msg.corp.akamai.com ([172.27.165.127]) with mapi id
 15.00.1497.010; Mon, 11 Jan 2021 22:51:42 -0600
From: "Kelley, Ryan" <rkelley@akamai.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: RE: New Release - 1.9.1
Thread-Topic: New Release - 1.9.1
Thread-Index: AQHWnjPpZCKxHHE1J0qsF0vbcmVC6aokAJrw
Date: Tue, 12 Jan 2021 04:51:41 +0000
Message-ID: <121ead1e985c406a99a602e7100bc1be@USTX2EX-DAG3MB3.msg.corp.akamai.com>
References: <6c5b3730d0034050ae24f6e48af86fde@usma1ex-dag3mb5.msg.corp.akamai.com>
 <alpine.DEB.2.20.2010081057450.31300@tvnag.unkk.fr>
 <C5154549-B940-488B-9AD3-E15CCE06455D@panic.com>
 <fae9b0c3-8fc4-5317-fef9-df1c70438a87@marc-hoersken.de>
In-Reply-To: <fae9b0c3-8fc4-5317-fef9-df1c70438a87@marc-hoersken.de>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator: 
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [172.19.33.33]
MIME-Version: 1.0
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737
 definitions=2021-01-12_01:2021-01-11,
 2021-01-12 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0
 mlxscore=0 malwarescore=0
 spamscore=0 bulkscore=0 suspectscore=0 phishscore=0 mlxlogscore=999
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000
 definitions=main-2101120026
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737
 definitions=2021-01-12_01:2021-01-11,
 2021-01-12 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 lowpriorityscore=0
 malwarescore=0 priorityscore=1501 mlxlogscore=999 adultscore=0
 clxscore=1011 bulkscore=0 spamscore=0 impostorscore=0 phishscore=0
 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.12.0-2009150000 definitions=main-2101120026
X-Agari-Authentication-Results: mx.akamai.com;
 spf=${SPFResult} (sender IP is 72.247.45.32)
 smtp.mailfrom=rkelley@akamai.com smtp.helo=prod-mail-ppoint4
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: multipart/mixed; boundary="===============0795645299=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============0795645299==
Content-Language: en-US
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature";
	micalg=SHA1; boundary="----=_NextPart_000_0000_01D6E874.B4F31C10"

------=_NextPart_000_0000_01D6E874.B4F31C10
Content-Type: text/plain;
	charset="utf-8"
Content-Transfer-Encoding: 7bit

Just curious if on the status of this updated release.

Ryan Kelley
Senior Software Engineer II

-----Original Message-----
From: Marc Hoersken <info@marc-hoersken.de>
Sent: Friday, October 09, 2020 8:00 AM
To: libssh2-devel@cool.haxx.se
Subject: Re: New Release - 1.9.1

Friendly Reminder: I would like to merge a small security related change as 
part of the release.

On 08.10.20 19:02, Will Cosgrove wrote:
> To my knowledge, there is nothing that needs to be merged before a release.
>
> Will
>
>> On Oct 8, 2020, at 1:58 AM, Daniel Stenberg <daniel@haxx.se> wrote:
>>
>> On Thu, 8 Oct 2020, Kelley, Ryan wrote:
>>
>>> It has been about an year since Will put out a call to release a 1.9.1 
>>> soon due to a bunch of good fixes. It would be great if we could get that 
>>> release out the door.
>> I'd be in favor.
>>
>> Any particular issues/pull-requests that SHOULD get fixed first?
>
> _______________________________________________
> libssh2-devel
> https://urldefense.proofpoint.com/v2/url?u=https-3A__cool.haxx.se_cgi-
> 2Dbin_mailman_listinfo_libssh2-2Ddevel&d=DwIGaQ&c=96ZbZZcaMF4w0F4jpN6L
> Zg&r=O44kEvMioNdDVtqnasG-8_v2D0JXba5USf9PKKkdrBU&m=OOmF92tyKfLb0r_k-WQ
> 98TCNIGKpio0DGBIxTCHgO2k&s=1bDkwsiCsYomOfHt5_WS8wlqJA14bZo4DbPZHOGcEaA
> &e=
_______________________________________________
libssh2-devel 
https://urldefense.proofpoint.com/v2/url?u=https-3A__cool.haxx.se_cgi-2Dbin_mailman_listinfo_libssh2-2Ddevel&d=DwIGaQ&c=96ZbZZcaMF4w0F4jpN6LZg&r=O44kEvMioNdDVtqnasG-8_v2D0JXba5USf9PKKkdrBU&m=OOmF92tyKfLb0r_k-WQ98TCNIGKpio0DGBIxTCHgO2k&s=1bDkwsiCsYomOfHt5_WS8wlqJA14bZo4DbPZHOGcEaA&e=

------=_NextPart_000_0000_01D6E874.B4F31C10
Content-Type: application/pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIILvjCCAc0w
ggFzoAMCAQICEBWwiAMHXDS7Q8DxTR/GKBEwCgYIKoZIzj0EAwIwPzEhMB8GA1UEChMYQWthbWFp
IFRlY2hub2xvZ2llcyBJbmMuMRowGAYDVQQDExFBa2FtYWlDb3JwUm9vdC1HMTAeFw0xNTA1MDUx
ODA5MjBaFw00MDA1MDUxODE5MjBaMD8xITAfBgNVBAoTGEFrYW1haSBUZWNobm9sb2dpZXMgSW5j
LjEaMBgGA1UEAxMRQWthbWFpQ29ycFJvb3QtRzEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARl
k5NoCPduAuWtjE9cFFfGYSzz6+kqS2Ys/LckQf2pPv6ZBFThRFEZhdbH6JqzeS9Kdz/zOm3WPOOE
a01s2l6Zo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUrQGH6txZ
rrETOZVND1egJIaLe70wEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0EAwIDSAAwRQIgKY8PO2tJ
89kGAIPZLEJXCa0fVRPBYoF9LGIEQGBDQjECIQDlbB4arnvZHK7HN0fpn72P1/DsFpmhjVXhJMmX
3Ev4hTCCBGYwggQLoAMCAQICEz4AAAAK6rMbEGiV3VMAAAAAAAowCgYIKoZIzj0EAwIwPzEhMB8G
A1UEChMYQWthbWFpIFRlY2hub2xvZ2llcyBJbmMuMRowGAYDVQQDExFBa2FtYWlDb3JwUm9vdC1H
MTAeFw0xNTA2MDQxNDQ2MDdaFw0yNTA2MDQxNDU2MDdaMDwxITAfBgNVBAoTGEFrYW1haSBUZWNo
bm9sb2dpZXMgSW5jLjEXMBUGA1UEAxMOQWthbWFpQ2xpZW50Q0EwWTATBgcqhkjOPQIBBggqhkjO
PQMBBwNCAASm4800D9kSNYSSGOBasoCKk5DvYXDG0fyXq2+1sgULkh+lcWIA3lgH//J15HdozVeT
2X8k5CVvA64600/tSBmio4IC5zCCAuMwEAYJKwYBBAGCNxUBBAMCAQAwHQYDVR0OBBYEFJOHqzFm
kNrKTRYDjOTDD73mDSwMMIGwBgNVHSAEgagwgaUwgaIGCyoDBI9OAQkJCAEBMIGSMFgGCCsGAQUF
BwICMEweSgBBAGsAYQBtAGEAaQAgAEMAZQByAHQAaQBmAGkAYwBhAHQAZQAgAFAAcgBhAGMAdABp
AGMAZQAgAFMAdABhAHQAZQBtAGUAbgB0MDYGCCsGAQUFBwIBFipodHRwOi8vYWthbWFpY3JsLmFr
YW1haS5jb20vQWthbWFpQ1BTLnBkZgAwVQYDVR0lBE4wTAYIKwYBBQUHAwIGCCsGAQUFBwMEBgor
BgEEAYI3FAICBgorBgEEAYI3CgMEBgorBgEEAYI3CgMMBggrBgEFBQcDBwYIKwYBBQUHAwkwGQYJ
KwYBBAGCNxQCBAweCgBTAHUAYgBDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHwYD
VR0jBBgwFoAUrQGH6txZrrETOZVND1egJIaLe70wgYAGA1UdHwR5MHcwdaBzoHGGMWh0dHA6Ly9h
a2FtYWljcmwuYWthbWFpLmNvbS9Ba2FtYWlDb3JwUm9vdC1HMS5jcmyGPGh0dHA6Ly9ha2FtYWlj
cmwuZGZ3MDEuY29ycC5ha2FtYWkuY29tL0FrYW1haUNvcnBSb290LUcxLmNybDCByAYIKwYBBQUH
AQEEgbswgbgwLQYIKwYBBQUHMAGGIWh0dHA6Ly9ha2FtYWlvY3NwLmFrYW1haS5jb20vb2NzcDA9
BggrBgEFBQcwAoYxaHR0cDovL2FrYW1haWNybC5ha2FtYWkuY29tL0FrYW1haUNvcnBSb290LUcx
LmNydDBIBggrBgEFBQcwAoY8aHR0cDovL2FrYW1haWNybC5kZncwMS5jb3JwLmFrYW1haS5jb20v
QWthbWFpQ29ycFJvb3QtRzEuY3J0MAoGCCqGSM49BAMCA0kAMEYCIQDFvYEMQjm7tWkbhOBHQpuy
S0ppA6IUvpPoq2QDHsPzEAIhAMlcyfzlxUswdxF7fB19H/o2vSh8B6NnohoqPfiqQrkrMIIFfzCC
BSWgAwIBAgITFwAFrz/oJaJzHw50rAAAAAWvPzAKBggqhkjOPQQDAjA8MSEwHwYDVQQKExhBa2Ft
YWkgVGVjaG5vbG9naWVzIEluYy4xFzAVBgNVBAMTDkFrYW1haUNsaWVudENBMB4XDTIwMDQxNTE1
MDgxNloXDTIxMDQxMDE1MDgxNlowazEcMBoGA1UEChMTQWthbWFpIFRlY2hub2xvZ2llczEWMBQG
A1UECwwNU1NMX0JPUy1XUEk4TTEQMA4GA1UEAxMHcmtlbGxleTEhMB8GCSqGSIb3DQEJARYScmtl
bGxleUBha2FtYWkuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3ucotqjnH5AA
in0YPrmlSdCiA4QpLxOWaL1sPkWrOEWoWm8Sp95ZgaXTv+ZkFx2GkwVHPOdVjnJTiUeEMlO9hZ7G
3hM/AxZbwfxyeVGPihpqwg5E4szLfgVcKBg2buhNeFPdYEd/k4iENyLDMlN1FQDA0vEvqV1mXXKv
mjvbBFHSPs0OAWV5lECKFpLSUznhj+2QfHqPKqK4oCmLncbo0LqPO9P5Can7oLfTej5M0pDAsoVe
wGHtsPF00KyvJP9g1Y9MfBGFj+1TYdYVY9UDqxkdWzcEh015ifslfm53VZusJ9Z5FkQ//qBxv2LT
Q7RerJ6SW/k03chyX+hWO1bk2QIDAQABo4IDCjCCAwYwCwYDVR0PBAQDAgWgMDMGA1UdJQQsMCoG
CCsGAQUFBwMHBggrBgEFBQcDAgYKKwYBBAGCNwoDBAYIKwYBBQUHAwQweAYJKoZIhvcNAQkPBGsw
aTAOBggqhkiG9w0DAgICAIAwDgYIKoZIhvcNAwQCAgCAMAsGCWCGSAFlAwQBKjALBglghkgBZQME
AS0wCwYJYIZIAWUDBAECMAsGCWCGSAFlAwQBBTAHBgUrDgMCBzAKBggqhkiG9w0DBzAdBgNVHQ4E
FgQUcgdX2SvL20ewnSPpBPIEFt1I48wwRgYDVR0RBD8wPYEScmtlbGxleUBha2FtYWkuY29toCcG
CisGAQQBgjcUAgOgGQwXcmtlbGxleUBjb3JwLmFrYW1haS5jb20wHwYDVR0jBBgwFoAUk4erMWaQ
2spNFgOM5MMPveYNLAwwegYDVR0fBHMwcTBvoG2ga4YuaHR0cDovL2FrYW1haWNybC5ha2FtYWku
Y29tL0FrYW1haUNsaWVudENBLmNybIY5aHR0cDovL2FrYW1haWNybC5kZncwMS5jb3JwLmFrYW1h
aS5jb20vQWthbWFpQ2xpZW50Q0EuY3JsMIHCBggrBgEFBQcBAQSBtTCBsjA6BggrBgEFBQcwAoYu
aHR0cDovL2FrYW1haWNybC5ha2FtYWkuY29tL0FrYW1haUNsaWVudENBLmNydDBFBggrBgEFBQcw
AoY5aHR0cDovL2FrYW1haWNybC5kZncwMS5jb3JwLmFrYW1haS5jb20vQWthbWFpQ2xpZW50Q0Eu
Y3J0MC0GCCsGAQUFBzABhiFodHRwOi8vYWthbWFpb2NzcC5ha2FtYWkuY29tL29jc3AwPAYJKwYB
BAGCNxUHBC8wLQYlKwYBBAGCNxUIgs7lOoe41C2BhYsHouMhhtIPgUmE5N8FgZD6FAIBZAIBGzBB
BgkrBgEEAYI3FQoENDAyMAoGCCsGAQUFBwMHMAoGCCsGAQUFBwMCMAwGCisGAQQBgjcKAwQwCgYI
KwYBBQUHAwQwCgYIKoZIzj0EAwIDSAAwRQIgbcVXkypuN4nbEOzgfxSQwwPepo6SZ66MiUpAvo+W
mT0CIQDQhshu6pUDmI6jpEzMYmpi6lr4J4dVoX5zWSzsja3Z9DGCAzswggM3AgEBMFMwPDEhMB8G
A1UEChMYQWthbWFpIFRlY2hub2xvZ2llcyBJbmMuMRcwFQYDVQQDEw5Ba2FtYWlDbGllbnRDQQIT
FwAFrz/oJaJzHw50rAAAAAWvPzAJBgUrDgMCGgUAoIIBvTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcN
AQcBMBwGCSqGSIb3DQEJBTEPFw0yMTAxMTIwNDUxNDBaMCMGCSqGSIb3DQEJBDEWBBRdTzcfqpii
unSP1wf7FBlaMfVxhzBiBgkrBgEEAYI3EAQxVTBTMDwxITAfBgNVBAoTGEFrYW1haSBUZWNobm9s
b2dpZXMgSW5jLjEXMBUGA1UEAxMOQWthbWFpQ2xpZW50Q0ECExcABa8/6CWicx8OdKwAAAAFrz8w
ZAYLKoZIhvcNAQkQAgsxVaBTMDwxITAfBgNVBAoTGEFrYW1haSBUZWNobm9sb2dpZXMgSW5jLjEX
MBUGA1UEAxMOQWthbWFpQ2xpZW50Q0ECExcABa8/6CWicx8OdKwAAAAFrz8wgZMGCSqGSIb3DQEJ
DzGBhTCBgjALBglghkgBZQMEASowCwYJYIZIAWUDBAEWMAoGCCqGSIb3DQMHMAsGCWCGSAFlAwQB
AjAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAwBwYFKw4DAhowCwYJYIZIAWUDBAIDMAsG
CWCGSAFlAwQCAjALBglghkgBZQMEAgEwDQYJKoZIhvcNAQEBBQAEggEAec0yIDVBkDtNPnCa+Rpi
ghAGzpp2Vcru5yVZSQtI50DbwhbHI/LqNdE2YW2hHcej2IjqDvx9Pnu2GR/CbEODxIsz9boWRyz2
nr98JKx8rgvp/Krdmq7BjuHVADGlAT0GuR/jYAR37sNcdoGFUH1Dj1HIxI3oHFjpu9L64kKEufN7
Nr3SQ+A73oc+BvtvC/qtckW++J2jDEks7qVRuxGEoOlqZo4Pw5faVm7tY9He+ElDmr7bpxLQcVQI
UcILana1EF9J7gc317CppH7I7WnOGgG94j8KXihvYlNNbSXMWO76mnnLLhSRu9uEPAtIELazw7c0
PBQKUBHItM03nshw2AAAAAAAAA==

------=_NextPart_000_0000_01D6E874.B4F31C10--

--===============0795645299==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k
ZXZlbCBodHRwczovL2Nvb2wuaGF4eC5zZS9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vbGlic3No
Mi1kZXZlbAo=

--===============0795645299==--

From libssh2-devel-bounces@cool.haxx.se  Sun Jan 17 14:28:08 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10HDRYcU001458;
	Sun, 17 Jan 2021 14:27:58 +0100
Received: from server.springtimesoftware.com (server.springtimesoftware.com
 [162.254.253.20])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10HDRVlI001433
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Sun, 17 Jan 2021 14:27:32 +0100
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=springtimesoftware.com; s=default; h=Content-Transfer-Encoding:Content-Type
 :MIME-Version:Date:Message-ID:To:Subject:From:Sender:Reply-To:Cc:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=pkqna9S47FDO9JFaOKiwV4D25HYWMhpey8JPYnevGKw=; b=Y6N65ftAoJw03r4FSMb+/pszGm
 dom+a+emKPSI6yXI8HtEzjr1iYSI0GT49RxmKSrVlvW+tVX8j7UFYkVzmPPTFH1r2ymKGU43wleEG
 O0fmOkQfP2HryAIQs2mEDxwh7fRCKJ/kUjy9d28gnnDLMyqRxM8/fbhqPE0yzEwdS0HgYmPjgwrCd
 370VJX8wrWfDcCcCetr1VhkEkv4A9Q9jBE7Nh7wa4eMPef5JAO3zOqjZKSvXdapaVuthUb6WrdfLf
 JnU2X8nQ5vMByqOFwFWFu8u3Q8gFkgbUifpsT/ApuPZ75o4aZjp7f/Ks2guMi1EUo913b+/dUMAAz
 X1eKZm0g==;
Received: from [98.2.238.89] (port=2853 helo=[192.168.2.7])
 by server.springtimesoftware.com with esmtpsa (TLS1.2) tls
 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93)
 (envelope-from <dev@springtimesoftware.com>) id 1l185W-0004WR-TM
 for libssh2-devel@cool.haxx.se; Sun, 17 Jan 2021 08:27:26 -0500
From: David Spector <dev@springtimesoftware.com>
Subject: Request for help for beginner, thanks!
To: libssh2-devel@cool.haxx.se
Message-ID: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
Date: Sun, 17 Jan 2021 08:27:27 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
 Thunderbird/78.6.1
MIME-Version: 1.0
Content-Language: en-US
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - server.springtimesoftware.com
X-AntiAbuse: Original Domain - cool.haxx.se
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - springtimesoftware.com
X-Get-Message-Sender-Via: server.springtimesoftware.com: authenticated_id:
 fwd@springtimesoftware.com
X-Authenticated-Sender: server.springtimesoftware.com: fwd@springtimesoftware.com
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10HDRYcU001458

Dear libssh2 group,

This is the 2nd time I'm posting this. The last attempt didn't get 
through and isn't in the Archive.

Please, I need the simplest possible PHP coding example of using libssh 
or libssh2 to upload a single file using the sftp protocol in the 
following environment: Windows, PHP running via a local server URL in a 
browser (for example, the URL might be "localhost/upload.php"). My 
actual application is considerably more complex, but this simple example 
is all I need to get started.

I have downloaded zip file php_ssh2-1.2-7.4-ts-vc15-x64, and it contains 
php_ssh2.dll, which I assume goes into the PHP/ext directory/folder. I'm 
not aware of any other installation required.

I've been trying to understand this library for several weeks 
(part-time), including trying to read https://www.php.net/ssh2, and just 
been frustrated. I'm a beginner when it comes to cryptography.

So I am looking for SIMPLE instructions and a single example of simple 
PHP code to upload a file using sftp.

It should look something like the following working insecure example, 
but include a local encrypted (preferred) or unencrypted private key 
pathnanme. It may optionally include the certificate pathname, if that 
is required. It should not prompt the user for any information, just 
upload the file silently like the following working code does insecurely:

<?php
$c=GetConfigArr("secret.json");

echo "Uploading...".<br>;

$ftp=ftp_connect($c['host'],$c['port'],$c['timeoutSec']);
if ($ftp===false)
     exit("Cannot connect to remote server (host)");

$R=ftp_login($ftp,$c['user'],$c['password']);
if (!$R)
     {
     ftp_close($ftp);
     exit("Cannot login to remote server (host)");
     }

$file="test.txt";
$remoteDir="public_html/new/";
$R=ftp_put($ftp,$remoteDir.$file,$file,FTP_ASCII);
if (!$R)
     {
     ftp_close($ftp);
     exit("Cannot copy file '$file' to '$remoteDir$file' on remote server");
     }

ftp_close($ftp);

echo "...successfully done".<br>;

function GetConfigArr($file)
     {
     global $pagesDir;
     $configStr=@file_get_contents($file);
     if ($configStr===false)
         exit("*** Config file '$file' is missing from $pagesDir)";
     return json_decode($configStr,true);
     } // GetConfigArr
?>

David Spector
PHP developer
Springtime Software
Maine, USA
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Sun Jan 17 17:20:10 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10HGJkEa010913;
	Sun, 17 Jan 2021 17:20:01 +0100
Received: from fern.telarity.com (fern.telarity.com
 [IPv6:2605:2100:0:1:0:0:18b0:aedc])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10HGJW5Q010869
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Sun, 17 Jan 2021 17:19:32 +0100
Received: from colibri.localdomain (unknown [207.194.131.21])
 (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by fern.telarity.com (Postfix) with ESMTPSA id C26EB383258
 for <libssh2-devel@cool.haxx.se>; Sun, 17 Jan 2021 11:19:32 -0500 (EST)
Received: by colibri.localdomain (Postfix, from userid 501)
 id 315E45F817; Sun, 17 Jan 2021 08:19:31 -0800 (PST)
Date: Sun, 17 Jan 2021 08:19:31 -0800
From: Dan Fandrich <dan@coneharvesters.com>
To: libssh2-devel@cool.haxx.se
Subject: Re: Request for help for beginner, thanks!
Message-ID: <20210117161930.GB4800@coneharvesters.com>
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
User-Agent: Mutt/1.11.4 (2019-03-13)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10HGJkEa010913

On Sun, Jan 17, 2021 at 08:27:27AM -0500, David Spector wrote:
> Please, I need the simplest possible PHP coding example of using libssh or
> libssh2 to upload a single file using the sftp protocol in the following
> environment: Windows, PHP running via a local server URL in a browser (for
> example, the URL might be "localhost/upload.php"). My actual application is
> considerably more complex, but this simple example is all I need to get
> started.

Do you need to do anything more sophisticated in the actual application than
transfer files? If not, then you may want to look at cURL binding that provides
a much simpler API for file transfers but uses libssh2 to perform the actual
sftp transfer.

Dan
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Sun Jan 17 17:58:54 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10HGweDk020555;
	Sun, 17 Jan 2021 17:58:50 +0100
Received: from server.springtimesoftware.com (server.springtimesoftware.com
 [162.254.253.20])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10HGwcSd020527
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Sun, 17 Jan 2021 17:58:38 +0100
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=springtimesoftware.com; s=default; h=Content-Transfer-Encoding:Content-Type
 :In-Reply-To:MIME-Version:Date:Message-ID:From:References:To:Subject:Sender:
 Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:
 Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:
 List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Wu53Gy5i0zBhSYWeSgmYieQ2rDr9jhwrFoqZ7VC0YMc=; b=UllI4JTjizw6ET7f3U+mRpwhHU
 ulo+WzIIZgX84Gsj99IbG1iC89KG8oBThLSnkAUQZPkyOazbEjFowkA0Vgix5zKRfXCulTsMhmlnK
 k5uV9KM89c2QBvwrUCLB5Av0U0nAvUqtX1MLsox/0MbWG5Zuou0KrOI6OCuLVLQMFGoR+I8kfFxYj
 ckKbW5/y4Yq1sCBR6oifOZJIPYO+WPniXYXUh7U3A9PchPRDsy7Xn5ekOLvJeYCZ9u9N+J4F46l4G
 RkrlTvj8j3IskatwhRISC5yy+pnssQjjWXOWhOUQ0oq2f8pcW+TlhStPJXH1Q8icmRl40zjsQ0h9i
 Vcc9+jAw==;
Received: from [98.2.238.89] (port=2923 helo=[192.168.2.7])
 by server.springtimesoftware.com with esmtpsa (TLS1.2) tls
 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93)
 (envelope-from <dev@springtimesoftware.com>) id 1l1BNp-0006JE-W0
 for libssh2-devel@cool.haxx.se; Sun, 17 Jan 2021 11:58:34 -0500
Subject: Re: Request for help for beginner, thanks!
To: libssh2-devel@cool.haxx.se
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
From: David Spector <dev@springtimesoftware.com>
Message-ID: <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
Date: Sun, 17 Jan 2021 11:58:31 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
 Thunderbird/78.6.1
MIME-Version: 1.0
In-Reply-To: <20210117161930.GB4800@coneharvesters.com>
Content-Language: en-US
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - server.springtimesoftware.com
X-AntiAbuse: Original Domain - cool.haxx.se
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - springtimesoftware.com
X-Get-Message-Sender-Via: server.springtimesoftware.com: authenticated_id:
 fwd@springtimesoftware.com
X-Authenticated-Sender: server.springtimesoftware.com: fwd@springtimesoftware.com
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10HGweDk020555

Dan Fandrich, Thanks for the helpful reply.

I will be maintaining a simple local database (possibly as zero-length 
file directory entries) representing when each website page was last 
built, as a cache. Then, when a build of a website is requested, my 
program will use the database to find which files actually have to be 
rebuilt and uploaded to the production server. All this processing is 
done in PHP, so it seemed natural to use sFTP in PHP to do the uploading 
of the 0 or more files that need to be uploaded (see the simplicity of 
my sample insecure program above).

Can a cURL command be executed by a PHP program to accomplish the uploading?

I'm willing to use cURL, Windows sftp, PHP ssh2 commands, or even the 
rather large PHP library called phpseclib if I have no other choice.

I just want to upload files from PHP using a private RSA key for 
security. I intend to disable old-fashioned and insecure FTP on my 
production server soon, so sFTP will be a must in all my PHP website 
management programs in the future.

David
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Sun Jan 17 19:19:08 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10HIIh9e009037;
	Sun, 17 Jan 2021 19:19:00 +0100
Received: from fern.telarity.com (fern.telarity.com
 [IPv6:2605:2100:0:1:0:0:18b0:aedc])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10HIIemr009029
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Sun, 17 Jan 2021 19:18:41 +0100
Received: from colibri.localdomain (unknown [207.194.131.21])
 (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by fern.telarity.com (Postfix) with ESMTPSA id 7B9FA383258
 for <libssh2-devel@cool.haxx.se>; Sun, 17 Jan 2021 13:18:41 -0500 (EST)
Received: by colibri.localdomain (Postfix, from userid 501)
 id BA1705F817; Sun, 17 Jan 2021 10:18:39 -0800 (PST)
Date: Sun, 17 Jan 2021 10:18:39 -0800
From: Dan Fandrich <dan@coneharvesters.com>
To: libssh2-devel@cool.haxx.se
Subject: Re: Request for help for beginner, thanks!
Message-ID: <20210117181839.GA14749@coneharvesters.com>
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
 <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
User-Agent: Mutt/1.11.4 (2019-03-13)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10HIIh9e009037

On Sun, Jan 17, 2021 at 11:58:31AM -0500, David Spector wrote:
> I will be maintaining a simple local database (possibly as zero-length file
> directory entries) representing when each website page was last built, as a
> cache. Then, when a build of a website is requested, my program will use the
> database to find which files actually have to be rebuilt and uploaded to the
> production server. All this processing is done in PHP, so it seemed natural
> to use sFTP in PHP to do the uploading of the 0 or more files that need to
> be uploaded (see the simplicity of my sample insecure program above).
> 
> Can a cURL command be executed by a PHP program to accomplish the uploading?

I'm not familiar with the PHP binding to libcurl, but I gather it is pretty
complete. A quick search let me to this page with some sample code:
https://stackoverflow.com/questions/18180564/how-to-upload-file-with-curl-on-sftp-server
so it definitely looks possible.

Dan
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Sun Jan 17 19:40:25 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10HIeAwS014879;
	Sun, 17 Jan 2021 19:40:22 +0100
Received: from server.springtimesoftware.com (server.springtimesoftware.com
 [162.254.253.20])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10HIe8ci014750
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Sun, 17 Jan 2021 19:40:09 +0100
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=springtimesoftware.com; s=default; h=Content-Transfer-Encoding:Content-Type
 :In-Reply-To:MIME-Version:Date:Message-ID:References:To:Subject:From:Sender:
 Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:
 Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:
 List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=nWF4kN1po6sQri7SL7/bf14D//VO76SXXG0sTVU/iDk=; b=IFGwlsiXEC4hVh1BDxbjIVmvnz
 wEYA9YwFQE4gWasZtSyTzMEK9Qbeefcd+tqYvcvsNSy+Fuo0UDH2F6EtBgzbQx8QOAWAP8Z2h9EkY
 CGY6q3Cog3lw4vH3s4+hmGImQzMWXgdL70uFVXl6b1HKPqn6IXVFc8mwmE+EraOssgO9Jh9lNTVaR
 j9A+DtypEpwaY/FmT4NzbyxfQCtTNOdaX/u+5+u05JGYH8DxQAdbe14M3f+LWkbCEn/Jy741fXlmj
 owmyDMMkqbnkL0QxWwVsiQQvUDO5JOlAoxHtUySfcCYIHt+qmIyAKxXI9RgdN37YZRdSG4eqdPeqp
 SoDVfl6w==;
Received: from [98.2.238.89] (port=2858 helo=[192.168.2.7])
 by server.springtimesoftware.com with esmtpsa (TLS1.2) tls
 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93)
 (envelope-from <dev@springtimesoftware.com>) id 1l1Cy4-0007Ed-TP
 for libssh2-devel@cool.haxx.se; Sun, 17 Jan 2021 13:40:04 -0500
From: David Spector <dev@springtimesoftware.com>
Subject: Re: Request for help for beginner, thanks!
To: libssh2-devel@cool.haxx.se
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
 <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
 <20210117181839.GA14749@coneharvesters.com>
Message-ID: <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
Date: Sun, 17 Jan 2021 13:40:04 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
 Thunderbird/78.6.1
MIME-Version: 1.0
In-Reply-To: <20210117181839.GA14749@coneharvesters.com>
Content-Language: en-US
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - server.springtimesoftware.com
X-AntiAbuse: Original Domain - cool.haxx.se
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - springtimesoftware.com
X-Get-Message-Sender-Via: server.springtimesoftware.com: authenticated_id:
 fwd@springtimesoftware.com
X-Authenticated-Sender: server.springtimesoftware.com: fwd@springtimesoftware.com
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10HIeAwS014879

Dear Dan,

Thanks for the suggestion. I appreciate the time you have spent on this.

As a beginner in this area, this code is not understandable. That is why 
I asked for a working example (did I remember to say the example had to 
be tested and work? I tested my code and it works.).

I see lots of code here, but nothing that includes the pathname of a 
private key, and nothing that actually works. sFTP requires a private 
key to be meaningful, to the best of my knowledge.

I mean, the whole point is to secure the file transfer between my 
development computer and my production server. With sFTP one does that 
using a public key remotely and a private key locally. I already have 
the keys installed and they work with both coreFTP and PuTTY.

Now all I need is for someone who has done this task successfully to 
share with me a minimal working piece of PHP code. I've already spent 
weeks on this and I can't spare more time for research or trial and 
error, which is why I am posting here.

I'm looking for someone who has done this task (hopefully in PHP ssh2) 
and is willing to share some simple code to get it done.

Yes, I can believe it can be done using cURL, ssh2, etc., but I just 
need to get some working code. It seems that nobody has any complete and 
working code posted on the Web anywhere, including in the PHP Manual itself.

David
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Sun Jan 17 20:21:53 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10HJLTIc024057;
	Sun, 17 Jan 2021 20:21:47 +0100
Received: from st43p00im-zteg10073501.me.com (st43p00im-zteg10073501.me.com
 [17.58.63.180])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10HJLRPv024031
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Sun, 17 Jan 2021 20:21:28 +0100
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=1a1hai;
 t=1610911282; bh=fiFDEGGTL0XIHzgpPJ5U+QVmlcROjB2bHAY7WLrNPXM=;
 h=From:Content-Type:Mime-Version:Subject:Date:To:Message-Id;
 b=ctPWXDx9scq37rTCbAYxkcIIRWELCcjs/iDh47ZRqSlP5ehOrGzE3sAgBvwxgOOsz
 b1xYTe6cAi2pjf6feNNijxK2k3o+TpzpmyxAfBwnQNILz4LJ+nsp/TGe+UT6wA2Lo6
 o3bDA3hWYw4o+5JCu7kuNG7tT3uLhlRVkq0tmbrACE/EwMgtuagaCCKI3F65b7smqY
 T4MIE7Jmec4QDZT7IiGOJimJgWuaA0KuX6SH9kwsXkF8SQNDrSxT7hhzJrCPkLtvCh
 9izNTb8L48E932KEr4ohLIDO7Gi9g8HsUxFPwn18v+GdFW3KezXhUHZhWxbgHINX5Q
 j1vWGnZuKA17w==
Received: from [172.16.52.2] (unknown [168.91.222.208])
 by st43p00im-zteg10073501.me.com (Postfix) with ESMTPSA id 81822AE06F8
 for <libssh2-devel@cool.haxx.se>; Sun, 17 Jan 2021 19:21:22 +0000 (UTC)
From: Craig Berry <craigberry@mac.com>
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\))
Subject: Re: Request for help for beginner, thanks!
Date: Sun, 17 Jan 2021 13:21:21 -0600
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
 <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
 <20210117181839.GA14749@coneharvesters.com>
 <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
In-Reply-To: <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
Message-Id: <E3C207EC-77F4-4092-92BA-7D2AB35F10FB@mac.com>
X-Mailer: Apple Mail (2.3608.120.23.2.4)
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737
 definitions=2021-01-17_12:2021-01-15,
 2021-01-17 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0
 mlxlogscore=643 adultscore=0 classifier=spam adjust=0 reason=mlx
 scancount=1 engine=8.0.1-2006250000 definitions=main-2101170121
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id
 10HJLRPv024031
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10HJLTIc024057


> On Jan 17, 2021, at 12:40 PM, David Spector <dev@springtimesoftware.com> wrote:
>  It seems that nobody has any complete and working code posted on the Web anywhere, including in the PHP Manual itself.

I have never used PHP and know nothing about the libssh2 binding for it, but a quick web search shows lots of examples and documentation of people doing sftp with PHP.  E.g.,

<https://www.php.net/manual/en/function.ssh2-sftp.php>

which appears to be using libssh2 under the hood with a PHP extension built on top of it (<https://www.php.net/manual/en/install.pecl.windows.php>).

or this one:

<https://phpseclib.com/docs/sftp>

which appears to be a pure PHP library.

Search for the word "key" on those pages and you will see examples of uploads that use a key instead of a password.

________________________________________
Craig A. Berry

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser


_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Sun Jan 17 21:08:41 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10HK8NUw002629;
	Sun, 17 Jan 2021 21:08:36 +0100
Received: from server.springtimesoftware.com (server.springtimesoftware.com
 [162.254.253.20])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10HK8KJv002608
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Sun, 17 Jan 2021 21:08:21 +0100
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=springtimesoftware.com; s=default; h=Content-Transfer-Encoding:Content-Type
 :In-Reply-To:MIME-Version:Date:Message-ID:From:References:To:Subject:Sender:
 Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:
 Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:
 List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=UdPijtmkrq7+cUv3gf6elMUM/eOfmtGQsxy65Cd3kGs=; b=WtRco4uhKfA/v3jGHoEsuC/WgA
 jN6z47KJFylgyzDktCNPtBn/83Fc8QpSNixSd06qcAcb3RkXKoK0qb9qALM3WbCgDRJVH5Pe41Q6C
 7/skasTCBE5VYbGgO9RmSRaA4ZvbHD1giz8nuoV9JqEte/HHJefDQApLIOYb9UqUuhm4qVRJq3Rb7
 kQAo8n16lhzTm8dkyKt7Rxo8Jf/5IjI9cvacsb3r7nwkcN1iV3sYIXB9qxTqLGOVBxn3uCXapx57p
 KPDiGcGA1uLffLaKdtFuh0AXeVXU9A5eFJ7wh+0qJ5wFMPlX2ehHcJpCAMjSm0NmAUcCdc+NZlsX/
 FGNleGTA==;
Received: from [98.2.238.89] (port=2803 helo=[192.168.2.7])
 by server.springtimesoftware.com with esmtpsa (TLS1.2) tls
 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93)
 (envelope-from <dev@springtimesoftware.com>) id 1l1ELQ-00084G-UJ
 for libssh2-devel@cool.haxx.se; Sun, 17 Jan 2021 15:08:16 -0500
Subject: Re: Request for help for beginner, thanks!
To: libssh2-devel@cool.haxx.se
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
 <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
 <20210117181839.GA14749@coneharvesters.com>
 <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
 <E3C207EC-77F4-4092-92BA-7D2AB35F10FB@mac.com>
From: David Spector <dev@springtimesoftware.com>
Message-ID: <efd08601-0ef2-7aed-4594-adf779bb4b6b@springtimesoftware.com>
Date: Sun, 17 Jan 2021 15:08:16 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
 Thunderbird/78.6.1
MIME-Version: 1.0
In-Reply-To: <E3C207EC-77F4-4092-92BA-7D2AB35F10FB@mac.com>
Content-Language: en-US
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - server.springtimesoftware.com
X-AntiAbuse: Original Domain - cool.haxx.se
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - springtimesoftware.com
X-Get-Message-Sender-Via: server.springtimesoftware.com: authenticated_id:
 fwd@springtimesoftware.com
X-Authenticated-Sender: server.springtimesoftware.com: fwd@springtimesoftware.com
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10HK8NUw002629

Dear Craig,

Thank you for these ideas, and for the time you spent repeating some of 
my research. Perhaps I should have given a detailed history of my 
previous work on this issue, sorry.

I have already tried getting the PHP Manual examples working, and 
failed. I don't want to post my code and get into a joint debug session, 
as I'm now mostly busy with other stuff.

As for phpseclib, I already mentioned that I would rather not use it. It 
is awkward to use and requires a great deal of code that is unnecessary 
for simply uploading a file. I've already communicated with the author, 
and it would not be easy for him or me to make that library code 
significantly smaller. In contrast, the ssh2 lib is a Windows DLL, and I 
have already downloaded it and changed my PHP.ini to load it.

I would like to emphasize that while I do appreciate ideas, I would much 
rather have a working and complete example in PHP from someone who has 
already accomplished this task, as I have been asking for all along, 
rather than ideas and links which repeat the research I have already done.

I don't mind waiting for working code, having spent so many days working 
on this on my own and needing to work on other stuff.

Let's see if someone on this mailing list has ever written PHP code to 
upload a file using sFTP. I will keep my fingers crossed...

David
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon Jan 18 01:38:05 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10I0bYpq005249;
	Mon, 18 Jan 2021 01:37:55 +0100
Received: from vps1.hno.se (vps1.hno.se [31.192.227.87])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10I0bWPH005244
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 18 Jan 2021 01:37:33 +0100
Received: from home.hno.se (tunnel398220-pt.tunnel.tserv26.ber1.ipv6.he.net
 [IPv6:2001:470:6c:63b::2]) (authenticated bits=128)
 by vps1.hno.se (8.14.4/8.14.4) with ESMTP id 10I0aVhR014715
 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=NO)
 for <libssh2-devel@cool.haxx.se>; Mon, 18 Jan 2021 01:36:34 +0100
Received: from henrik@home.hno.se ([127.0.0.1]) (authenticated bits=0)
 by home.hno.se (8.15.2/8.15.2) with ESMTPSA id 10I0aRnM1475722
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 18 Jan 2021 01:36:28 +0100
Message-ID: <3b733b5301399244da429273efacdfae0b334c26.camel@henriknordstrom.net>
Subject: Re: Request for help for beginner, thanks!
From: Henrik =?ISO-8859-1?Q?Nordstr=F6m?= <henrik@henriknordstrom.net>
To: libssh2 development <libssh2-devel@cool.haxx.se>
Date: Mon, 18 Jan 2021 01:36:27 +0100
In-Reply-To: <efd08601-0ef2-7aed-4594-adf779bb4b6b@springtimesoftware.com>
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
 <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
 <20210117181839.GA14749@coneharvesters.com>
 <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
 <E3C207EC-77F4-4092-92BA-7D2AB35F10FB@mac.com>
 <efd08601-0ef2-7aed-4594-adf779bb4b6b@springtimesoftware.com>
User-Agent: Evolution 3.38.3 (3.38.3-1.fc33) 
MIME-Version: 1.0
X-Spam-Status: No, score=0.3 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DATE_IN_FUTURE_12_24 autolearn=no autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on home.hno.se
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10I0bYpq005249

sön 2021-01-17 klockan 15:08 -0500 skrev David Spector:
> 
> I don't mind waiting for working code, having spent so many days
> working on this on my own and needing to work on other stuff.
> 
> Let's see if someone on this mailing list has ever written PHP code
> to upload a file using sFTP. I will keep my fingers crossed...

The PHP ssh2 module referenced earlier does work.

https://www.php.net/manual/en/function.ssh2-sftp.php

And if you read the comments you also have a nice wrapper class and
supplementary methods for public key auth and file upload that
demonstrates it's usage, but even without that is't not complicated to
use. Read all the comments if using the class as there is some
important suggestions and caevats that you may need to account for,
mainly the importance of understanding the meaning of the remote path
argument.

What error do you run into?

Also, don't forget to secure the stored login credentials
appropriately, and preferably restrict them on the sftp server to only
allow sftp and only to the desired folders. But that's outside of
libssh2.

And be warned that many SSH servers do not support the old ssh-rsa
authentication method today due to demonstrated SHA1 weakness, and
libssh2 defaults to use ssh-rsa if given an RSA key. Not sure if it is
possible to tell libssh to use the  rsa-sha2-256 authentication method
instead (uses same key format, different authentication method). Use of
an ecdsa key avoids this hurdle.

Regards
Henrik

_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon Jan 18 17:45:34 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10IGj08i015805;
	Mon, 18 Jan 2021 17:45:25 +0100
Received: from fern.telarity.com (fern.telarity.com
 [IPv6:2605:2100:0:1:0:0:18b0:aedc])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10IGivb7015795
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 18 Jan 2021 17:44:58 +0100
Received: from colibri.localdomain (unknown [207.34.169.245])
 (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by fern.telarity.com (Postfix) with ESMTPSA id C6F78383258
 for <libssh2-devel@cool.haxx.se>; Mon, 18 Jan 2021 11:44:56 -0500 (EST)
Received: by colibri.localdomain (Postfix, from userid 501)
 id 0EEC85F823; Mon, 18 Jan 2021 08:44:55 -0800 (PST)
Date: Mon, 18 Jan 2021 08:44:55 -0800
From: Dan Fandrich <dan@coneharvesters.com>
To: libssh2-devel@cool.haxx.se
Subject: Re: Request for help for beginner, thanks!
Message-ID: <20210118164454.GA9597@coneharvesters.com>
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
 <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
 <20210117181839.GA14749@coneharvesters.com>
 <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
User-Agent: Mutt/1.11.4 (2019-03-13)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10IGj08i015805

On Sun, Jan 17, 2021 at 01:40:04PM -0500, David Spector wrote:
> Thanks for the suggestion. I appreciate the time you have spent on this.
> 
> As a beginner in this area, this code is not understandable. That is why I
> asked for a working example (did I remember to say the example had to be
> tested and work? I tested my code and it works.).

If you're asking for a working example of a solution to your problem that is
tested and working, then your best bet is to hire someone to create one for
you. Open Source software includes documentation and examples so that
programmers can create such examples on their own. It's not possible to scale
free support to everybody who might use the free software otherwise.

> I see lots of code here, but nothing that includes the pathname of a private
> key, and nothing that actually works. sFTP requires a private key to be
> meaningful, to the best of my knowledge.

The documentation describes how to do this. In this case, you're probably
looking for CURLOPT_SSH_PRIVATE_KEYFILE in the libcurl C binding. But, further
questions on curl should be sent to either the libcurl mailing list or the
appropriate PHP cURL support forum, as appropriate.

> I mean, the whole point is to secure the file transfer between my
> development computer and my production server. With sFTP one does that using
> a public key remotely and a private key locally. I already have the keys
> installed and they work with both coreFTP and PuTTY.
> 
> Now all I need is for someone who has done this task successfully to share
> with me a minimal working piece of PHP code. I've already spent weeks on
> this and I can't spare more time for research or trial and error, which is
> why I am posting here.
> 
> I'm looking for someone who has done this task (hopefully in PHP ssh2) and
> is willing to share some simple code to get it done.
> 
> Yes, I can believe it can be done using cURL, ssh2, etc., but I just need to
> get some working code. It seems that nobody has any complete and working
> code posted on the Web anywhere, including in the PHP Manual itself.

It's a pretty big demand to ask people to write your code for free.  There are
many examples of use of sftp in libssh2 and libcurl available to you with a
search and lots of documentation to help you customize them for your exact
purposes. Try getting one of the example programs working in a simplified case
then only then alter it.  If the documentation is inadequate or wrong, then
we'd be interested in hearing how to improve it.

Dan
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon Jan 18 20:13:50 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10IJDNsu013857;
	Mon, 18 Jan 2021 20:13:43 +0100
Received: from server.springtimesoftware.com (server.springtimesoftware.com
 [162.254.253.20])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10IJDKN1013836
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 18 Jan 2021 20:13:21 +0100
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=springtimesoftware.com; s=default; h=Content-Transfer-Encoding:Content-Type
 :In-Reply-To:MIME-Version:Date:Message-ID:From:References:To:Subject:Sender:
 Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:
 Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:
 List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Vz8IdJD8TH/6ikKndh4onCGfDAAirTCWwRn1GuaELDw=; b=xOBfC/Jvdh6+9hV1b5KfntF57P
 qXy9NeISx/uuMGl8GOAALWetYgAB1fQ3KQNOtNJbAU+yjYNEyd3jQj7RJzGILjpiwhqIaDO8sC9SI
 iZRrRyd5XsG835ziSE6WMIbORCwNTHIksxDOFFk19SO+u/E0Migvs2cn8UxFomnWiYO9l0cDqf8MN
 eG9xYcThzaCtzqXYxhiQGDaYQtbnw4zjBnJplbiQAejjKJn4QC3neHDbLzBwXRTf6m2cxE23WALPE
 tCbvddWCwJfABngDrO3JwRZN+4GhFO/LhaUQxIe1554NxRzzRu9n5MVjojCktJrz8y42La0s08rLz
 oJaPDCuA==;
Received: from [98.2.238.89] (port=2831 helo=[192.168.2.7])
 by server.springtimesoftware.com with esmtpsa (TLS1.2) tls
 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93)
 (envelope-from <dev@springtimesoftware.com>) id 1l1Zxk-0002Jj-HR
 for libssh2-devel@cool.haxx.se; Mon, 18 Jan 2021 14:13:16 -0500
Subject: Re: Request for help for beginner, thanks!
To: libssh2-devel@cool.haxx.se
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
 <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
 <20210117181839.GA14749@coneharvesters.com>
 <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
 <20210118164454.GA9597@coneharvesters.com>
From: David Spector <dev@springtimesoftware.com>
Message-ID: <50f811dd-e27f-4e7d-10b9-fcc82a689079@springtimesoftware.com>
Date: Mon, 18 Jan 2021 14:13:15 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
 Thunderbird/78.6.1
MIME-Version: 1.0
In-Reply-To: <20210118164454.GA9597@coneharvesters.com>
Content-Language: en-US
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - server.springtimesoftware.com
X-AntiAbuse: Original Domain - cool.haxx.se
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - springtimesoftware.com
X-Get-Message-Sender-Via: server.springtimesoftware.com: authenticated_id:
 fwd@springtimesoftware.com
X-Authenticated-Sender: server.springtimesoftware.com: fwd@springtimesoftware.com
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10IJDNsu013857

Dear Dan,

Thank you for taking the time to share your opinions. They certainly 
differ from mine, and deserve a thoughtful response.

"Try getting one of the example programs working in a simplified case 
then only then alter it."

That is EXACTLY what I tried to do in my last posting! I took the 
existing example and tried to use it, unaltered. It did not work.

I'm not asking others to help me debug my code (which is actually valid, 
too). I'm asking (again and again) for a working example that uploads a 
file using a private key, nothing else. I am fully capable of modifying 
it myself once I have it.

"If you're asking for a working example of a solution to your problem 
that is tested and working, then your best bet is to hire someone to 
create one for you."

The PHP Manual contains full and working examples of almost all 
functions and, where relevant, categories of functions. Any competent 
programmer is able to use a programming language manual like this one to 
create programs themselves, without having to hire other programmers. 
This includes beginning programmers (in my case I have been programming 
professionally since 1965, but I consider myself a beginner in 
understanding the ssh2 library because of its poor documentation; I will 
say more about this below, since you brought up the question of the 
quality of the documentation).

If a beginner asked you how to delete an array element, I expect you 
would have the solution at your mental fingertips and simply reply with 
the answer (which is: call 'unset' on the element reference, like this: 
"unset($Arr['apple']);"). In this case, because of its familiarity and 
good documentation, you would likely not even bother testing it (as 
indeed I did not).

Why, then, are you so emphatic in stating, twice, that I must hire 
another programmer to use the ssh2 functions? I believe the answer is 
that you are extremely defensive, probably because you are personally 
responsible for much of that code and believe that you have also 
documented the library fully. Somehow you have construed my innocent and 
somewhat desperate question as an attack on your baby.

Accordingly, you will find this, my response, equally defensive.

While being defensive against perceived attack is psychologically 
understandable, it is not a stance anyone should take in public as a 
computer professional, the main reason being that it shows a remarkable 
disinterest with helping a fellow programmer and a human being who has 
asked for help.

I would be quite ashamed if I ever replied this way in a public forum.

Better to say nothing than to insult someone who has asked so sincerely 
for help, and has followed up each reply as conscientiously as I have.

You could have chosen to say nothing rather than to insult me in this 
indirect and uncivil way.

I presented in my question a tested and working PHP solution for 
uploading a file insecurely, which only slightly expands upon the 
example given in the PHP Manual. This example worked the first time I 
tried it, because like most PHP Manual examples, it was complete and 
tested. I have used this FTP code in several PHP programs.

Working the first time was not the case with the ssh2 library, whose 
basic example did not work for me either time I tried it. Does it work 
for anyone else here? I don't know, because probably no one has actually 
tried it.

Has anyone in the world succeeded in uploading a file using ssh2? I'm 
beginning to think not. Else why would it take so many days to find a 
working example?

All I am asking is for the same example as FTP but that works securely, 
using sFTP. Am I not being reasonable? If not, why not?

I have found this library to have been documented at an inferior level 
to other libraries and function categories, mainly in that its primary 
example does not work, and that there is no clear and working example of 
using sFTP with a private key, and also because of its use of unclear 
jargon in many function descriptions (example: the words "key" and 
"password" actually can apply to two or more different parameters of the 
sFTP protocol; the documentation uses them ambiguously).

The author of the open source library phpseclib told me via email that 
difficulty in getting ssh2 to work was his own motivation to create the 
very large but working phpseclib library. Wow.

You may complain that ssh2 is an obscure area of PHP, and doesn't need 
to be documented well, or perhaps even to work. If so, my response would 
be: nonsense. It is FTP that deserves to be obscure, because in fact FTP 
is insecure because it depends on just a user's password. Modern file 
transfers need sFTP and other secure protocols as a basic element of any 
general programming toolbox.

If it is indeed true, as you seem to be implying, that neither you nor 
anyone else on this mailing list has written simple code to upload a 
file, I am astounded. How is it possible to implement an entire security 
library, claiming to implement sFTP as a substitute for FTP, yet never 
to have written simple and working code that uses it? For, if you had, 
you could simply find that working code on your computer and share it 
with me instead of attacking me and/or the nature of my question.

Did the ssh2 library really get released without a thorough test suite 
that includes uploading a file? Horrors.

I have done a lot of research looking for such simple PHP sFTP code as I 
am requesting and have not found it on the Web. If it is so easy to find 
as you claim, why has no one been able to find it in the past few weeks 
that I have been posting on two Web fora asking for help, including 
Experts Exchange? None of the advice and links I have received so far 
have answered my simple need; many have not even been in the ball park.

I am not asking for anyone to design an entire program for me. I'm only 
asking (again and again and again) for a simple working example of sFTP 
code using functions that are documented in the PHP Manual (working 
means the PHP output is included and the file was indeed uploaded).

I think the world deserves such an example because it is basic and so 
many people need it, and if I ever find it I will most certainly add it 
to the PHP Manual as well as posting it in public fora to help all the 
others who have been repeatedly denied by well-meaning but 
self-appointed guardians of the holy gates of knowledge (we don't guard 
array operations; why do we guard the ssh2 library so zealously?).

Using sFTP in PHP should not be guarded as a holy secret. It should be 
shared freely, like the rest of the basics of programming.

Surely you don't believe that modern cryptographic methods should be 
kept secret because you believe that secrecy enhances their 
cryptographic security? I hope not, because it is a cornerstone of 
modern cryptography that its methods be made fully public.

And, finally, if the ssh2 library cannot actually upload a file using a 
private key, which I am beginning to suspect, this important fact should 
simply be admitted and documented. Then we can turn to cURL, phpseclib, 
or other solutions instead of banging our head against the wall with the 
PHP ssh2 library.

David Spector
Springtime Software
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon Jan 18 20:51:02 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10IJom42022660;
	Mon, 18 Jan 2021 20:50:59 +0100
Received: from foo.stuge.se (foo.stuge.se [212.116.89.98])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10IJo27R022170
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 18 Jan 2021 20:50:02 +0100
Received: (qmail 17837 invoked by uid 1000); 18 Jan 2021 19:49:55 -0000
Message-ID: <20210118194955.17836.qmail@stuge.se>
Date: Mon, 18 Jan 2021 19:49:55 +0000
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: Request for help for beginner, thanks!
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
 <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
 <20210117181839.GA14749@coneharvesters.com>
 <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
 <20210118164454.GA9597@coneharvesters.com>
 <50f811dd-e27f-4e7d-10b9-fcc82a689079@springtimesoftware.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <50f811dd-e27f-4e7d-10b9-fcc82a689079@springtimesoftware.com>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10IJom42022660

David,

David Spector wrote:
> You may complain that ssh2 is an obscure area of PHP

Please be aware that the community on this mailing list is the author
of the libssh2 library which is written in the C programming language,
documented okay-to-well using the method common for unix-y C libraries
(man pages) and is intended for use by other C programs.

libssh2 (this our project here) includes various examples, also written
in C, some demonstrate a few SFTP uses, including upload, and other
demonstrate the different authentication methods.

libssh2 does support all authentication methods of the SSH v2 protocol.

To learn more about the SSH protocol architecture I can really
recommend looking at RFC 4251 which is quite readable:

https://tools.ietf.org/html/rfc4251

SFTP is a so-called subsystem within the SSH architecture.

(This is not to be confused with the traditional FTP protocol secured
with SSL or TLS.)


As far as I know, the ssh2 PHP extension is not developed by anyone
in this community/on this mailing list.

It is however true that libssh2 was initially created to serve as the
foundation for the PHP ssh2 extension.

I honestly don't know who (if anyone?) maintains the PHP ssh2 extension.

If I've understood history correctly then the PHP ssh2 extension was
created by a single party primarily for their internal use, which could
explain why it would have terse documentation.


The cURL project was mentioned - that's actually also primarily a C library
named libcurl, although it happens to come with a very handy command line
utility to exercise the library.

The PHP curl extension uses libcurl directly.

libcurl supports, among other protocols, SFTP.

libcurl happens to use libssh2 to realise SFTP file transfers. :)
Also, the primary maintainer of libcurl is currently also head of libssh2.

libcurl is quite popular and can be simpler to use than libssh2 in C,
especially for SFTP, so the recommendation to use libcurl makes a lot of
sense for a C program.


Taking a quick look at the PHP ssh2 SFTP support it looks like that's
less important in PHP.

There is a very simple example of uploading a file using SFTP in PHP
through the ssh2 extension here:

https://www.php.net/manual/en/function.ssh2-sftp.php

Following the example, the first user comment includes a class wrapper.

This comment further down shows what is needed for publickey authentication
(by extending the wrapper class, but you can obviously just substitute
ssh2_auth_password() for ssh2_auth_pubkey_file() yourself in the example):

https://www.php.net/manual/en/function.ssh2-sftp.php#123878

You'll obviously have to change 'r' to 'w' in the fopen call to write files
to your SFTP server instead of read.


> (example: the words "key" and "password" actually can apply to two or
> more different parameters of the sFTP protocol; the documentation uses
> them ambiguously).

Hm - which two different parameters do you mean? Maybe there is some
confusion here.

If you have improvements for the PHP ssh2 extension documentation I'm sure
that the PHP project will be happy to accept them, as we are if you want to
contribute improvements to the libssh2 C library documentation.


Hope this helps

//Peter
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon Jan 18 21:05:53 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10IK5j7F026122;
	Mon, 18 Jan 2021 21:05:50 +0100
Received: from foo.stuge.se (foo.stuge.se [212.116.89.98])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10IK5hfg026105
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 18 Jan 2021 21:05:43 +0100
Received: (qmail 17974 invoked by uid 1000); 18 Jan 2021 20:05:39 -0000
Message-ID: <20210118200539.17973.qmail@stuge.se>
Date: Mon, 18 Jan 2021 20:05:39 +0000
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: Request for help for beginner, thanks!
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
 <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
 <20210117181839.GA14749@coneharvesters.com>
 <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
 <20210118164454.GA9597@coneharvesters.com>
 <50f811dd-e27f-4e7d-10b9-fcc82a689079@springtimesoftware.com>
 <20210118194955.17836.qmail@stuge.se>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <20210118194955.17836.qmail@stuge.se>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10IK5j7F026122

Peter Stuge wrote:
> There is a very simple example of uploading a file using SFTP in PHP
> through the ssh2 extension here:
> 
> https://www.php.net/manual/en/function.ssh2-sftp.php
> 
> Following the example, the first user comment includes a class wrapper.
> 
> This comment further down shows what is needed for publickey authentication
> (by extending the wrapper class, but you can obviously just substitute
> ssh2_auth_password() for ssh2_auth_pubkey_file() yourself in the example):
> 
> https://www.php.net/manual/en/function.ssh2-sftp.php#123878
> 
> You'll obviously have to change 'r' to 'w' in the fopen call to write files
> to your SFTP server instead of read.

Taking another look in the PHP ssh2 documentation I found this user note
with yet another, but simple, class wrapper, which shows in particular how
to verify the server identity, which you should always do in order to avoid
falling victim to a man-in-the-middle attack:

https://www.php.net/manual/en/function.ssh2-connect.php#104758

However, that comment/code is 9 years old and by now MD5 is not a good
choice, so I'd certainly advise SSH2_FINGERPRINT_SHA1 instead, and preferably
something more modern still - but I don't know if the PHP ssh2 extension makes
anything else available - it doesn't look like it - that could well be an
argument for exploring the PHP curl extension after all.


//Peter
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon Jan 18 23:15:28 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10IMF2us022503;
	Mon, 18 Jan 2021 23:15:21 +0100
Received: from server.springtimesoftware.com (server.springtimesoftware.com
 [162.254.253.20])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10IMExTk022224
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 18 Jan 2021 23:15:00 +0100
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=springtimesoftware.com; s=default; h=Content-Transfer-Encoding:Content-Type
 :In-Reply-To:MIME-Version:Date:Message-ID:From:References:To:Subject:Sender:
 Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:
 Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:
 List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=uNhiGawGL+omssH471Dz3XwWBd7RxB1uYNI/AmWkOn4=; b=Ce7CjGuIFZFFjB7oTxwGeWWyRM
 163FYvYUCn1XPLsgddzmFj7FLQZQIJjqTUGTh9yCAn9wKnAfR8iNnHYHs97mIvHyn5Rbj+xMRYdSc
 4M3HNZt/VrJgV9coxQ3Nrj2ngGPtRd/Pv7Y7CJ9v5MQ5z9Xx/cNiVKkc+5Iitm86HZlEozjcRXzEc
 7BiUlUQ+Te9voUsg5EBujzhDhcakR8yU3nUp/qA2EQOyafUC0iJU5uxwrtfHB/cvLp5jEn+mTJPQM
 qSNJF4iunc36LLmWYPJxqKO27+BCvWrDUEz1vSc9nie1OLWA6imWoHAa+A2NtWqNmjLRs2WhHm1RF
 ijmmMggA==;
Received: from [98.2.238.89] (port=2888 helo=[192.168.2.7])
 by server.springtimesoftware.com with esmtpsa (TLS1.2) tls
 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93)
 (envelope-from <dev@springtimesoftware.com>) id 1l1cnX-0003qZ-6Q
 for libssh2-devel@cool.haxx.se; Mon, 18 Jan 2021 17:14:55 -0500
Subject: Re: Request for help for beginner, thanks!
To: libssh2-devel@cool.haxx.se
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
 <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
 <20210117181839.GA14749@coneharvesters.com>
 <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
 <20210118164454.GA9597@coneharvesters.com>
 <50f811dd-e27f-4e7d-10b9-fcc82a689079@springtimesoftware.com>
 <20210118194955.17836.qmail@stuge.se> <20210118200539.17973.qmail@stuge.se>
From: David Spector <dev@springtimesoftware.com>
Message-ID: <0654ee48-c1c9-9dd7-b22d-8e5cbe7bcc52@springtimesoftware.com>
Date: Mon, 18 Jan 2021 17:14:53 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
 Thunderbird/78.6.1
MIME-Version: 1.0
In-Reply-To: <20210118200539.17973.qmail@stuge.se>
Content-Language: en-US
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - server.springtimesoftware.com
X-AntiAbuse: Original Domain - cool.haxx.se
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - springtimesoftware.com
X-Get-Message-Sender-Via: server.springtimesoftware.com: authenticated_id:
 fwd@springtimesoftware.com
X-Authenticated-Sender: server.springtimesoftware.com: fwd@springtimesoftware.com
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10IMF2us022503

Dear Peter,

Thank you for your good information.

I plan to look into your ideas, but there will be a delay since I'm 
fairly busy with other stuff these days.

Meanwhile, if anyone happens to see what I'm looking for, please let me 
know.

David
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon Jan 18 23:47:34 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10IMlHP3030552;
	Mon, 18 Jan 2021 23:47:29 +0100
Received: from foo.stuge.se (foo.stuge.se [212.116.89.98])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10IMlF9N030533
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 18 Jan 2021 23:47:16 +0100
Received: (qmail 19549 invoked by uid 1000); 18 Jan 2021 22:47:11 -0000
Message-ID: <20210118224711.19548.qmail@stuge.se>
Date: Mon, 18 Jan 2021 22:47:11 +0000
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: Request for help for beginner, thanks!
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
 <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
 <20210117181839.GA14749@coneharvesters.com>
 <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
 <20210118164454.GA9597@coneharvesters.com>
 <50f811dd-e27f-4e7d-10b9-fcc82a689079@springtimesoftware.com>
 <20210118194955.17836.qmail@stuge.se>
 <20210118200539.17973.qmail@stuge.se>
 <0654ee48-c1c9-9dd7-b22d-8e5cbe7bcc52@springtimesoftware.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <0654ee48-c1c9-9dd7-b22d-8e5cbe7bcc52@springtimesoftware.com>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10IMlHP3030552

David Spector wrote:
> if anyone happens to see what I'm looking for, please let me know.

Well, I just did. Please do take the time to check those links.


Kind regards

//Peter
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Thu Jan 21 17:52:44 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10LGpMSG023202;
	Thu, 21 Jan 2021 17:52:33 +0100
Received: from fern.telarity.com (fern.telarity.com
 [IPv6:2605:2100:0:1:0:0:18b0:aedc])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10LGpJxu023187
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Thu, 21 Jan 2021 17:51:20 +0100
Received: from colibri.localdomain (unknown [207.194.215.105])
 (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by fern.telarity.com (Postfix) with ESMTPSA id 133BB383258
 for <libssh2-devel@cool.haxx.se>; Thu, 21 Jan 2021 11:51:19 -0500 (EST)
Received: by colibri.localdomain (Postfix, from userid 501)
 id 181625F81E; Thu, 21 Jan 2021 08:51:17 -0800 (PST)
Date: Thu, 21 Jan 2021 08:51:17 -0800
From: Dan Fandrich <dan@coneharvesters.com>
To: libssh2-devel@cool.haxx.se
Subject: Re: Request for help for beginner, thanks!
Message-ID: <20210121165116.GA20291@coneharvesters.com>
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
 <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
 <20210117181839.GA14749@coneharvesters.com>
 <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
 <20210118164454.GA9597@coneharvesters.com>
 <50f811dd-e27f-4e7d-10b9-fcc82a689079@springtimesoftware.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <50f811dd-e27f-4e7d-10b9-fcc82a689079@springtimesoftware.com>
User-Agent: Mutt/1.11.4 (2019-03-13)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10LGpMSG023202

On Mon, Jan 18, 2021 at 02:13:15PM -0500, David Spector wrote:
> Thank you for taking the time to share your opinions. They certainly differ
> from mine, and deserve a thoughtful response.
> 
> "Try getting one of the example programs working in a simplified case then
> only then alter it."
> 
> That is EXACTLY what I tried to do in my last posting! I took the existing
> example and tried to use it, unaltered. It did not work.
> 
> I'm not asking others to help me debug my code (which is actually valid,
> too). I'm asking (again and again) for a working example that uploads a file
> using a private key, nothing else. I am fully capable of modifying it myself
> once I have it.

There's nothing wrong with asking for help, but your request listed nine
highly specific requirements of a result that would be acceptable to you.

> Why, then, are you so emphatic in stating, twice, that I must hire another
> programmer to use the ssh2 functions? I believe the answer is that you are
> extremely defensive, probably because you are personally responsible for
> much of that code and believe that you have also documented the library
> fully. Somehow you have construed my innocent and somewhat desperate
> question as an attack on your baby.

Your message came across to me more as a Request For Quotation than a plea for
help. There are many examples of PHP code using libssh2 and cURL and they
aren't all broken. I, of course, have no idea how much effort you've already
put into this, but I got the impression that you hadn't exhausted reasonable
efforts to help yourself first. And please don't try to tell me what I believe.

> Better to say nothing than to insult someone who has asked so sincerely for
> help, and has followed up each reply as conscientiously as I have.

I did not mean to insult you, and I'm sorry that you took it that way. But you
also need to take care not to insult us and our valuable time by asking us to
write your code for you, and that's what I got from your message. I also saw no
indication you investigated my suggestion of using libssh2 through cURL. I just
ran the simple PHP cURL code given in the Stackoverflow link I provided you
(verbatim, except using local paths), and it uploaded a file with sftp, using
libssh2, from a local file, from a local private key file, via a local server
URL in a browser, without prompting the user while silently uploading the file.
That's 7 or 8 of your 9 criteria. Leaving the rest as an exercise to the
reader didn't seem unreasonable to me.

> Has anyone in the world succeeded in uploading a file using ssh2? I'm
> beginning to think not. Else why would it take so many days to find a
> working example?

Certainly they have, using libssh2 with cURL, at least. I've never had the need
for the low-level control that using libssh2 gives you directly compared to
libcurl, and even less often the need to use it through PHP, so I can't given
an answer on that.

> All I am asking is for the same example as FTP but that works securely,
> using sFTP. Am I not being reasonable? If not, why not?
> 
> I have found this library to have been documented at an inferior level to
> other libraries and function categories, mainly in that its primary example
> does not work, and that there is no clear and working example of using sFTP
> with a private key, and also because of its use of unclear jargon in many
> function descriptions (example: the words "key" and "password" actually can
> apply to two or more different parameters of the sFTP protocol; the
> documentation uses them ambiguously).

Documentation is seldom good enough for any software, but there are 11 example
programs using sftp included within libssh2 itself and many more elsewhere on
the Internet. The ssh protocol is complicated and the libssh2 documentation
doesn't try to teach that. The advice given here on many occasions is to go
read the SSH RFCs to understand the protocol before trying to use libssh2. The
API makes a lot more sense having a base understanding of the protocol itself.

> If it is indeed true, as you seem to be implying, that neither you nor
> anyone else on this mailing list has written simple code to upload a file, I
> am astounded. How is it possible to implement an entire security library,
> claiming to implement sFTP as a substitute for FTP, yet never to have
> written simple and working code that uses it? For, if you had, you could
> simply find that working code on your computer and share it with me instead
> of attacking me and/or the nature of my question.

I have no idea where you're getting any of this impression from. I've pointed
you to code that uploads a file in almost exactly the way you asked for, given
you to the libssh2 option that does the remaining 12% and pointed you to
example code using the libssh2 API for sftp. If this is an attack, then
clearly, there's a communication gap here.

> Did the ssh2 library really get released without a thorough test suite that
> includes uploading a file? Horrors.

You seem to be confusing libssh2, a C library, with the PHP binding to libssh2.
This forum is for the former, not the latter. I don't think you'll find many
people with PHP experience here, as you're probably already discovered. Perhaps
that's the source of some of your frustration. libssh2 is a C library that
someone else has wrapped in PHP, and this is (I hope) not the best place for
information on the latter.

> I am not asking for anyone to design an entire program for me. I'm only
> asking (again and again and again) for a simple working example of sFTP code
> using functions that are documented in the PHP Manual (working means the PHP
> output is included and the file was indeed uploaded).

Take another look at the link I sent. There are 17 lines of PHP code there that
do 78% of what you ask for.

> Surely you don't believe that modern cryptographic methods should be kept
> secret because you believe that secrecy enhances their cryptographic
> security? I hope not, because it is a cornerstone of modern cryptography
> that its methods be made fully public.

My argument is exactly the opposite--that this information isn't secret and is
already out there for you.

> And, finally, if the ssh2 library cannot actually upload a file using a
> private key, which I am beginning to suspect, this important fact should
> simply be admitted and documented. Then we can turn to cURL, phpseclib, or

I think the more than hundreds of thousands of Debian users alone with libssh2
installed would beg to differ.

> other solutions instead of banging our head against the wall with the PHP
> ssh2 library.

The PHP libssh2 binding is a completely different question. I, and probably
most people here, can't say much about that.

Dan
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Thu Jan 21 18:36:33 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10LHaHFl031477;
	Thu, 21 Jan 2021 18:36:28 +0100
Received: from server.springtimesoftware.com (server.springtimesoftware.com
 [162.254.253.20])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10LHaFEQ031467
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Thu, 21 Jan 2021 18:36:16 +0100
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=springtimesoftware.com; s=default; h=Content-Transfer-Encoding:Content-Type
 :In-Reply-To:MIME-Version:Date:Message-ID:From:References:To:Subject:Sender:
 Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:
 Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:
 List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=TyZK9XSx+o9+j3QJtHcXr/4ER8U3fdOZ8/7jK3BL1+Y=; b=CkIEl5GPVjAYuQuShmnwOwC01w
 VLMXwZ82cki25ow9fS5rilYPoSBBHWI5+krEyJP2cFZ2efz/eV2jnY3Pm0F70ujk1piRD9qLd3dls
 AzdLANaxEkqtMqXK6r2XkYmGmfpZ6yuP3Lkndx2KQyJCNev02hIhzqJwToCIKb2f/CCmZMx2yn+px
 VIkRpZAiIV6dWdxy3yYczGYYAlf36wHt4IZAj83LHPvgMEnN/UEJabik7OOHI4qm5nrPwx84CYgTo
 nujyDQvEA+/St+2vLFlvu+fLkj/h+KbDj3Y+N3mHoH5KzL6ys5vjygsfn/RdrEwYOnBZS/zKMmLfs
 ZZGm2X3g==;
Received: from [98.2.238.89] (port=2976 helo=[192.168.2.7])
 by server.springtimesoftware.com with esmtpsa (TLS1.2) tls
 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93)
 (envelope-from <dev@springtimesoftware.com>) id 1l2dsQ-00043q-Ol
 for libssh2-devel@cool.haxx.se; Thu, 21 Jan 2021 12:36:10 -0500
Subject: Re: Request for help for beginner, thanks!
To: libssh2-devel@cool.haxx.se
References: <8146fbfe-e68c-76d0-23c8-bd967f59dc04@springtimesoftware.com>
 <20210117161930.GB4800@coneharvesters.com>
 <c33d02cf-afb6-d260-d1e2-3645583471b4@springtimesoftware.com>
 <20210117181839.GA14749@coneharvesters.com>
 <6e23bf99-c9e4-abb5-b43f-bc01e3870186@springtimesoftware.com>
 <20210118164454.GA9597@coneharvesters.com>
 <50f811dd-e27f-4e7d-10b9-fcc82a689079@springtimesoftware.com>
 <20210121165116.GA20291@coneharvesters.com>
From: David Spector <dev@springtimesoftware.com>
Message-ID: <837bdb64-5d62-30c5-22af-83767c38d2d2@springtimesoftware.com>
Date: Thu, 21 Jan 2021 12:36:11 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
 Thunderbird/78.6.1
MIME-Version: 1.0
In-Reply-To: <20210121165116.GA20291@coneharvesters.com>
Content-Language: en-US
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - server.springtimesoftware.com
X-AntiAbuse: Original Domain - cool.haxx.se
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - springtimesoftware.com
X-Get-Message-Sender-Via: server.springtimesoftware.com: authenticated_id:
 fwd@springtimesoftware.com
X-Authenticated-Sender: server.springtimesoftware.com: fwd@springtimesoftware.com
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10LHaHFl031477

Dear Dan,

Thank you for taking the time to address my points.

I had no idea that this mailing list was not for the ssh2 library 
extension for PHP. This was not clear to me from its description.

I apologize for my postings, as they are clearly off-topic. I do not 
program in C anymore, only in PHP.

By the way, I think that pinecone harvesters are a great idea. Thanks, 
you are really helping our environment.

David Spector
Springtime Software
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Fri Jan 29 12:05:28 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10TB4wiT017447;
	Fri, 29 Jan 2021 12:05:19 +0100
Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com
 [IPv6:2607:f8b0:4864:20:0:0:0:235])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10TB4taw017429
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Fri, 29 Jan 2021 12:04:56 +0100
Received: by mail-oi1-x235.google.com with SMTP id m13so9409192oig.8
 for <libssh2-devel@cool.haxx.se>; Fri, 29 Jan 2021 03:04:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :content-transfer-encoding;
 bh=w6zFRRpq5It+4uRriiJiy1MkQuC6dltfMuyUn6GWidA=;
 b=YN1B/8FCQo5uO8pabRoSEbXfYGjlDmPIt4BJ47WkEugU0HTqofOX7pIWIGdVVC1tBc
 VRsl3ApyoJYOb690Q1HbNLgvw/B9eu5DKm2+BoTsTxSX3ArdzdhiBACnzaZYUg0FQSqd
 fVnSweJc8P1lVnk6xil6LfteqHlrBLzNFoBcds5nZnxdpAdINvQk7JGn1YvoLJ4fBNhM
 Zeep6kMIPNd0i/HaAhwIg+6Jcond1AespQl+LxPt8WC6H/WjiOhxeSFb7RCDhi+/jzZN
 u3fukx1GqWVn45bZFxSOLe90wVNpLFG0xGJ3UsLJX18uP5MT/C63QCMpJarA+AY8goQK
 iyRA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:content-transfer-encoding;
 bh=w6zFRRpq5It+4uRriiJiy1MkQuC6dltfMuyUn6GWidA=;
 b=lkS59c7a+2+E64F6Ocl3c6HsYACoSxxpgwii9CVMpYMxGyg7KiALyxlmKklMSDovsI
 MG4crVEoi+kQg0v7QaPK6E1ZccGxssDZbmYBL+8vbE0g9K67xvFy3H70v2LB1v8LXxFD
 I2lpOaqZ1tapnqtLT5WV4ONw7nxqec20taUhzgZofn+ZMP/6pggbpE7VbYSkKojzgtdm
 ZXg3znmwpc1aMGexFa7iF6W0/Y5gJtr6s/+CeJ55LsNsfGP19Uqvz16gksq1tEuvfY9G
 zv5W6bvDOl/xleLG2cDee/ivYl2zk9rhbviRlvleZibHYionqMX03i5As2Gou8K+8Z+J
 tXEA==
X-Gm-Message-State: AOAM5319ayufYUKFfeQzQpXydbPw7rUFNN+CiKWMuxklr+Q+c2XMT1J5
 GjEfBLbEfl9SU4qIaj0cRm7oZcAH7SoDtEuCLFglxZ7JYHnvPg==
X-Google-Smtp-Source: ABdhPJxtul5vBofzVQUNOmYWNW6UcXexd/OHOr6WXyK2vADxjG+bCJqtkVeZgRQDkN+CGWv0KmITYJR4lPhS7+hdsiY=
X-Received: by 2002:aca:b20a:: with SMTP id b10mr2336493oif.75.1611918290048; 
 Fri, 29 Jan 2021 03:04:50 -0800 (PST)
MIME-Version: 1.0
References: <6c5b3730d0034050ae24f6e48af86fde@usma1ex-dag3mb5.msg.corp.akamai.com>
 <alpine.DEB.2.20.2010081057450.31300@tvnag.unkk.fr>
 <C5154549-B940-488B-9AD3-E15CCE06455D@panic.com>
 <fae9b0c3-8fc4-5317-fef9-df1c70438a87@marc-hoersken.de>
 <121ead1e985c406a99a602e7100bc1be@USTX2EX-DAG3MB3.msg.corp.akamai.com>
In-Reply-To: <121ead1e985c406a99a602e7100bc1be@USTX2EX-DAG3MB3.msg.corp.akamai.com>
From: Micka <mickamusset@gmail.com>
Date: Fri, 29 Jan 2021 12:04:38 +0100
Message-ID: <CAF+MRt=2HU1t4z1mCewwSn865BgdOSk=33wapw2oOjaj-5--GA@mail.gmail.com>
Subject: Re: New Release - 1.9.1
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id
 10TB4taw017429
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10TB4wiT017447

still no news ? What is the status?

On Tue, Jan 12, 2021 at 5:55 AM Kelley, Ryan <rkelley@akamai.com> wrote:
>
> Just curious if on the status of this updated release.
>
> Ryan Kelley
> Senior Software Engineer II
>
> -----Original Message-----
> From: Marc Hoersken <info@marc-hoersken.de>
> Sent: Friday, October 09, 2020 8:00 AM
> To: libssh2-devel@cool.haxx.se
> Subject: Re: New Release - 1.9.1
>
> Friendly Reminder: I would like to merge a small security related change as
> part of the release.
>
> On 08.10.20 19:02, Will Cosgrove wrote:
> > To my knowledge, there is nothing that needs to be merged before a release.
> >
> > Will
> >
> >> On Oct 8, 2020, at 1:58 AM, Daniel Stenberg <daniel@haxx.se> wrote:
> >>
> >> On Thu, 8 Oct 2020, Kelley, Ryan wrote:
> >>
> >>> It has been about an year since Will put out a call to release a 1.9.1
> >>> soon due to a bunch of good fixes. It would be great if we could get that
> >>> release out the door.
> >> I'd be in favor.
> >>
> >> Any particular issues/pull-requests that SHOULD get fixed first?
> >
> > _______________________________________________
> > libssh2-devel
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__cool.haxx.se_cgi-
> > 2Dbin_mailman_listinfo_libssh2-2Ddevel&d=DwIGaQ&c=96ZbZZcaMF4w0F4jpN6L
> > Zg&r=O44kEvMioNdDVtqnasG-8_v2D0JXba5USf9PKKkdrBU&m=OOmF92tyKfLb0r_k-WQ
> > 98TCNIGKpio0DGBIxTCHgO2k&s=1bDkwsiCsYomOfHt5_WS8wlqJA14bZo4DbPZHOGcEaA
> > &e=
> _______________________________________________
> libssh2-devel
> https://urldefense.proofpoint.com/v2/url?u=https-3A__cool.haxx.se_cgi-2Dbin_mailman_listinfo_libssh2-2Ddevel&d=DwIGaQ&c=96ZbZZcaMF4w0F4jpN6LZg&r=O44kEvMioNdDVtqnasG-8_v2D0JXba5USf9PKKkdrBU&m=OOmF92tyKfLb0r_k-WQ98TCNIGKpio0DGBIxTCHgO2k&s=1bDkwsiCsYomOfHt5_WS8wlqJA14bZo4DbPZHOGcEaA&e=
> _______________________________________________
> libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Fri Jan 29 19:19:08 2021
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from giant.haxx.se (mail [127.0.0.1])
	by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id 10TIIcxd003660;
	Fri, 29 Jan 2021 19:18:59 +0100
Received: from mail.panic.com (mail.panic.com [38.103.165.36])
 by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id 10TIIZS7003646
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Fri, 29 Jan 2021 19:18:36 +0100
Received: from imac.localdomain (c-24-21-106-205.hsd1.or.comcast.net
 [24.21.106.205])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.panic.com (Postfix) with ESMTPSA id 33122C0328
 for <libssh2-devel@cool.haxx.se>; Fri, 29 Jan 2021 10:18:30 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=panic.com;
 s=default; t=1611944310;
 bh=D+/HD4wcvqsWWXXVrSQv+F4ixkHnoiujh32SE0dcJ/g=;
 h=From:Subject:Date:References:To:In-Reply-To;
 b=AxYC/SMiLlQarKXaSaNZ959nof+NVsTrWI0sX8t5M7HCU2LxXPV4U0y0cV/1ofvsw
 etqnSiQtKY7QKztJIVeupBLunkMTCLdkHXUBLYRAGyHpyyuy2eAJiTts996X1u3DnW
 3iS9C41k3XZZJPwx63M2RMnwry0llOnMOfAyxxo4=
From: Will Cosgrove <will@panic.com>
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\))
Subject: Re: New Release - 1.9.1
Date: Fri, 29 Jan 2021 10:18:29 -0800
References: <6c5b3730d0034050ae24f6e48af86fde@usma1ex-dag3mb5.msg.corp.akamai.com>
 <alpine.DEB.2.20.2010081057450.31300@tvnag.unkk.fr>
 <C5154549-B940-488B-9AD3-E15CCE06455D@panic.com>
 <fae9b0c3-8fc4-5317-fef9-df1c70438a87@marc-hoersken.de>
 <121ead1e985c406a99a602e7100bc1be@USTX2EX-DAG3MB3.msg.corp.akamai.com>
 <CAF+MRt=2HU1t4z1mCewwSn865BgdOSk=33wapw2oOjaj-5--GA@mail.gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
In-Reply-To: <CAF+MRt=2HU1t4z1mCewwSn865BgdOSk=33wapw2oOjaj-5--GA@mail.gmail.com>
Message-Id: <BA584479-DF9B-44C6-9638-A9896818DC01@panic.com>
X-Mailer: Apple Mail (2.3608.120.23.2.4)
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id
 10TIIZS7003646
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <https://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel/>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
 <mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
Content-Type: text/plain; charset="utf-8"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id 10TIIcxd003660

There are a couple things I’m working on that came up before release. Master has been stable for a while now if you’re looking to get jump on 1.9.1.  We are extremely short on eyes looking at and submitting PRs, issues, etc, so things are slow.

Lastly, Travis CI build times have been around 10 hours after submitting which is really slowing down PRs. I’d like to see someone move the builds over to Github actions.


Will


> On Jan 29, 2021, at 3:04 AM, Micka <mickamusset@gmail.com> wrote:
> 
> still no news ? What is the status?
> 
> On Tue, Jan 12, 2021 at 5:55 AM Kelley, Ryan <rkelley@akamai.com> wrote:
>> 
>> Just curious if on the status of this updated release.
>> 
>> Ryan Kelley
>> Senior Software Engineer II
>> 
>> -----Original Message-----
>> From: Marc Hoersken <info@marc-hoersken.de>
>> Sent: Friday, October 09, 2020 8:00 AM
>> To: libssh2-devel@cool.haxx.se
>> Subject: Re: New Release - 1.9.1
>> 
>> Friendly Reminder: I would like to merge a small security related change as
>> part of the release.
>> 
>> On 08.10.20 19:02, Will Cosgrove wrote:
>>> To my knowledge, there is nothing that needs to be merged before a release.
>>> 
>>> Will
>>> 
>>>> On Oct 8, 2020, at 1:58 AM, Daniel Stenberg <daniel@haxx.se> wrote:


_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

