Skip to content
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

"The SSH key is invalid" when using 'Import key from clipboard' on Windows #13151

Open
1 task done
jantoney opened this issue Jan 30, 2025 · 9 comments · May be fixed by #12479
Open
1 task done

"The SSH key is invalid" when using 'Import key from clipboard' on Windows #13151

jantoney opened this issue Jan 30, 2025 · 9 comments · May be fixed by #12479
Labels
bug desktop Desktop Application

Comments

@jantoney
Copy link

Steps To Reproduce

Requirements

  • A SSH key generated with a passphrase
  • Bitwarden installed via winget (untested on any other install method)
winget Bitwarden.Bitwarden

NON-FUNCTIONING WORKFLOW

  1. Click '+' (add item)
  2. Select Type = 'SSH'
  3. Copy a SSH private key to your clipboard
  4. Click 'Import key from clipboard'
  5. Copy the passphrase to clipboard
  6. Paste the pass phrase
  7. Click 'Import'

ERROR: The SSH key is invalid


FUNCTIONING WORKFLOW

  1. Click '+' (add item)
  2. Select Type = 'SSH'
  3. Copy a SSH private key to your clipboard
  4. Click 'Import key from clipboard'
  5. Copy the passphrase to clipboard
  6. Paste the pass phrase
  7. [EXTRA STEP] Copy the original SSH private key back into your clipboard
  8. Click 'Import'

The key is imported correctly

Expected Result

The SSH key should be cached after clicking 'Import key from clipboard', so you're able to copy the passphrase from another location into the clipboard to paste into Bitwarden.

Actual Result

ERROR: 'The SSH key is invalid' is shown.

It seems the issue is that Bitwarden is validating the clipboard after first clicking 'Import key from clipboard' but isn't caching it.
You then copy the passphrase to clipboard and so Bitwarden now doesn't know what the private key is anymore.
When you click 'Import' it's trying to re-validate the passphrase in the clipboard as an SSH key, can't and so throws the error.

If you follow the working workflow above and re-copy the SSH private key to the clipboard before clicking import, then the key is imported correctly.

Screenshots or Videos

No response

Additional Context

Bitwarden version details
Version 2025.1.3
SDK 'main (28c7e29)'
Shell 33.2.1
Renderer 130.0.6723.137
Node 20.18.1
Architecture x64

Operating System

Windows

Operating System Version

Windows 11 - 23H2 (OS Build 22631.4751)

Installation method

Other

Build Version

2025.1.3

Issue Tracking Info

  • I understand that work is tracked outside of GitHub. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.
@jantoney jantoney added bug desktop Desktop Application labels Jan 30, 2025
@bitwarden-bot
Copy link

Thank you for reporting this issue! We've added this to our internal tracking system.
ID: PM-17741

@quexten
Copy link
Contributor

quexten commented Jan 31, 2025

Hi! Which application did you generate the SSH key that you are trying to import in initially?

@Roan-V
Copy link

Roan-V commented Jan 31, 2025

Hi! Which application did you generate the SSH key that you are trying to import in initially?

I'm having the same issue, I used ssh-keygen on windows

@jantoney
Copy link
Author

jantoney commented Feb 2, 2025

@quexten - I can't remember. It would have been bash or powershell with openssl. I use both heaps. Possibly Windows...?

I don't think it matters though because it seems to be an order of operations issue, not a SSH keygen issue.
If you re-copy the SSH key to clipboard before hitting that final button, it works fine,

@jantoney
Copy link
Author

jantoney commented Feb 2, 2025

Hi! Which application did you generate the SSH key that you are trying to import in initially?

I'm having the same issue, I used ssh-keygen on windows

If you follow my 'FUNCTIONING WORKFLOW' example in the original post, does that work for you? Can you re-copy it to the clipboard before hitting the final button?

@Roan-V
Copy link

Roan-V commented Feb 3, 2025

Hi! Which application did you generate the SSH key that you are trying to import in initially?

I'm having the same issue, I used ssh-keygen on windows

If you follow my 'FUNCTIONING WORKFLOW' example in the original post, does that work for you? Can you re-copy it to the clipboard before hitting the final button?

Yes, that does apply a key.
Interestingly enough, the resulting stored key is not the same as the originally copied key.

@cksapp
Copy link

cksapp commented Feb 3, 2025

Yes, that does apply a key.
Interestingly enough, the resulting stored key is not the same as the originally copied key.

@Roan-V Likely if your SSH private key file is encrypted with a passphrase, whereas upon import to Bitwarden the private key remains unencrypted leading to the differences seen

@Roan-V
Copy link

Roan-V commented Feb 3, 2025

Ah, that makes sense
Thank you

@igielskv
Copy link

igielskv commented Feb 3, 2025

Hello everybody,

Just to confirm, exactly same behavior for me on macOS.

...and workaround works ok.

Have a great day everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug desktop Desktop Application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants