ssh-keygen returns 0 if there is at least one valid key passed via stdin

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ssh-keygen returns 0 if there is at least one valid key passed via stdin

Jiri B-3
Hi,

what I was trying is to validate ssh public keys passed via stdin to
ssh-keygen. It seems one has to split each line before passing to
ssh-keygen as ssh-keygen would return 0 if there is at least one valid
key in the input.

Is this behaviour correct?

Jiri

$ cat /etc/fstab .ssh/id_rsa.pub | ssh-keygen -l -f - -v
debug1: (stdin):1: not a public key
debug1: (stdin):2: not a public key
debug1: (stdin):3: not a public key
debug1: (stdin):4: not a public key
debug1: (stdin):5: not a public key
debug1: (stdin):6: not a public key
debug1: (stdin):7: not a public key
debug1: (stdin):8: not a public key
debug1: (stdin):9: not a public key
debug1: (stdin):12: not a public key
debug1: (stdin):13: not a public key
debug1: (stdin):14: not a public key
2048 SHA256:3ig2wrDgHa2iNH/89HGFRx+YuP7X6febAZR+kxu3Drg  (RSA)
+---[RSA 2048]----+
|                 |
|            . +  |
|           . * . |
|    .       * . o|
|. .. .  S  o = *.|
|...+o  . o. + o *|
| =.o+ +.o..+ . +o|
|o +  =.o. o o oo=|
|.  .. .. . E .o==|
+----[SHA256]-----+
$ sysctl kern.version
kern.version=OpenBSD 6.4 (GENERIC) #3: Thu Dec 20 18:31:57 CET 2018
    [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC