Skip to content

Support stdin for openssl rsa tool#2899

Merged
samuel40791765 merged 4 commits intoaws:mainfrom
samuel40791765:rsa-stdin
Dec 11, 2025
Merged

Support stdin for openssl rsa tool#2899
samuel40791765 merged 4 commits intoaws:mainfrom
samuel40791765:rsa-stdin

Conversation

@samuel40791765
Copy link
Copy Markdown
Contributor

@samuel40791765 samuel40791765 commented Dec 11, 2025

Issues:

Addresses P327135637

Description of changes:

There are users that expect the stdin format when using the openssl rsa tool. I also noticed a number of behavioral issues/differences while working on this and comparing it to Openssl's version.

  1. OpenSSL prioritizes the PKCS#8 SubjectPublicKeyInfo format first, rather than the raw format. This is particularly problematic with stdin, since stdin doesn't have a FILE rewind mechanism. This PR aligns AWS-LC behavior with that.
  2. OpenSSL does not fallback to the raw format, but exposes it through a RSAPublicKey_in flag. Our fallback here isn't really an issue though, but I left a TODO to implement RSAPublicKey_in. We haven't noticed any actual consumption of such yet. Implemented RSAPublicKey_in as a no-op.
  3. OpenSSL does not support reading the RSAPrivateKey format via the CLI. It's unclear whether this is actually needed in our code. I'm hesitant to remove it though, but I've left some notes to clean this up. OpenSSL's PKCS8 parser falls back to PKCS1 if unsuccessful. We have to do so manually.

Call-outs:

N/A

Testing:

New RSA comparison test

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.

@samuel40791765 samuel40791765 requested a review from a team as a code owner December 11, 2025 02:14
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 11, 2025

Codecov Report

❌ Patch coverage is 44.68085% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.26%. Comparing base (04b2db3) to head (24e313c).

Files with missing lines Patch % Lines
tool-openssl/rsa_test.cc 4.00% 24 Missing ⚠️
tool-openssl/rsa.cc 90.90% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2899   +/-   ##
=======================================
  Coverage   78.26%   78.26%           
=======================================
  Files         683      683           
  Lines      117604   117625   +21     
  Branches    16515    16514    -1     
=======================================
+ Hits        92042    92060   +18     
- Misses      24675    24678    +3     
  Partials      887      887           

☔ 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.

justsmth
justsmth previously approved these changes Dec 11, 2025
justsmth
justsmth previously approved these changes Dec 11, 2025
skmcgrail
skmcgrail previously approved these changes Dec 11, 2025
justsmth
justsmth previously approved these changes Dec 11, 2025
@samuel40791765 samuel40791765 enabled auto-merge (squash) December 11, 2025 20:50
@samuel40791765 samuel40791765 merged commit 2f0f555 into aws:main Dec 11, 2025
397 of 403 checks passed
@samuel40791765 samuel40791765 deleted the rsa-stdin branch December 11, 2025 23:14
samuel40791765 added a commit that referenced this pull request Dec 12, 2025
Fix CI failure in #2899

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.
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.

4 participants