Repository navigation
Conversation
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. Remove google.jks, which the library no longer reads.
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.
GoogleUtils#getCertificateTrustStore()falls back to the bundledgoogle.p12when the JDKcacertsfile can't be loaded, for example on Android and in GraalVM native images.GoogleNetHttpTransport.newTrustedTransport()uses it in that case. Before 2.9.0, the bundle was always used.The bundle is a 2013 snapshot of roots. It was re-encoded to PKCS#12 in #1738, and DigiCert Global Root G2 was added in #2582.
Changes
google.p12from https://pki.goog/roots.pem. That's the set of roots Google publishes for clients that connect to Google services: 21 roots, including GTS Root R1–R4. The file keeps the same password and the same PKCS#12 algorithms as before (pbeWithSHA1And40BitRC2-CBCwith a SHA-1 MAC), so it stays loadable on Android and Java 8.google.jks. The library hasn't read it since it switched togoogle.p12in fix: re-encode public keys from google.jks into p12 format for android #1738.BUNDLED_KEYSTOREdocuments the bundle's source. New tests check that the bundle contains only trusted CA certificates, includes the GTS roots, and no longer includes AAA Certificate Services.Compatibility
cacertsfile can be loaded (the common JVM case), behavior is unchanged.NetHttpTransport(platform trust) remains the recommended transport.How the keystore was generated
-J-Dkeystore.pkcs12.legacykeeps the previous PKCS#12 algorithms. Currentkeytooldefaults (AES-256/PBKDF2/HmacSHA256) may not load on older Android versions.keytool, notopenssl pkcs12 -export -nokeys. Java ignores certificates without its trusted-certificate attribute, so anopenssl-built file loads with 0 entries.Testing
mvn test -pl google-api-clienton Java 11. All 224 tests pass, including the newGoogleUtilsTestcases.storage,oauth2,www,datastoreandbigquery.googleapis.comon Java 11 and 26, with both ECDSA and RSA certificate chains. All connections succeeded.