Skip to content

Comments

Provide better error for non-supported private keys#564

Open
ZoltanFridrich wants to merge 1 commit intoopenssh:masterfrom
ZoltanFridrich:zfridric_devel2
Open

Provide better error for non-supported private keys#564
ZoltanFridrich wants to merge 1 commit intoopenssh:masterfrom
ZoltanFridrich:zfridric_devel2

Conversation

@ZoltanFridrich
Copy link

If I try to use a PuTTY key (".ppk" format) ssh prints the following error:

debug1: Trying private key: ./test.ppk
Load key "./test.ppk": error in libcrypto

after some analysis it seems that when using unsupported private key the following call to PEM_read_bio_PrivateKey fails:
https://github.com/openssh/openssh-portable/blob/master/sshkey.c#L3544
returned error is of type ERR_GET_LIB(pem_err) = ERR_LIB_OSSL_DECODER.
In translate_libcrypto_error() function this type of error is unrecognized and will default to SSH_ERR_LIBCRYPTO_ERROR.
This patch changes the error output to:

debug1: Trying private key: ./test.ppk
Load key "./test.ppk": invalid format

@ZoltanFridrich ZoltanFridrich force-pushed the zfridric_devel2 branch 3 times, most recently from a3357a0 to 94b7a7d Compare May 5, 2025 09:13
Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant