Skip to content

Provide better error for non-supported private keys #564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
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