Fix import of certificates with ECC private keys#5400
Open
0xb8000 wants to merge 1 commit intoNetflix:mainfrom
Open
Fix import of certificates with ECC private keys#54000xb8000 wants to merge 1 commit intoNetflix:mainfrom
0xb8000 wants to merge 1 commit intoNetflix:mainfrom
Conversation
The upload form's frontend validation regex only accepted PKCS8
("BEGIN PRIVATE KEY") and traditional RSA ("BEGIN RSA PRIVATE KEY")
formats, rejecting EC private keys ("BEGIN EC PRIVATE KEY") and
keys prefixed with EC PARAMETERS (as produced by openssl ecparam
-genkey).
Changes:
- Update ng-pattern in upload.tpl.html to accept EC PRIVATE KEY
format, with optional EC PARAMETERS prefix
- Add defensive stripping of EC PARAMETERS block in
parse_private_key() for compatibility with older cryptography
versions
- Add test for parsing EC keys with EC PARAMETERS prefix
Closes Netflix#5058
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jmcrawford45
approved these changes
Apr 8, 2026
| private_key = re.sub( | ||
| r"-----BEGIN EC PARAMETERS-----.*?-----END EC PARAMETERS-----\s*", | ||
| "", | ||
| private_key, |
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.
Summary
ng-patternregex to acceptBEGIN EC PRIVATE KEYformat and keys withEC PARAMETERSprefix (produced byopenssl ecparam -genkey)EC PARAMETERSPEM block inparse_private_key()for backend compatibilityThe frontend regex previously only accepted
BEGIN PRIVATE KEY(PKCS8) andBEGIN RSA PRIVATE KEY(traditional RSA), causing the private key field to show as invalid (red) for EC keys.Closes #5058
Test plan
test_private_key— existing test still passestest_parse_ec_private_key_with_parameters— new test verifies EC key with EC PARAMETERS prefix is parsedopenssl ecparam -genkey -name secp384r1🤖 Generated with Claude Code