fix: support non-RSA (EC/EdDSA) private keys in certificate HTTP client - #137
Open
AlexandarNaydenovSAP wants to merge 1 commit into
Open
AlexandarNaydenovSAP wants to merge 1 commit into
AlexandarNaydenovSAP wants to merge 1 commit into
Conversation
parsePrivateKey hardcoded KeyFactory.getInstance RSA, so any non-RSA client key failed to load and the application aborted on startup. Bindings whose certificates are issued by non-BTP providers (e.g. the Zero Trust Identity Service) use EC keys, which the ALS ingestion API accepts over mTLS but this client could not parse. Use BouncyCastle's algorithm-agnostic JcaPEMKeyConverter, which reads the algorithm from the parsed PrivateKeyInfo and supports RSA/EC/EdDSA. Add a test covering both EC and RSA PKCS#8 keys. Signed-off-by: Alexandar Naydenov <alexandar.naydenov@sap.com>
This branch has not been deployed
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.
Fixes #136
parsePrivateKeyhardcodedKeyFactory.getInstance("RSA"), so non-RSA client keys failed to load and the app aborted on startup (InvalidKeyException: Invalid RSA private key). Certificates issued by non-BTP providers (e.g. the Zero Trust Identity Service) use EC keys — accepted by the ALS ingestion API over mTLS, but unparseable by the plugin.Fix: use BouncyCastle's algorithm-agnostic
JcaPEMKeyConverter(already available viabcpkix-jdk18on), which reads the algorithm from the parsedPrivateKeyInfoand supports RSA/EC/EdDSA. Strict superset — RSA keys still load. Applies to both the encrypted and unencrypted key paths.Added
CertificateHttpClientConfigTestcovering EC (P-256) and RSA PKCS#8 keys.mvn clean installpasses: 33 tests (31 existing + 2 new). DCO sign-off included.<revision>left at0.1.1— assumed the version is set by your release process; happy to bump. Bug fix, suitable for a patch release.