Skip to content

SSH: PuTTY keys (.ppk) used or imported; Pageant on Windows, an ssh-agent on Linux and macOS - #11

Merged
Neo-Desktop merged 5 commits into
mainfrom
claude/project-thread-eywog3
Nov 12, 2026
Merged

Neo-Desktop merged 5 commits into
mainfrom
claude/project-thread-eywog3

Conversation

@Neo-Desktop

Copy link
Copy Markdown
Contributor

What

Engine (ssh/)

  • src/ppk.c reads PuTTY's .ppk files, versions 2 and 3, and rearranges them into OpenSSH's form for libssh. Version 3 is Argon2id, Argon2i or Argon2d with AES-256-CBC and HMAC-SHA-256; version 2 is SHA-1. The hashes, AES and Argon2 are in the file itself, so it works the same whatever libssh was built on. Every key function (dmc_ssh_auth_key, dmc_ssh_key_public, dmc_ssh_key_export) now accepts a .ppk. There is also a new dmc_ssh_key_encrypted().
  • src/agent.c adds a new "agent" option and dmc_ssh_agent_reachable().
    • On Linux and macOS the option is the agent's socket (empty means SSH_AUTH_SOCK).
    • On Windows it is Pageant, reached through WM_COPYDATA the way PuTTY's own tools reach it, or else OpenSSH's agent (\\.\pipe\openssh-ssh-agent), or a named pipe you give. A loopback socket pair and a thread sit between libssh and the agent.

Apps

  • Linux: a key button next to the server opens a popover with:
    • how to log in: keys and agent as ssh does, the agent's keys only, or a key file;
    • the key file;
    • "Import a PuTTY Key…", which writes ~/.ssh/<name> in OpenSSH's form with the same passphrase and selects it;
    • the agent's socket, and whether an agent answers there.
  • Windows: a "Login..." button opens an SSH Login dialog with the same choices. The agent field is empty for Pageant (or else OpenSSH's agent), or takes "pageant" or a pipe. Imports go to the profile's .ssh.
  • macOS: a key popover with the same choices; imports use NSOpenPanel.
  • If a key has a passphrase, the app asks for it in its own dialog, up to three tries, then falls back to a password.

Tests

  • dmodemssh_test now checks:
    • RFC 9106's Argon2d, Argon2i and Argon2id vectors;
    • three embedded .ppk files from PuTTYgen 0.81 (v3 with Argon2id, v2, and unencrypted): their public lines, a wrong passphrase refused, and the OpenSSH re-export.
  • CI's live sshd step adds a login by an RSA .ppk and a login through an ssh-agent at a given socket.
  • On Windows, the test also runs stand-ins for Pageant (its window and WM_COPYDATA) and for an agent on a named pipe, and logs in through both against a real sshd.
  • Run locally:
    • Linux: every key type PuTTYgen makes (Ed25519, ECDSA 256/384/521, RSA) × v2/v3 × each Argon2 type and lane count gives the same public key as puttygen -O public-openssh. The live tests pass, also under ASan and UBSan.
    • Windows (MinGW build under Wine): the live tests pass, plus both agent stand-ins.
    • The Linux and Windows GUIs were tried end to end against a local sshd:
      • encrypted .ppk login, with a wrong passphrase re-asked;
      • agent-only login (Linux);
      • PuTTY key import, whose result ssh-keygen -y reads with the same passphrase.
  • The macOS Swift has not been compiled here; CI builds it.

The engine files are the same in D-Modem/app's native-ssh/ (a companion PR there).


Generated by Claude Code

@Neo-Desktop
Neo-Desktop merged commit 258d0ab into main Nov 12, 2026
8 of 9 checks passed
@Neo-Desktop
Neo-Desktop deleted the claude/project-thread-eywog3 branch November 12, 2026 18:25
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.

2 participants