crypto engine

Peter Stuge peter at
Fri Nov 26 16:41:27 CET 2021

Salut Bastien,

Bastien Durel via libssh2-devel wrote:
> Is there a way to say during runtime (or maybe at compile time) which
> crypto engine is backing libssh2 ?

There's no API for it.

If you have access to libssh2_config.h from when libssh2 was built you
could check the defines there.

But in practise I think the only halfway reliable way is to run:

$ pkg-config --print-requires-private libssh2

> The code I wrote uses libssh2_userauth_publickey_frommemory, which
> fails with LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED / "Callback returned
> error" when the crypto engine is not OpenSSL.

So that's one way to find out.

> I'd like to know if I have to write key material to temporary files

I'd probably just try it and if it fails then write to temp file and
try that.

> Debian version of libssh2 is built against libgcrypt20 but arch's
> version is built against openssl, which confused me a lot :/

Distribution packages will always be whatever the particular
maintainer wants to do. I usually want to decide myself so I prefer
distributions which let me do that. :)

Kind regards


More information about the libssh2-devel mailing list