Crates.io | qssh |
lib.rs | qssh |
version | 0.0.2-alpha |
created_at | 2025-09-25 16:12:21.944266+00 |
updated_at | 2025-09-26 01:54:54.654075+00 |
description | Experimental quantum-safe SSH using post-quantum crypto. Research project - NOT for production. See LIMITATIONS.md |
homepage | |
repository | https://github.com/QuantumVerseProtocols/qssh |
max_upload_size | |
id | 1854812 |
size | 1,955,406 |
Quantum-resistant SSH replacement using post-quantum cryptography. Your encrypted connections remain secure even against quantum computers.
The Timeline Problem: IBM's quantum roadmap shows 100,000+ qubit systems by 2033. China claims quantum supremacy breakthroughs yearly. Meanwhile, your SSH traffic is being harvested today for retroactive decryption when RSA/ECDSA fall.
Who Needs This Now:
For Everyone Else: You're probably fine with OpenSSH for now. But if you're curious about post-quantum crypto or want to experiment with QKD hardware, QSSH is here as an open-source playground. We're not claiming to replace OpenSSH - we're offering an alternative for specific threat models.
QSSH operates across multiple OSI layers, just like SSH:
QSSH is a session-layer protocol that provides secure remote access and can tunnel any application protocol - from X11 and databases to blockchain RPC - all with post-quantum security.
# Install
cargo install qssh
# Generate quantum-safe keys
qssh-keygen
# Connect (just like SSH)
qssh user@server
That's it! You're now quantum-safe with zero configuration.
Current: v0.0.1-alpha - Early Experimental Implementation
qssh user@host -c "command"
)git clone https://github.com/QuantumVerseProtocols/qssh
cd qssh
cargo build --release
sudo cp target/release/qssh* /usr/local/bin/
# Arch Linux
yay -S qssh
# macOS
brew install qssh
# Debian/Ubuntu
sudo apt install qssh
QSSH supports configuration files similar to OpenSSH. Place your config at ~/.qssh/config
:
# Example ~/.qssh/config
Host myserver
Hostname server.example.com
User myuser
Port 22222
PqAlgorithm falcon
LocalForward 8080:localhost:80
Host *.internal
User admin
PqAlgorithm kyber1024
Then connect simply with:
qssh myserver
See example.qssh.config for a complete configuration example.
# Default (Falcon-512)
qssh-keygen
# SPHINCS+ for maximum security
qssh-keygen -t sphincs+
# Custom output location
qssh-keygen -f ~/.qssh/id_production
# Set password for user (server-side)
sudo qssh-passwd username
# Verify password
qssh-passwd -c username
# Standard connection (with public key)
qssh user@quantum.example.com
# Password authentication
qssh -P user@quantum.example.com
# Custom port
qssh user@quantum.example.com:42
# Execute command
qssh user@server "df -h"
# Interactive shell with verbosity
qssh -v user@server
# Copy local to remote
qscp report.pdf user@server:/home/user/
# Copy remote to local
qscp user@server:/data/results.csv ./
# Recursive copy
qscp -r ./project user@server:/deploy/
# Start daemon (default port 42)
qsshd
# Custom configuration
qsshd --listen :22 --max-connections 1000
# With quantum devices
qsshd --qkd qkd://alice.local --qrng /dev/qrandom
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Quantum Devices │ │ QKD Network │ │ QRNG Sources │
├─────────────────┤ ├─────────────────┤ ├─────────────────┤
│ • Photon pairs │ │ • Alice node │ │ • Quantum decay │
│ • Entangled │────▶│ • Bob node │ │ • Shot noise │
│ • Single photon │ │ • ETSI API │ │ • Vacuum noise │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
└───────────────────────┴─────────────────────────┘
│
┌────────────▼────────────┐
│ QSSH Protocol │
├─────────────────────────┤
│ • Falcon-512 (default) │
│ • SPHINCS+ (optional) │
│ • Custom providers │
└────────────┬────────────┘
│
┌───────────────────────┴─────────────────────────┐
│ │
┌────────▼────────┐ ┌─────────▼────────┐
│ Your Device │ │ Remote Server │
├─────────────────┤ ├──────────────────┤
│ qssh client │◄────── Encrypted Channel ───►│ qsshd daemon │
└─────────────────┘ (TCP Port 42) └──────────────────┘
┌─────────────────────────────────────────────────────┐
│ Layer 7 - Application │ Shell, SFTP, Port Forward │
├───────────────────────┼─────────────────────────────┤
│ Layer 6 - Presentation│ QSSH Protocol │
│ │ • Post-quantum crypto │
│ │ • Key exchange & auth │
├───────────────────────┼─────────────────────────────┤
│ Layer 5 - Session │ Channel multiplexing │
├───────────────────────┼─────────────────────────────┤
│ Layer 4 - Transport │ TCP (Port 42 default) │
├───────────────────────┼─────────────────────────────┤
│ Layer 3 - Network │ IP (IPv4/IPv6) │
├───────────────────────┼─────────────────────────────┤
│ Layer 2 - Data Link │ Ethernet/WiFi │
├───────────────────────┼─────────────────────────────┤
│ Layer 1 - Physical │ Cable/Radio/Fiber │
└─────────────────────────────────────────────────────┘
Component | Default | Alternative | Purpose |
---|---|---|---|
Key Exchange | Falcon-512 | SPHINCS+, Custom | Fast ephemeral keys |
Signatures | Falcon-512 | SPHINCS+, Lamport | Authentication |
Encryption | AES-256-GCM | ChaCha20-Poly1305 | Channel encryption |
KDF | SHA3-256 | SHAKE256 | Key derivation |
Random | QRNG→System | /dev/urandom | Nonce generation |
QSSH protects against:
~/.qssh/config.toml
:
[defaults]
algorithm = "falcon-512"
port = 42
compression = true
keepalive = 60
[hosts."*.quantum.net"]
algorithm = "sphincs+"
use_qkd = true
forward_agent = true
[hosts."critical.server"]
require_qkd = true
require_lamport = true
min_entropy = 256
export QSSH_ALGORITHM=falcon-512
export QSSH_QKD_ENDPOINT=qkd://alice.quantum.net
export QSSH_QRNG_SOURCE=/dev/qrandom
export QSSH_LOG_LEVEL=debug
# Connect with QKD
qssh --qkd qkd://alice.local/api user@server
# Require QKD
qssh --require-qkd user@critical.server
# QKD with fallback
qssh --qkd-fallback user@server
# Local quantum device
qsshd --qrng /dev/qrandom
# Network QRNG
qsshd --qrng kirq://entropy.hub:8080
# Multiple sources
qsshd --qrng /dev/qrandom,kirq://backup.net
# Local forward (access remote service locally)
qssh -L 5432:db.internal:5432 user@gateway
# Remote forward (expose local service remotely)
qssh -R 8080:localhost:3000 user@public.server
# Dynamic SOCKS proxy
qssh -D 1080 user@gateway
# Multiple forwards
qssh -L 3306:mysql:3306 -L 5432:postgres:5432 user@server
Decentralized operation without daemons:
# Start P2P listener
qssh --p2p --listen
# Connect to peer
qssh --p2p alice@192.168.1.100
# Discover peers
qssh --p2p --discover
# Enable STUN
qssh --p2p --stun stun.l.google.com:19302
# Use TURN relay
qssh --p2p --turn turn.example.com --turn-user alice
# Use QuantumHarmony validators
qssh --p2p --blockchain harmony://mainnet
# All tests
cargo test
# Unit tests only
cargo test --lib
# Integration tests
cargo test --test integration
# Specific test
cargo test test_handshake
# With output
cargo test -- --nocapture
# Parallel tests
cargo test -- --test-threads=8
src/*/mod.rs
)tests/
)tests/quantum_tests.rs
)benches/
)# Run benchmarks
cargo bench
# Specific benchmark
cargo bench handshake
# Compare implementations
cargo bench --bench crypto_bench
# Generate coverage report
cargo tarpaulin --out Html
# With branch coverage
cargo tarpaulin --branch --out Lcov
# Development build
cargo build
# Release build (optimized)
cargo build --release
# All targets
cargo build --all-targets
# With features
cargo build --features "qkd,hardware"
use qssh::crypto::{CryptoProvider, AlgorithmInfo};
pub struct MyAlgorithm;
#[async_trait]
impl CryptoProvider for MyAlgorithm {
fn name(&self) -> &str { "my-algo" }
async fn generate_keypair(&self, algorithm: &str) -> Result<KeyPair> {
// Your implementation
}
async fn sign(&self, key: &[u8], data: &[u8]) -> Result<Vec<u8>> {
// Your implementation
}
}
let mut registry = CryptoRegistry::new();
registry.register(Box::new(MyAlgorithm));
qssh --algorithm my-algo user@server
# Verbose output
qssh -vvv user@server
# Debug specific subsystem
QSSH_DEBUG=handshake,crypto qssh user@server
# Protocol trace
qssh --trace protocol.log user@server
# Analyze core dumps
gdb qssh core
Operation | Falcon-512 | SPHINCS+ | RSA-2048 |
---|---|---|---|
Keygen | 0.8ms | 3.2ms | 84ms |
Sign | 0.4ms | 5.1ms | 1.2ms |
Verify | 0.1ms | 2.4ms | 0.04ms |
Handshake | 3.2ms | 14ms | 5.6ms |
# Test connectivity
qssh-diag test user@server
# Check algorithms
qssh-diag algorithms
# Verify quantum devices
qssh-diag quantum
"No quantum entropy available"
--no-qrng
"Algorithm negotiation failed"
--algorithms
match"QKD key exhausted"
Increase key generation rate
Enable QKD cache
# Format code
cargo fmt
# Lint
cargo clippy
# Security audit
cargo audit
Licensed under either:
at your option.
Building quantum-safe infrastructure for the next generation of secure communications.