My guess is, that you use a broken Java version, it one where the proper trust store is missing. I’d say first you should try running Gradle with a different Java installation.
I tried jdk8 and jdk11 , two both of this, which clouldn’t worked; and gradle 5.0,gradle 5.6, gradle 7.5.1 , all of this cloudn’t worked, this make me headache…
Gradle version shouldn’t be relevant. This should purely be an issue of the jdk you run Gradle with. You can check it with ./gradlew --version it maybe in a build --scan.