ssh_core is an experimental Dart SSH client core that focuses on protocol
building blocks rather than a single monolithic client implementation.
It defines clear boundaries between transport, authentication, channels, sessions, PTY handling, exec, SFTP, and port forwarding so higher-level packages or applications can compose the pieces they need.
This repository is public, but it is still not ready for use.
Current status:
- the package is published on
pub.devas an experimental prerelease - it is useful for SSH protocol exploration and interoperability work
- it is not ready for production use or general application integration yet
- the public API is intentionally small, but some low-level transport details are still evolving
- A Dart-first SSH client core with separable modules
- A transport layer with real secure socket support
- A protocol toolkit for auth, channels, sessions, SFTP, and forwarding
- A codebase aimed at incremental implementation rather than big rewrites
- A polished end-user SSH CLI
- A stable
1.0API - A full interoperability matrix across every SSH server and algorithm variant
- A replacement for OpenSSH
SshClientorchestration with injectable transport/auth/session servicesSshSecureSocketTransportwith:- Curve25519 key exchange
- Ed25519 / RSA / ECDSA host-key verification
chacha20-poly1305@openssh.comaes128-ctr,aes192-ctr,aes256-ctrhmac-sha2-256,hmac-sha2-512zlibandzlib@openssh.com- mid-session rekeying
- Packet-backed channel, shell, exec, SFTP, and forwarding services
- Local, remote, and dynamic TCP port forwarding bridges
- Focused tests plus a package-level smoke test
- A live
dart:ioexample viaSshIoClientFactory
The package is published on pub.dev, but it is still not ready for general
use. Treat the current release as an experimental prerelease for protocol work
and early evaluation.
Use a hosted dependency when consuming a published release:
dependencies:
ssh_core: ^0.1.0-dev.2For GitHub-based integration, depend on the repository directly:
dependencies:
ssh_core:
git:
url: https://github.com/Atrac613/ssh_core.gitFor local development, a path dependency is still convenient:
dependencies:
ssh_core:
path: ../ssh_coreimport 'package:ssh_core/ssh_core.dart';
Future<void> main() async {
final trustedHostKey = SshHostKey.decode(
(SshPayloadWriter()
..writeString('ssh-ed25519')
..writeStringBytes(const [1, 2, 3, 4, 5, 6]))
.toBytes(),
);
final client = SshClient(
config: SshClientConfig(
host: 'example.com',
username: 'demo',
hostKeyVerifier: SshStaticHostKeyVerifier(
trustedKeys: <SshTrustedHostKey>[
SshTrustedHostKey(host: 'example.com', hostKey: trustedHostKey),
],
),
),
authMethods: const <SshAuthMethod>[
SshPasswordAuthMethod(password: 'secret'),
],
transport: DemoTransport(hostKey: trustedHostKey),
authenticator: DemoAuthenticator(),
channelFactory: DemoChannelFactory(),
sessionManager: DemoSessionManager(),
execService: DemoExecService(),
sftpSubsystem: DemoSftpSubsystem(),
portForwardingService: DemoPortForwardingService(),
);
await client.connect();
final result = await client.exec('uname -a');
print(result.stdoutText.trim());
await client.close();
}For complete examples:
example/ssh_core_example.dart: fake/demo wiring that compiles quicklyexample/ssh_core_io_example.dart: livedart:ioexample built onSshIoClientFactory
The main package entry points are:
package:ssh_core/ssh_core.dartpackage:ssh_core/ssh_core_io.dart
Primary public surfaces:
SshClient: top-level orchestrationSshTransport/SshPacketTransport: transport contractsSshSecureSocketTransport: real securedart:iotransportSshAuthenticatorand protocol auth helpersSshPacketChannelFactory: packet-backed channel multiplexerSshProtocolSessionManager: shell sessions with PTY/env requestsSshProtocolExecService: non-interactive command executionSshProtocolSftpSubsystem: packet-backed SFTP clientSshIoPortForwardingService: local/remote/dynamic forwarding bridgesSshIoClientFactory: convenience wiring for live clients
Transport primitives currently include:
- SSH identification banner parsing and exchange
- packet framing and payload codecs
KEXINIT, ECDH init/reply,NEWKEYS, disconnect, and ext-info messages- algorithm negotiation helpers
- host-key parsing and verification helpers
- exchange-hash and key-derivation helpers
- encrypted packet protection for AES-CTR/HMAC and ChaCha20-Poly1305
Not implemented yet:
- strict-kex / full Terrapin-oriented transport hardening
- broader KEX coverage beyond the current Curve25519 baseline
- broader cipher / MAC coverage beyond the current explicit matrix
Current secure transport interoperability is intentionally narrow and explicit:
| Category | Supported |
|---|---|
| KEX | curve25519-sha256, curve25519-sha256@libssh.org |
| Host key | ssh-ed25519, rsa-sha2-256, rsa-sha2-512, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521 |
| Cipher | chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr |
| MAC | embedded Poly1305 for chacha20-poly1305@openssh.com; hmac-sha2-256, hmac-sha2-512 for AES-CTR |
| Compression | none, zlib, zlib@openssh.com |
| Auth | none, password, publickey, keyboard-interactive |
| Forwarding | local, remote, dynamic TCP forwarding, including assigned remote ports |
lib/ssh_core.dart: main public exportslib/ssh_core_io.dart:dart:io-specific exportslib/src/transport/: handshake, crypto, packet protection, secure transportlib/src/auth/: auth models and protocol authenticatorlib/src/channels/: channel contracts and packet-backed implementationlib/src/sessions/: shell/session abstractions and helperslib/src/exec/: non-interactive exec abstractions and implementationlib/src/sftp/: SFTP contracts and packet-backed subsystemlib/src/forwarding/: forwarding contracts, protocol helpers, IO bridgesexample/: usage examplestest/: focused teststool/smoke_test.dart: lightweight end-to-end sanity check
Run the standard verification set:
dart format .
dart analyze
dart test
dart run tool/smoke_test.dartGitHub Actions runs the same checks in .github/workflows/dart.yml.
If you want to contribute, see CONTRIBUTING.md.
Please also follow the lightweight expectations in
CODE_OF_CONDUCT.md.
- finish the in-flight transport hardening work around
strict-kex,ext-info, and clearer disconnect/error surfacing - keep strengthening focused tests for transport, auth, session lifecycle, and forwarding shutdown paths
- continue improving OpenSSH interoperability without widening the public API unnecessarily
- broaden algorithm coverage beyond the current Curve25519 + Ed25519/RSA/ECDSA + ChaCha20/AES-CTR + HMAC-SHA2 baseline
- add more interoperability-focused integration coverage
- tighten host-key trust UX for real applications
- add advanced forwarding variants beyond TCP local/remote/dynamic bridges
- keep growing the live
dart:ioexamples into copy-pasteable integration recipes - prepare the package for a first public version and, eventually,
pub.dev
Before tagging the first public GitHub release, it is worth checking:
- the README still matches the actual compatibility matrix and examples
- the MIT license remains the intended choice
- GitHub Actions is green on
mainand on pull requests - release notes describe the experimental scope and known gaps