|
1 | 1 | Java Keystore SSL/HTTPS Test
|
2 | 2 | ====================
|
| 3 | +Java CLI utility to execute outbound HTTPS calls. |
3 | 4 |
|
4 |
| -To use, simply run from the command line: |
| 5 | +##Build |
| 6 | +``` |
| 7 | +javac Test.java |
| 8 | +java Test https://www.google.com |
| 9 | +``` |
5 | 10 |
|
6 |
| -`java Test https://www.google.com` |
| 11 | +##Usage |
| 12 | +``` |
| 13 | +java Test <https://address.server.edu> [timeout] |
| 14 | +``` |
7 | 15 |
|
8 |
| -To compile first and then use, execute: |
| 16 | +##Sample |
9 | 17 |
|
| 18 | +###Successful connection |
10 | 19 | ```
|
11 |
| -javac Test.java |
12 |
| -java Test https://www.google.com |
| 20 | +[INFO] Received host address https://www.google.com |
| 21 | +[INFO] Setting connection timeout to 5 second(s). |
| 22 | +[INFO] Trying to connect to https://www.google.com |
| 23 | +[INFO] Great! It worked. |
| 24 | +``` |
| 25 | + |
| 26 | +###Failed connection |
| 27 | +``` |
| 28 | +[INFO] Received host address https://registry.npmjs.org/sailthru-client |
| 29 | +[INFO] Setting connection timeout to 5 second(s). |
| 30 | +[INFO] Trying to connect to https://registry.npmjs.org/sailthru-client |
| 31 | +[INFO] Could not connect to the host address https://registry.npmjs.org/sailthru-client |
| 32 | +[INFO] The error is: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target |
| 33 | +[INFO] Here are the details: |
| 34 | +[SEVERE] sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target |
| 35 | +Exception in thread "main" java.lang.RuntimeException: 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 |
| 36 | + at Test.main(Test.java:61) |
| 37 | +Caused by: 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 |
| 38 | + at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) |
| 39 | + at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1868) |
| 40 | + at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276) |
| 41 | + at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270) |
| 42 | + at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1338) |
| 43 | + at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:154) |
| 44 | + at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868) |
| 45 | + at sun.security.ssl.Handshaker.process_record(Handshaker.java:804) |
| 46 | + at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:998) |
| 47 | + at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1294) |
| 48 | + at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1321) |
| 49 | + at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1305) |
| 50 | + at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:515) |
| 51 | + at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) |
| 52 | + at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1299) |
| 53 | + at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) |
| 54 | + at Test.main(Test.java:45) |
| 55 | +Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target |
| 56 | + at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385) |
| 57 | + at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292) |
| 58 | + at sun.security.validator.Validator.validate(Validator.java:260) |
| 59 | + at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:326) |
| 60 | + at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231) |
| 61 | + at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:126) |
| 62 | + at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1320) |
| 63 | + ... 12 more |
| 64 | +Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target |
| 65 | + at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:196) |
| 66 | + at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268) |
| 67 | + at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380) |
| 68 | + ... 18 more |
13 | 69 | ```
|
14 | 70 |
|
0 commit comments