Skip to content

feat: Implement bssh-keygen tool#163

Merged
inureyes merged 1 commit intomainfrom
feat/143-bssh-keygen
Jan 24, 2026
Merged

feat: Implement bssh-keygen tool#163
inureyes merged 1 commit intomainfrom
feat/143-bssh-keygen

Conversation

@inureyes
Copy link
Member

Summary

  • Implement bssh-keygen tool for SSH key pair generation in OpenSSH format
  • Support Ed25519 (default, recommended) and RSA algorithms
  • Include comprehensive tests and CLI interface

Features

  • Ed25519 key generation (default, recommended)
  • RSA key generation with configurable key size (2048-16384 bits)
  • OpenSSH private key format output
  • OpenSSH public key format (.pub file)
  • Proper file permissions (0600 for private key on Unix)
  • Comment support (-C flag)
  • SHA256 fingerprint display
  • Overwrite confirmation (-y to skip)
  • Quiet mode (-q)
  • Generated keys are fully compatible with OpenSSH

New Files

File Description
src/keygen/mod.rs Module exports and public API
src/keygen/ed25519.rs Ed25519 key generation
src/keygen/rsa.rs RSA key generation
src/bin/bssh_keygen.rs CLI binary

Usage

# Generate Ed25519 key (default)
bssh-keygen

# Generate with custom output path
bssh-keygen -f ~/.ssh/my_key

# Generate RSA key with 4096 bits
bssh-keygen -t rsa -b 4096

# Generate with custom comment
bssh-keygen -C "user@hostname"

# Generate without confirmation prompt
bssh-keygen -y

CLI Help

Generate SSH key pairs in OpenSSH format

Usage: bssh-keygen [OPTIONS]

Options:
  -t, --type <TYPE>        Key type: ed25519 (recommended) or rsa [default: ed25519]
  -f, --file <FILE>        Output file path (default: ~/.ssh/id_<type>)
  -b, --bits <BITS>        RSA key bits (only for RSA, minimum 2048) [default: 4096]
  -C, --comment <COMMENT>  Comment for the key
  -y, --yes                Overwrite existing files without prompting
  -q, --quiet              Quiet mode (no output except errors)
  -v, --verbose...         Verbosity level (-v, -vv, -vvv)
  -h, --help               Print help
  -V, --version            Print version

Test Plan

  • Unit tests for Ed25519 key generation
  • Unit tests for RSA key generation (various sizes)
  • Unit tests for key file permissions (0600)
  • Unit tests for public key format
  • CLI parsing tests
  • Integration test: Generated keys work with ssh-keygen -y
  • Integration test: Fingerprint matches ssh-keygen output

Closes #143

Implement a new bssh-keygen binary for generating SSH key pairs in OpenSSH
format, supporting Ed25519 (recommended) and RSA algorithms.

Features:
- Ed25519 key generation (default, recommended)
- RSA key generation with configurable key size (2048-16384 bits)
- OpenSSH private key format output
- OpenSSH public key format (.pub file)
- Proper file permissions (0600 for private key)
- Comment support (-C flag)
- SHA256 fingerprint display
- Overwrite confirmation (-y to skip)
- Quiet mode (-q)
- Generated keys are compatible with OpenSSH

New files:
- src/keygen/mod.rs - Module exports and public API
- src/keygen/ed25519.rs - Ed25519 key generation
- src/keygen/rsa.rs - RSA key generation
- src/bin/bssh_keygen.rs - CLI binary

Usage:
  bssh-keygen                      # Generate Ed25519 key (default)
  bssh-keygen -t rsa -b 4096       # Generate 4096-bit RSA key
  bssh-keygen -f ~/.ssh/my_key     # Custom output path
  bssh-keygen -C "user@host"       # Custom comment

Closes #143
@inureyes inureyes merged commit 4147b29 into main Jan 24, 2026
1 check failed
@inureyes inureyes deleted the feat/143-bssh-keygen branch January 24, 2026 11:28
@inureyes inureyes self-assigned this Jan 24, 2026
@inureyes inureyes added type:enhancement New feature or request priority:medium Medium priority issue status:done Completed labels Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium Medium priority issue status:done Completed type:enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement bssh-keygen tool

1 participant