Skip to content

Add SshKey class for SSH key management#1

Merged
davidnich merged 2 commits intodevelopfrom
feature/ssh_key_management
Apr 9, 2026
Merged

Add SshKey class for SSH key management#1
davidnich merged 2 commits intodevelopfrom
feature/ssh_key_management

Conversation

@davidnich
Copy link
Copy Markdown
Member

Summary

  • Add new SshKey class wrapping libssh's PKI API for programmatic SSH key management
  • Support key generation (RSA, ED25519, ECDSA-P256/P384/P521), import/export from files and strings with optional passphrase encryption, key inspection (type, fingerprint, public/private state), and comparison
  • Add SshKeyInfo typed hash, key type constants, file format constants, and hash type constants
  • Add comprehensive documentation page and 32-test suite (92 assertions, valgrind clean)

Test plan

  • All 32 SshKey test cases pass (generation, import/export roundtrips, inspection, comparison, error handling, constants)
  • Existing SshSession and SshCommandSession tests unaffected
  • Valgrind shows 0 definite/possible memory leaks
  • Build succeeds cleanly with no warnings

🤖 Generated with Claude Code

Add programmatic SSH key management via a new SshKey class wrapping
libssh's PKI API. Supports key generation (RSA, ED25519, ECDSA),
import/export from files and strings with optional passphrase
encryption, key inspection (type, fingerprint, public/private state),
and comparison by public key material.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Qore::Ssh::SshKey API layer around libssh PKI primitives to enable programmatic SSH key generation/import/export/inspection in the ssh module, along with typed metadata (SshKeyInfo), exported constants, documentation, and a dedicated test suite.

Changes:

  • Introduces SshKey class implementation and wires it into module initialization.
  • Adds SshKeyInfo typed hash plus key-type/file-format/hash-type constants to Qore::Ssh.
  • Adds new documentation page and a comprehensive SshKey QUnit test suite.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/QC_SshKey.qpp New SshKey class wrapping libssh PKI for key lifecycle operations.
src/ssh.qpp Registers SshKeyInfo, constants, and initializes/exports the new system class.
src/ssh-module.h Exposes new typed-hash and class IDs for the SshKey integration.
test/SshKey.qtest New test coverage for generation, import/export roundtrips, inspection, comparison, and error handling.
docs/ssh-key-management.doxygen.tmpl New end-user documentation page for the SshKey API.
docs/typed-contracts.doxygen.tmpl Adds SshKeyInfo to the typed-hash index.
docs/mainpage.doxygen.tmpl Links the new key-management docs and class reference from the main documentation page.
CMakeLists.txt Includes the new source and documentation template in the build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/QC_SshKey.qpp
Comment thread src/QC_SshKey.qpp Outdated
Comment thread src/ssh.qpp Outdated
Comment thread docs/ssh-key-management.doxygen.tmpl Outdated
Comment thread test/SshKey.qtest
Comment thread src/QC_SshKey.qpp
- Add null-pointer check after ssh_pki_export_privkey_to_pubkey()
- Use enum constants for default parameter values instead of literals
- Fix SshKeyInfo.fingerprint_sha256 doc: OpenSSH-style base64, not hex
- Fix auth integration example to use single .pub file, not authorized_keys
- Add up-front validation of bits parameter in generate() for ECDSA
  curve/bits mismatch and RSA minimum size

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@davidnich davidnich enabled auto-merge April 9, 2026 05:27
@davidnich davidnich merged commit 3083706 into develop Apr 9, 2026
1 check passed
@davidnich davidnich deleted the feature/ssh_key_management branch April 9, 2026 05:29
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