Skip to content

test: add key lifecycle and cross-key verification coverage#107

Merged
atoomic merged 1 commit into
cpan-authors:mainfrom
atoomic:koan.atoomic/test-key-lifecycle
Mar 16, 2026
Merged

test: add key lifecycle and cross-key verification coverage#107
atoomic merged 1 commit into
cpan-authors:mainfrom
atoomic:koan.atoomic/test-key-lifecycle

Conversation

@Koan-Bot
Copy link
Copy Markdown
Contributor

@Koan-Bot Koan-Bot commented Mar 15, 2026

What

Add t/key_lifecycle.t with 23 tests covering key lifecycle operations and cross-key verification.

Why

Two areas had no test coverage:

How

Tests cover:

  • Cross-key sign/verify in both directions (returns false, no croak)
  • Key export → import → sign/verify round-trip
  • Full parameter extraction and reconstruction with 2048-bit key
  • Reconstructed key passes check_key(), interops with original
  • Public-only key from params (n, e) — correct is_private(), can verify, cannot sign
  • Bignum tests gated with SKIP block for environments without Crypt::OpenSSL::Bignum

Testing

All 304 tests pass (281 existing + 23 new) on Perl 5.42.0 / OpenSSL 3.6.1.

🤖 Generated with Claude Code


Quality Report

Changes: 1 file changed, 111 insertions(+)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

Add t/key_lifecycle.t with 23 tests covering two previously untested areas:

1. Cross-key verification: sign with key1, verify with key2 should
   return false (not croak). This real-world scenario was never tested.

2. Key parameter round-trip with real 2048-bit keys: extract parameters
   via get_key_parameters(), reconstruct via new_key_from_parameters(),
   then verify sign/verify/encrypt/decrypt interoperability between
   original and reconstructed keys. Previously only tested with tiny
   4-byte keys in bignum.t.

Also tests public-only key construction from parameters (n, e only)
and key export/import/sign/verify lifecycle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@atoomic atoomic marked this pull request as ready for review March 16, 2026 02:41
@atoomic atoomic merged commit 9ad5cbf into cpan-authors:main Mar 16, 2026
81 checks passed
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