MichalHecko / SSLPoke

Java tool for testing validity (certificates) of trust stores

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  1. Negative test SSL connection:

    java -jar build/libs/SSLPoke-1.0.jar <server> 443

    you 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
    
  2. Create new empty keystore and add exported certificate from server:

    keytool -import -file certificate.cert -alias certificate -keystore trustStore.keystore
    
  3. 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> 443

    you should get positive answer:

    Successfully connected

About

Java tool for testing validity (certificates) of trust stores

License:Apache License 2.0


Languages

Language:Java 100.0%