Skip to content

fix(gdch): support EC private keys#1896

Open
diegomarquezp wants to merge 24 commits intomainfrom
b/488439640
Open

fix(gdch): support EC private keys#1896
diegomarquezp wants to merge 24 commits intomainfrom
b/488439640

Conversation

@diegomarquezp
Copy link
Contributor

@diegomarquezp diegomarquezp commented Mar 4, 2026

Context: b/488439640

Implementation originally proposed in b/431924643#comment9

The primary objective is to enable support for Elliptic Curve (EC) keys and non-URI audience formats, aligning the Java SDK with the behavior of the Python and Go implementations. Additionally, the GDCH key creation tool creates EC keys only, meaning the GDCH implementation was not following the convention.

Key Changes

  • Algorithm Support: Updated the credential signing process to use the ES256 (ECDSA) algorithm, which is the required standard for GDCH service accounts.
  • Audience Flexibility: Changed the apiAudience field from a URI to a String to accommodate "magic" non-URI strings (e.g., specific administrative audiences) required by certain GDCH services.
  • OAuth2Utils Refactoring: Enhanced privateKeyFromPkcs8 to accept an algorithm parameter, allowing the library to parse EC keys instead of defaulting exclusively to RSA.
  • Test fixes: Fixes in a couple of test files as per Sonarqube analysis.

Testing

  • Updated GdchCredentialsTest to include test cases for EC key parsing and token signing.

@product-auto-label product-auto-label bot added the size: l Pull request size is large. label Mar 4, 2026
@diegomarquezp diegomarquezp marked this pull request as ready for review March 9, 2026 21:36
@diegomarquezp diegomarquezp requested review from a team as code owners March 9, 2026 21:36
@diegomarquezp diegomarquezp requested a review from a team as a code owner March 10, 2026 21:22
@diegomarquezp diegomarquezp changed the title feat(gdch): support EC private keys fix(gdch): support EC private keys Mar 10, 2026
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant