SSL HttpsUrlConnection
Hi,
My name is Luciano, I am trying to implement a ssl comunication between a desktop application and a web application. I unable the https on JBoss and I have two files ca.crt and server.crt, I install the server crt on the browser and test the connection, all occour perfectly, But when I try connect using my desktop aplication i get the error:
Exception in thread "main" 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
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1611)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:187)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:181)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1035)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:124)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
I search the solution, but the most of response dont solve my problem, what can I do to solve this problem? The connection code is:
URL page = new URL(url);
HttpsURLConnection connection = (HttpsURLConnection) page
.openConnection();
File trustFile = new File("C:/myteste/truststore");
File keyFile = new File("C:/myteste/keystore");
connection.setDefaultSSLSocketFactory(this.getSSLSocketFactory(
trustFile, "teste", keyFile, "teste"));
View Answers
March 11, 2011 at 3:00 PM
Hi Lusiano,
I am trying to implement a ssl comunication between a desktop application and a web application. can you please share code with me.
Please explain me 'connection.setDefaultSSLSocketFactory(this.getSSLSocketFactory( trustFile, "teste", keyFile, "teste"));' code. what is 'teste'?
Please help me.
thanks and regards
sivjava
March 11, 2011 at 6:14 PM
Teste = Test, I am Brazilian
You don�´t need have a trustManager or KeyManager in code. You can install the certificate in the S.O and initialize the SSLContext with this code:
context.init(null, null, null);
The SSLContext will be use the installed certificate.
Related Tutorials/Questions & Answers:
SSL HttpsUrlConnectionSSL HttpsUrlConnection Hi,
My name is Luciano, I am trying to implement a
ssl comunication between a desktop application and a web application. I... is:
URL page = new URL(url);
HttpsURLConnection connection
Advertisements
ModuleNotFoundError: No module named 'ssl'ModuleNotFoundError: No module named '
ssl' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
ssl'
How to remove the ModuleNotFoundError: No module named '
ssl' error
SSL for login pageSSL for login page I am trying to apply
ssl cert to login page only. Does anyone know how to do this on a tomcat web server
ModuleNotFoundError: No module named 'pope-ssl'ModuleNotFoundError: No module named 'pope-
ssl' Hi,
My Python... 'pope-
ssl'
How to remove the ModuleNotFoundError: No module named 'pope-
ssl... to install padas library.
You can install pope-
ssl python with following
ModuleNotFoundError: No module named 'pope-ssl'ModuleNotFoundError: No module named 'pope-
ssl' Hi,
My Python... 'pope-
ssl'
How to remove the ModuleNotFoundError: No module named 'pope-
ssl... to install padas library.
You can install pope-
ssl python with following
ModuleNotFoundError: No module named 'pycopy-ssl'ModuleNotFoundError: No module named 'pycopy-
ssl' Hi,
My Python... 'pycopy-
ssl'
How to remove the ModuleNotFoundError: No module named 'pycopy-
ssl' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'pycopy-ssl'ModuleNotFoundError: No module named 'pycopy-
ssl' Hi,
My Python... 'pycopy-
ssl'
How to remove the ModuleNotFoundError: No module named 'pycopy-
ssl' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'ssl_api'ModuleNotFoundError: No module named '
ssl_api' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
ssl_api'
How to remove the ModuleNotFoundError: No module named '
ssl_api
ModuleNotFoundError: No module named 'ssl-audit'ModuleNotFoundError: No module named '
ssl-audit' Hi,
My Python... '
ssl-audit'
How to remove the ModuleNotFoundError: No module named '
ssl... have to install padas library.
You can install
ssl-audit python with following
ModuleNotFoundError: No module named 'ssl_expiry'ModuleNotFoundError: No module named '
ssl_expiry' Hi,
My Python... '
ssl_expiry'
How to remove the ModuleNotFoundError: No module named '
ssl... have to install padas library.
You can install
ssl_expiry python
ModuleNotFoundError: No module named 'ssl_sni'ModuleNotFoundError: No module named '
ssl_sni' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
ssl_sni'
How to remove the ModuleNotFoundError: No module named '
ssl_sni
ModuleNotFoundError: No module named 'apyref-ssl'ModuleNotFoundError: No module named 'apyref-
ssl' Hi,
My Python... 'apyref-
ssl'
How to remove the ModuleNotFoundError: No module named 'apyref-
ssl' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'flask-ssl'ModuleNotFoundError: No module named 'flask-
ssl' Hi,
My Python... 'flask-
ssl'
How to remove the ModuleNotFoundError: No module named 'flask-
ssl' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'green-ssl'ModuleNotFoundError: No module named 'green-
ssl' Hi,
My Python... 'green-
ssl'
How to remove the ModuleNotFoundError: No module named 'green-
ssl' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'idna_ssl'ModuleNotFoundError: No module named 'idna_
ssl' Hi,
My Python... 'idna_
ssl'
How to remove the ModuleNotFoundError: No module named 'idna_
ssl... to install padas library.
You can install idna_
ssl python with following
SSL Certificates
SSL Certificates
Secure Sockets Layer or
SSL for short is a protocol. It
was developed by Netscape for transmitting private documents over internet.
SSL....
URLs requiring the
SSL connection starts with https: instead of http