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

Re: pki_private_key_from_base64: key flags issue [SOLVED]

Hello Aris,

> I agree with Andreas. There's nothing wrong in having the private key
> being also a public key, it actually makes some things much easier, and
> it's also very easy technically, as all key algorithms I have worked
> with till today need the public key elements even in the private key
> part.

thank you for the detailed answer.  That perfectly explains why both
private and public flag set for a private key.

I'm working on a library that uses libssh, and the library provides
three predicates for keys: one that checks if the object is a key, and
the other two that check type of a key (private or public).  Probably
the design is overabundant, but that's another story and related only to
my project.

So I marked the thread as [SOLVED].

> The functions could have had better names, like
> "ssh_key_contains_public", but I'm sure you will work around this :)
> Only take into account the output of ssh_key_is_private() for your
> needs.

Sure thing, one can check if a key is a public key by applying logical
NOT to the result of `ssh_key_is_private' call.  I was obviously wrong
when stated that it is impossible to determine the type of a key with
the provided predicates.

Best regards,

- Artyom

Artyom V. Poptsov <poptsov.artyom@xxxxxxxxx>
Home page: http://poptsov-artyom.narod.ru/

pki_private_key_from_base64: key flags issueArtyom Poptsov <poptsov.artyom@xxxxxxxxx>
Re: pki_private_key_from_base64: key flags issueAndreas Schneider <asn@xxxxxxxxxxxxxx>
Re: pki_private_key_from_base64: key flags issueAris Adamantiadis <aris@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org