Skip to content

fix: fall back to private key when .pub file parsing fails#268

Open
guysoft wants to merge 1 commit into
jeanp413:masterfrom
guysoft:bugfix/fallback-to-private-key-on-pub-parse-failure
Open

fix: fall back to private key when .pub file parsing fails#268
guysoft wants to merge 1 commit into
jeanp413:masterfrom
guysoft:bugfix/fallback-to-private-key-on-pub-parse-failure

Conversation

@guysoft

@guysoft guysoft commented Apr 28, 2026

Copy link
Copy Markdown

When a .pub file exists but contains a non-SSH key format (e.g. a PGP public key block), the extension would fail to parse it and skip the identity entirely — never attempting to read the actual private key file. This caused pubkey authentication to silently fail with 'Identity keys: None'.

Now, if parsing the .pub file returns an error, we fall back to reading and parsing the private key file directly. This matches the behavior of the Microsoft proprietary SSH extension and handles cases where users have non-SSH .pub files in ~/.ssh/.

Fixes: #28

When a .pub file exists but contains a non-SSH key format (e.g. a PGP
public key block), the extension would fail to parse it and skip the
identity entirely — never attempting to read the actual private key file.
This caused pubkey authentication to silently fail with 'Identity keys: None'.

Now, if parsing the .pub file returns an error, we fall back to reading
and parsing the private key file directly. This matches the behavior of
the Microsoft proprietary SSH extension and handles cases where users have
non-SSH .pub files in ~/.ssh/.

Fixes: jeanp413#28

@GitMensch GitMensch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - @daiyam you want the changelog to be added only before a release?

@daiyam daiyam added this to the N+1 milestone Jul 20, 2026
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.

Other .pub files effect ability to ssh using pubkey

3 participants