Just a quick post in case anyone else runs into the same obscure scenario. Setting up a new Gradle project on my OSX dev machine, the build could not download any files from Maven Central. When trying to establish an SSH connection I was getting:
RSA premaster secret error
A web search didn’t turn up much, making it clear this was not a common issue. The only hits I found where outdated or unusual configurations, whereas I believed I had a pretty vanilla setup.
Long story short, the problem was I had globally set the java.ext.dirs system property to the empty string to prevent another, unrelated (and equally obscure) error in the past. That was too blunt an approach — the JVM at the very least needs $JAVA_HOME/jre/lib/ext to be included in java.ext.dirs to load some core jars, including sunjce_provider.jar which includes implementations of the encryption algorithms required to establish SSL connections. User error on my part, which I paid for with wasted time — I hope this post saves someone from the same mistake!