[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parsing private key PK - Invalid key tag or value


Hi Andreas,

Am Do., 30. Juni 2022 um 08:06 Uhr schrieb Andreas Schneider
<asn@xxxxxxxxxxxxxx>:
>
> On Thursday, June 30, 2022 7:43:33 AM CEST Heiko Thiery wrote:
> > Hi,
>
> Hi Heiko,
>
> > I use netopeer2 with libnetconf2 in combination with libssh and
> > mbedtls. When trying to open a SSH connection I get the following
> > message:
> >
> > [INF]: LN: Accepted a connection on 0.0.0.0:830 from 127.0.0.1:38712.
> > [INF]: SR: Session 128 (user "root", CID 38) created.
> > [2022/06/28 07:31:06.841984, 1] pki_private_key_from_base64:  Parsing
> > private key PK - Invalid key tag or value
> > [ERR]: LN: Failed to set hostkey "genkey" (/tmp/gyFsev).
> >
> > Switching to use openSSL does not show this error.
>
> Which version of libssh do you use?

libssh version 0.9 used in buildroot 2021.02.

> What key type do you use?

It is a RSA key.

> Can you generate a new key pair which reproduces the error and share it with
> us?

The key is generated with a script used in netopeer2 [1]. It creates
the RSA key(s), strips the header/footer and removes the newlines.
Then it is stored in sysrepo and used by netconf2 library to handle it
with libssh [2] via ssh_bind_options_set(sbind,
SSH_BIND_OPTIONS_HOSTKEY, privkey_path).

[1] https://github.com/CESNET/netopeer2/blob/master/scripts/merge_hostkey.sh
[2] https://github.com/CESNET/libnetconf2/blob/master/src/session_server_ssh.c#L1430


I hope that helps.

> Best regards
>
>
>         Andreas
>
>
> --
> Andreas Schneider                 asn@xxxxxxxxxxxxxx
> GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
>
>

-- 
Heiko

References:
Parsing private key PK - Invalid key tag or valueHeiko Thiery <heiko.thiery@xxxxxxxxx>
Re: Parsing private key PK - Invalid key tag or valueAndreas Schneider <asn@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org