Skip to content

fix: support non-RSA (EC/EdDSA) private keys in certificate HTTP client - #137

Open
AlexandarNaydenovSAP wants to merge 1 commit into
cap-java:mainfrom
AlexandarNaydenovSAP:fix-ec-private-key-support
Open

AlexandarNaydenovSAP wants to merge 1 commit into
cap-java:mainfrom
AlexandarNaydenovSAP:fix-ec-private-key-support

Conversation

@AlexandarNaydenovSAP

@AlexandarNaydenovSAP AlexandarNaydenovSAP commented Sep 21, 2026 •

Copy link
Copy Markdown

Fixes #136

parsePrivateKey hardcoded KeyFactory.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 via bcpkix-jdk18on), which reads the algorithm from the parsed PrivateKeyInfo and supports RSA/EC/EdDSA. Strict superset — RSA keys still load. Applies to both the encrypted and unencrypted key paths.

Added CertificateHttpClientConfigTest covering EC (P-256) and RSA PKCS#8 keys. mvn clean install passes: 33 tests (31 existing + 2 new). DCO sign-off included.

<revision> left at 0.1.1 — assumed the version is set by your release process; happy to bump. Bug fix, suitable for a patch release.

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>
@AlexandarNaydenovSAP AlexandarNaydenovSAP changed the title fix: support EC private keys in certificate HTTP client fix: support non-RSA (EC/EdDSA) private keys in certificate HTTP client Sep 21, 2026

This branch has not been deployed

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

Private key parsing hardcodes RSA client certificates

1 participant