Skip to content

feat: add persistent PQ key storage#73

Merged
Pattermesh merged 1 commit into
kcolbchain:mainfrom
knoal:feat/pq3-keypair-persistence-36
Jun 3, 2026
Merged

feat: add persistent PQ key storage#73
Pattermesh merged 1 commit into
kcolbchain:mainfrom
knoal:feat/pq3-keypair-persistence-36

Conversation

@knoal
Copy link
Copy Markdown
Contributor

@knoal knoal commented May 29, 2026

Closes #36.

Summary

  • add switchboard/pq_keys.py with PQKeyPair.generate/load/save/sign and module-level verify
  • derive stable key_id values from sha256(pk)[:16].hex()
  • persist private keys in a PEM-like envelope using scrypt + chacha20-poly1305
  • write companion .pub files with algorithm and key-id metadata
  • keep the module import-safe without liboqs; only generation/signing/verification depend on PQ runtime support
  • add focused tests for round-trip persistence, wrong-passphrase failure, deterministic key IDs, and delegation behavior

Validation

  • python3 -m compileall switchboard/pq_keys.py tests/test_pq_keys.py
  • python3 -m pytest tests/test_pq_keys.py tests/test_pq.py -v

Notes

  • tests/test_pq_keys.py passes fully in this environment
  • the behavioral tests/test_pq.py cases that require liboqs-python remain skipped here because oqs is not installed; the always-on structural/no-liboqs coverage still passed

@Pattermesh Pattermesh merged commit abd84c3 into kcolbchain:main Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PQ-3] switchboard/pq_keys.py — keypair generate/load/save + key-id derivation

3 participants