SSLPoke
SSLPoke copied to clipboard
Java tool for testing validity (certificates) of trust stores
SSLPoke
Test of java SSL / keystore / cert setup. Came from https://confluence.atlassian.com/download/attachments/117455/SSLPoke.java
Use Gradle to build standalone JAR file:
./gradlew clean jar
Usage:
-
Negative test SSL connection:
java -jar build/libs/SSLPoke-1.0.jar <server> 443you should get 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 target -
Create new empty keystore and add exported certificate from server:
keytool -import -file certificate.cert -alias certificate -keystore trustStore.keystore -
Do the test again and specify trustStore with password:
java -Djavax.net.ssl.trustStore=trustStore.keystore -Djavax.net.ssl.trustStorePassword=changeit -jar build/libs/SSLPoke-1.0.jar <server> 443you should get positive answer:
Successfully connected