Skip to content

Add SSH Key support in Bitwarden Importer#13107

Open
chmod222 wants to merge 6 commits into
keepassxreboot:developfrom
chmod222:feature/bitwarden-ssh-key
Open

Add SSH Key support in Bitwarden Importer#13107
chmod222 wants to merge 6 commits into
keepassxreboot:developfrom
chmod222:feature/bitwarden-ssh-key

Conversation

@chmod222
Copy link
Copy Markdown

@chmod222 chmod222 commented Mar 5, 2026

Closes #12778 by adding support for SSH-Key attributes in Bitwarden JSON imports.

If an entry that contains an SSH-Key attribute is imported, the importer code turns it into two attachment files for the public and private key parts, with some light attempt at naming them somewhat sensibly being done. If no key type can be determined, fall back on the default names of "id" and "id.pub".

If KeePassXC is compiled with SSH-Agent support, such SSH-Key entries automatically have their private key attachments enabled as the coresponding private keys and are added to the agent.

(No generative AI was used in the creation of this code)
(It's been a while since I wrote Qt/C++ in anger, feel free to critique the heck out of my code style)

Testing strategy

  • Tested manually using exports from a Bitwarden database
  • 2 Unit tests for RSA and Ed25519 keys

Type of change

  • ✅ New feature (change that adds functionality)

@chmod222 chmod222 marked this pull request as ready for review March 5, 2026 01:02
@chmod222 chmod222 changed the title Add SSH Key support in Bitwarden importer Add SSH Key support in Bitwarden Importer Mar 5, 2026
if (!publicKey.isEmpty() && !privateKey.isEmpty()) {
auto baseName = QString("id");

if (publicKey.startsWith("ssh-ed25519 ")) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It should be enough to check the strings like this? And without the spaces.

if (publicKey.startsWith("ssh-ed25519") ...

if (publicKey.startsWith("ssh-rsa") || publicKey.startsWith("ssh-sha2") ...

if (publickey.startsWith("ecdsa-sha2") ...

if (publickey.startsWith("ssh-dss") ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why the space at the end of the string?

@droidmonkey droidmonkey added feature: SSH agent pr: new feature Pull request adds a new feature labels Mar 8, 2026
@droidmonkey droidmonkey added this to the v2.8.0 milestone Mar 8, 2026
@droidmonkey droidmonkey self-requested a review March 8, 2026 19:08
@droidmonkey droidmonkey force-pushed the feature/bitwarden-ssh-key branch from 48fdc08 to bceba82 Compare April 17, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: SSH agent pr: new feature Pull request adds a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bitwarden JSON import does not import SSH keys

3 participants