fix(client/tls): correct PEM label and add Ed25519 key support#452
Merged
Conversation
TLSClientAuth marshaled RSA keys as PKCS#1 and ECDSA keys as SEC1, then labeled both PEM blocks as "PRIVATE KEY" — a label conventionally reserved for PKCS#8. The output round-tripped through tls.X509KeyPair only because Go's parser is lenient; stricter consumers would reject it. Switch to a single x509.MarshalPKCS8PrivateKey call, which matches the "PRIVATE KEY" label naturally and transparently supports Ed25519 (previously rejected by the type switch's default branch). Also fix gencerts_test.go: writePKCS1KeyPair wrote PKCS#1 RSA bytes under an "EC PRIVATE KEY" label — same class of latent mislabel. Adds an Ed25519 subtest under TestRuntimeTLSOptions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (33.33%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #452 +/- ##
==========================================
+ Coverage 85.04% 85.06% +0.02%
==========================================
Files 60 60
Lines 3978 3970 -8
==========================================
- Hits 3383 3377 -6
+ Misses 451 449 -2
Partials 144 144 ☔ View full report in Codecov by Sentry. |
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.
TLSClientAuth marshaled RSA keys as PKCS#1 and ECDSA keys as SEC1, then labeled both PEM blocks as "PRIVATE KEY" — a label conventionally reserved for PKCS#8. The output round-tripped through tls.X509KeyPair only because Go's parser is lenient; stricter consumers would reject it.
Switch to a single x509.MarshalPKCS8PrivateKey call, which matches the "PRIVATE KEY" label naturally and transparently supports Ed25519 (previously rejected by the type switch's default branch).
Also fix gencerts_test.go: writePKCS1KeyPair wrote PKCS#1 RSA bytes under an "EC PRIVATE KEY" label — same class of latent mislabel.
Adds an Ed25519 subtest under TestRuntimeTLSOptions.
Change type
Please select: 🆕 New feature or enhancement|🔧 Bug fix'|📃 Documentation update
Short description
Fixes
Full description
Checklist