问题
I was trying to send a post request on a url from server then it showed following errors
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
Then I found about InstallCert.java( https://www.cs.ucsb.edu/~pconrad/cs56/examples/ldap/SimpleQuery/InstallCert.java ) which will allow my host and port to send the request. But when I was trying to run it on server it also showed some errors.
ubuntu@ip-172-31-28-14:/var/lib/tomcat7/webapps$ java InstallCert 52.39.134.231:8080
Loading KeyStore /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/security/cacerts...
Opening connection to 52.39.134.231:8080...
Starting SSL handshake...
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:671)
at sun.security.ssl.InputRecord.read(InputRecord.java:504)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:946)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1344)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1371)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1355)
at InstallCert.main(InstallCert.java:91)
Could not obtain server certificate chain
And now I don't know what to do to send my request.
来源:https://stackoverflow.com/questions/37814861/issue-when-using-installcert-for-sslcertification