Skip to content

fix: update bundled trust store to Google's current root certificates - #2636

Merged
blakeli0 merged 1 commit into
mainfrom
fix/update-bundled-truststore
Oct 21, 2026
Merged

blakeli0 merged 1 commit into
mainfrom
fix/update-bundled-truststore

Conversation

@blakeli0

@blakeli0 blakeli0 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

The bundled google.p12 is used by GoogleUtils#getCertificateTrustStore() when the JDK cacerts file can't be loaded, for example on Android or in GraalVM native images. It's a 2013 snapshot:

  • 26 of its 71 roots have expired.
  • It includes roots that root programs have distrusted, such as AAA Certificate Services.
  • It has no Google Trust Services roots. Google APIs validate against it only through GlobalSign cross-certificates that expire on 2028-01-28.

This PR regenerates google.p12 and google.jks from https://pki.goog/roots.pem (21 roots, including GTS Root R1–R4). Both files keep their current password. google.p12 also keeps its legacy PKCS#12 algorithms so it still loads on Android. The library doesn't read google.jks, but some applications (for example, Elasticsearch) load it directly, so it's regenerated rather than removed.

There are no API changes. Behavior is unchanged when the JDK cacerts file can be loaded.

How the keystores were generated:

curl -sSfO https://pki.goog/roots.pem  # sha256 ec989df46c8f4419ef2ee2517cad7619d555e4973f3307be697662aa2497e480
# For each certificate in roots.pem, saved as <cert>.pem:
keytool -J-Dkeystore.pkcs12.legacy -importcert -noprompt -alias <name> -file <cert>.pem \
  -keystore google.p12 -storetype PKCS12 -storepass notasecret
keytool -importcert -noprompt -alias <name> -file <cert>.pem \
  -keystore google.jks -storetype JKS -storepass notasecret

The -J-Dkeystore.pkcs12.legacy flag keeps the legacy PKCS#12 algorithms that older Android versions need. Use keytool rather than openssl pkcs12 -export: Java ignores certificates without its trusted-certificate attribute, so a file built with openssl loads with no entries.

Testing:

  • New unit tests check that the GTS roots are present, AAA Certificate Services is absent, and google.jks matches google.p12.
  • With the new keystore as the only trust store, connections to several *.googleapis.com endpoints succeed on Java 11 and 26.

@blakeli0
blakeli0 requested a review from a team as a code owner October 21, 2026 02:12
@product-auto-label product-auto-label Bot added the size: m Pull request size is medium. label Oct 21, 2026
@blakeli0
blakeli0 force-pushed the fix/update-bundled-truststore branch from 3a32c54 to 2c6e494 Compare October 21, 2026 17:26
GoogleUtils#getCertificateTrustStore falls back to the bundled google.p12
when the JDK cacerts file can't be loaded (for example on Android and in
GraalVM native images). The bundle was a 2013 snapshot: 26 of its 71 roots
had expired, it still included roots that root programs have since removed
or distrusted (such as AAA Certificate Services), and it had no Google Trust
Services roots, so Google APIs only validated through cross-certificates
that expire on 2028-01-28.

Regenerate google.p12 from https://pki.goog/roots.pem, the roots Google
publishes for clients connecting to Google services, keeping the same
password and PKCS#12 algorithms for Android compatibility. Regenerate
google.jks with the same certificates: the library no longer reads it, but
some applications load it directly.
@blakeli0
blakeli0 force-pushed the fix/update-bundled-truststore branch from 2c6e494 to 179033d Compare October 21, 2026 17:39
@blakeli0
blakeli0 requested review from lqiu96 and whowes October 21, 2026 19:38
@blakeli0
blakeli0 merged commit d31b5da into main Oct 21, 2026
22 checks passed
@blakeli0
blakeli0 deleted the fix/update-bundled-truststore branch October 21, 2026 20:55
blakeli0 added a commit to googleapis/google-api-java-client-services that referenced this pull request Oct 22, 2026
google-api-client 2.9.2 regenerates its bundled trust store from
https://pki.goog/roots.pem (googleapis/google-api-java-client#2636),
removing expired and distrusted roots such as AAA Certificate Services.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants