Small program for testing the validity of certificates and trust stores.
Either build "normally":
./mvnw packageor do a native build (that needs a GraalVM JDK)
./mvnw package -Pnativejava SSLPoke [target-hostname] [port]sslpoke [target-hostname] [port]If the server certificate is trusted by the client-truststore it will print,
Successfully connectedOtherwise, it will print an exception like this.
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targetThe same options can be passed to the Java program or the native program.
For example:
- the path to a trust store
-Djavax.net.ssl.trustStore=[client-truststore-path]
- enabling some debugging output
-Djavax.net.debug=ssl:handshake
- proxy settings etc...
This class or similar ones are a bit everywhere, I couldn't find which one was the first one. Possibly, from this file on the Atlassian website.