SSL HttpsUrlConnection

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 HttpsUrlConnection
SSL 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
ssl client - JSP-Servlet
ssl client  How do you write SSL Client? Take example of SSL Socket Client
Advertisements
SSL Authentication - JSP-Servlet
SSL Authentication  With the help of a sample code describe the use of SSL Authentication of java clients
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 page
SSL 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
Version of tmporb>tmporb-ssl dependency
List of Version of tmporb>tmporb-ssl dependency
ModuleNotFoundError: No module named 'micropython-ssl'
ModuleNotFoundError: No module named 'micropython-ssl'  Hi, My... named 'micropython-ssl' How to remove the ModuleNotFoundError: No module named 'micropython-ssl' error? Thanks   Hi, In your python
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-scanner'
ModuleNotFoundError: No module named 'ssl-scanner'  Hi, My Python... 'ssl-scanner' How to remove the ModuleNotFoundError: No module named 'ssl-scanner' error? Thanks   Hi, In your python environment
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
Version of activemq>activemq-transport-ssl dependency
List of Version of activemq>activemq-transport-ssl dependency
Version of mule>mule-ssl-provider dependency
List of Version of mule>mule-ssl-provider dependency
Version of ca.juliusdavies>not-yet-commons-ssl dependency
List of Version of ca.juliusdavies>not-yet-commons-ssl dependency
Version of com.cloudhopper>ch-commons-ssl dependency
List of Version of com.cloudhopper>ch-commons-ssl dependency
Version of com.floragunn>search-guard-ssl dependency
List of Version of com.floragunn>search-guard-ssl dependency
Version of com.intersult>ssl-maven-plugin dependency
List of Version of com.intersult>ssl-maven-plugin dependency
ModuleNotFoundError: No module named 'rc-ssl-logtools'
ModuleNotFoundError: No module named 'rc-ssl-logtools'  Hi, My... named 'rc-ssl-logtools' How to remove the ModuleNotFoundError: No module named 'rc-ssl-logtools' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'scapy-ssl_tls'
ModuleNotFoundError: No module named 'scapy-ssl_tls'  Hi, My... 'scapy-ssl_tls' How to remove the ModuleNotFoundError: No module named 'scapy-ssl_tls' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ssl-opt-out'
ModuleNotFoundError: No module named 'ssl-opt-out'  Hi, My Python... 'ssl-opt-out' How to remove the ModuleNotFoundError: No module named 'ssl-opt-out' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'tapioca-sectigo-api-ssl'
ModuleNotFoundError: No module named 'tapioca-sectigo-api-ssl'  Hi...: No module named 'tapioca-sectigo-api-ssl' How to remove the ModuleNotFoundError: No module named 'tapioca-sectigo-api-ssl' error? Thanks   
ModuleNotFoundError: No module named 'tapioca-sectigo-api-ssl'
ModuleNotFoundError: No module named 'tapioca-sectigo-api-ssl'  Hi...: No module named 'tapioca-sectigo-api-ssl' How to remove the ModuleNotFoundError: No module named 'tapioca-sectigo-api-ssl' error? Thanks   
ModuleNotFoundError: No module named 'tapioca-sectigo-api-ssl'
ModuleNotFoundError: No module named 'tapioca-sectigo-api-ssl'  Hi...: No module named 'tapioca-sectigo-api-ssl' How to remove the ModuleNotFoundError: No module named 'tapioca-sectigo-api-ssl' error? Thanks   
ModuleNotFoundError: No module named 'zopyx.check-ssl-domains'
ModuleNotFoundError: No module named 'zopyx.check-ssl-domains'  Hi...: No module named 'zopyx.check-ssl-domains' How to remove the ModuleNotFoundError: No module named 'zopyx.check-ssl-domains' error? Thanks   
ModuleNotFoundError: No module named 'zopyx.check-ssl-domains'
ModuleNotFoundError: No module named 'zopyx.check-ssl-domains'  Hi...: No module named 'zopyx.check-ssl-domains' How to remove the ModuleNotFoundError: No module named 'zopyx.check-ssl-domains' error? Thanks   
ModuleNotFoundError: No module named 'zopyx.check-ssl-domains'
ModuleNotFoundError: No module named 'zopyx.check-ssl-domains'  Hi...: No module named 'zopyx.check-ssl-domains' How to remove the ModuleNotFoundError: No module named 'zopyx.check-ssl-domains' error? Thanks   
ModuleNotFoundError: No module named 'django-mysql-ssl'
ModuleNotFoundError: No module named 'django-mysql-ssl'  Hi, My... named 'django-mysql-ssl' How to remove the ModuleNotFoundError: No module named 'django-mysql-ssl' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-smtp-ssl'
ModuleNotFoundError: No module named 'django-smtp-ssl'  Hi, My... named 'django-smtp-ssl' How to remove the ModuleNotFoundError: No module named 'django-smtp-ssl' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django-ssl-admin'
ModuleNotFoundError: No module named 'django-ssl-admin'  Hi, My... named 'django-ssl-admin' How to remove the ModuleNotFoundError: No module named 'django-ssl-admin' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-ssl-auth'
ModuleNotFoundError: No module named 'django-ssl-auth'  Hi, My... named 'django-ssl-auth' How to remove the ModuleNotFoundError: No module named 'django-ssl-auth' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django-ssl-client-auth'
ModuleNotFoundError: No module named 'django-ssl-client-auth'  Hi...: No module named 'django-ssl-client-auth' How to remove the ModuleNotFoundError: No module named 'django-ssl-client-auth' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-ssl-redirect'
ModuleNotFoundError: No module named 'django-ssl-redirect'  Hi, My... named 'django-ssl-redirect' How to remove the ModuleNotFoundError: No module named 'django-ssl-redirect' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-ssl-slapper'
ModuleNotFoundError: No module named 'django-ssl-slapper'  Hi, My... named 'django-ssl-slapper' How to remove the ModuleNotFoundError: No module named 'django-ssl-slapper' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'hh-ssl-cert-check'
ModuleNotFoundError: No module named 'hh-ssl-cert-check'  Hi, My... named 'hh-ssl-cert-check' How to remove the ModuleNotFoundError: No module named 'hh-ssl-cert-check' error? Thanks   Hi, In your
Maven Dependency tmporb-ssl >> 1.0
You should include the dependency code given in this page to add Maven Dependency of tmporb >> tmporb-ssl version1.0 in your project
Steps For SSL Implementation/Enabling in Apache Tomcat 6.0
Steps For SSL Implementation/Enabling in Apache Tomcat 6.0   Hi , I am using the NetBeans 6.9 IDE Apache Tomcat 6.0 as Web server Front end jsp-servlet please gives me complete guidance steps ,code for SSL Implementation
Steps For SSL Implementation/Enabling in Apache Tomcat 6.0
Steps For SSL Implementation/Enabling in Apache Tomcat 6.0   Hi , I am using the NetBeans 6.9 IDE Apache Tomcat 6.0 as Web server Front end jsp-servlet please gives me complete guidance steps ,code for SSL Implementation
ssl comunication between a desktop application and a web application
ssl comunication between a desktop application and a web application  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
Maven Repository/Dependency: tmporb | tmporb-ssl
Maven Repository/Dependency of Group ID tmporb and Artifact ID tmporb-ssl. Latest version of tmporb:tmporb-ssl dependencies. # Version Release Date You can read more at: Maven
Maven Repository/Dependency: tmporb | tmporb-ssl
Maven Repository/Dependency of Group ID tmporb and Artifact ID tmporb-ssl. Latest version of tmporb:tmporb-ssl dependencies. # Version Release Date You can read more at: Maven

Ads