Skip to content

Java tool for testing validity (certificates) of trust stores

License

Notifications You must be signed in to change notification settings

markhann/SSLPoke

 
 

Repository files navigation

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%