test: add key lifecycle and cross-key verification coverage#107
Merged
atoomic merged 1 commit intoMar 16, 2026
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add
t/key_lifecycle.twith 23 tests covering key lifecycle operations and cross-key verification.Why
Two areas had no test coverage:
get_key_parameters()→new_key_from_parameters()→ sign/verify/encrypt/decrypt. Previously only tested with 4-byte keys in bignum.t, missing coverage for large BIGNUM handling (the source of multiple memory leak fixes in PRs fix: multiple OpenSSL 3.x memory leaks #75, fix: free OpenSSL 3.x resources in _new_key_from_parameters() #90).How
Tests cover:
check_key(), interops with originalis_private(), can verify, cannot signCrypt::OpenSSL::BignumTesting
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