Skip to content

Conversation

kingstjo
Copy link
Contributor

Issues:

Addresses #CryptoAlg-3382

Description of changes:

This PR implements a minimal EC CLI tool for AWS-LC to provide EC key processing capabilities similar to OpenSSL's openssl ec command. The tool supports essential EC key operations including format conversion between PEM/DER for both private and public keys, using AWS-LC's native EC APIs for proper key handling.

Testing:

  • Unit tests: 13 comprehensive test cases in ec_test.cc covering:
    • Format conversion (PEM ↔ DER) for both private and public keys
    • Round-trip validation ensuring data integrity
    • Error handling for invalid inputs and file operations
    • Cross-compatibility with OpenSSL when environment variables are set
  • Manual verification: Tested format conversion and OpenSSL interoperability during development

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

- Create ec.cc with EC-specific key processing
- Support options: -inform, -in, -pubout, -out, -outform
- Handle PEM/DER format conversion for EC private/public keys
- Use EC-specific AWS-LC APIs for proper key handling
- Integrate ecTool into build system (CMakeLists.txt, internal.h, tool.cc)
- Tested format conversion and OpenSSL interoperability

Assisted by Amazon Q
- Create ec_test.cc with cross-compatibility testing
- Test all minimal EC options: -inform, -in, -pubout, -out, -outform
- Include format conversion tests (PEM/DER) and round-trip validation
- Add error handling tests for invalid inputs/outputs
- Support conditional OpenSSL cross-compatibility when env vars set
- Use BIO pattern consistent with other AWS-LC tool tests
- All 13 tests pass including OpenSSL interoperability validation

Assisted by Amazon Q
@kingstjo kingstjo requested a review from a team as a code owner August 25, 2025 21:55
@codecov-commenter
Copy link

codecov-commenter commented Aug 25, 2025

Codecov Report

❌ Patch coverage is 72.43590% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.82%. Comparing base (1d883a3) to head (1981669).

Files with missing lines Patch % Lines
tool-openssl/ec_test.cc 64.89% 33 Missing ⚠️
tool-openssl/ec.cc 83.87% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2640      +/-   ##
==========================================
+ Coverage   78.81%   78.82%   +0.01%     
==========================================
  Files         667      669       +2     
  Lines      113982   114138     +156     
  Branches    16028    16040      +12     
==========================================
+ Hits        89835    89972     +137     
- Misses      23374    23391      +17     
- Partials      773      775       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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