Enabling ssl connection in Spring-boot - java

I'm using a spring boot application like a bridge between an Angular application and a Java server. The spring booT app is at the same time a server for the angular app and a client for the java server.
I need to create a Secure Socket Layer (SSL) connection.
My problem is that I don't know how to create an SSL connection between spring-boot app (like a client) and the Java server.

I have done similar things before. You need to:
Create and make the Server side use ssl certificate (like here)
Install the public key of the ssl certificate (you can download the public key part using a browser and clicking the lock icon; to do this, just have a dummy api and call it) in a keystore (JKS).
Make spring boot application use the JKS (-D parameter in java -jar call).

Related

2 way SSL authentication failure when calling External web service from java WS client

I need to create a Java based XML web service client which is deployed in IBM WAS server which calls web service hosted by external system. Here 2 way ssl authentication mechanism should be there.
Configuration team has already set up the below things in quality environment of client and web service appservers:
At WAS server in which my web service client exists:
server certificate in the trustStore
client certificate is available in the keystore
At App server in which actual WebService exists:
server certificate in the keyStore
client certificate is available in the trust store
Coding:
we Auto generated classes using WSDL file provided by WS provider.
called the WS method normally like there is no 2 way ssl authentication mechanism in place.
problem: we are getting a connection exception when calling web service method from WS Client.Seems we have trouble with the 2 way ssl mechanism.
Full StackTrace Image as requested:
Assumptions:
we assumed that the entire handshake process of 2 way SSL process happens automatically when the web service call is done normally from the client.
Queries:
Is our assumption correct that entire handshake process happens
automatically here especially client sending its certificate ?
Do we need to specify at code level in java any details of path of
trust Store or KeyStore before calling the web service method to enable client to send its certificate ?
If Yes for Qn 2 do we need to set below properties in code as mentioned in some reference links
before calling WS method in client:
System.setProperty("javax.net.ssl.keyStore", "path/to/your/key");
System.setProperty("javax.net.ssl.keyStorePassword", "your-keystore- password");
System.setProperty("javax.net.ssl.trustStore","path/to/your/trust/keystore");
System.setProperty("javax.net.ssl.trustStorePassword", "your-truststore-password");
Any suggestions/advice are highly welcome as we are stuck with this since few days.Its the first time we are working on web services which need 2 way SSL.

JavaScript and Java WebSocket SSL Connection Error

I am writing a browser plugin for a webpage which runs over HTTPS. My backend is in Java, so creating a websocket between javascript and java. But the websocket is giving following error.
WebSocket connection to 'wss://127.0.0.1:8080/' failed: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR
Can someone tell how to remove this error?
In order to use SSL in development machine create auto-signed SSL key a certificate for '127.0.0.1' and put a web server locally with HTTPS support, like Nginx, in front of your Java app, or if you are using a Java based web server look for HTTPS configuration (and WebSockets support as well). This way you'll be able to tests secure transport.

Servlet and TLS

I'm developing a simple web services using Java EE Servlets.
My clients are a simple java apps (no browsers), so I need to secure my communication using TLS (or SSL v3). About Application server, I'm using Glassfish v3.
For example, I need to transfer some data from client to server within a HTTP Post Request into a secure connection.
There are some external libraries, server configurations or tutorial that can I use?
On the server side you must somehow expose your servlets via HTTPS. If you are using tomcat, check out SSL Configuration HOW-TO. If you have an Apache web server in front, see: Apache SSL/TLS Encryption.
On the client side ssl and https support is built into JDK, just call any https://... address using URLConnection. However remember that the certificate your server uses must be trusted - either confirmed by some authority or added manually on the client. Self-signed certificates by default won't be accepted.

How to Connect to a web service (SSL enabled and proxy interface)

There is a web service running on tomcat on a server. It is built on Java Servlet. It is listening others to call itself on a SSL enabled http port. so its web service adreess looks
like: https://172.29.12.12/axis/services/XYZClient?wsdl
On the other hand I want to connect the web service above from a windows application which is built on .NET frame work.
Finally, when I want to connect the web service from my computer; I get some specific erros;
Firstly I get; Proxy authentication error; then I added some new line to my code;
Dim cr As System.Net.NetworkCredential = New System.Net.NetworkCredential("xname", "xsurname", "xdomainname")
Dim myProxy As New WebProxy("http://mar.xxxyyy.com", True)
myProxy.Credentials = cr
Secondly, after this modifications It says that bad request.
I did not get over this error.
Moreover I did try to connect the web server on the same computer. I copied my executable program to the computer where the web service runs. The error was like;
The underlying connection was closed:
Could not establish trust relationship
for SSL/TLS secure channel
PS: When I try to connect to web service by using Internet Explorer; I see firstly some warnings about accepting an unknown certificate and I click take me to web service an I get there clearly.
I want to know what are the basic elements to connect a web service, could you please tell me the requirements that I have to use on my windows project.
regards bk
This page offers a simple step-by-step guide on building a web service client with C#.NET.
Step 5 on this page shows how to add a certificate to your trusted store and Step 6 is another way to build a very simple web service client in C#.NET.

Client Web Service call over SSL using Apache Axis

I'm using Apache Axis 1.5.1 to code a web service client connecting to a service over SSL. My application is running in Tomcat with SSL configuration setup in JKS. However, when I connect to the server, the connection is failing because the cert from our client is not being sent to the server. Is this something that has to be set in the client through code? Also note that the server does not need any user name or password authentication. With SSL turned off, everything works fine.
Thanks,
Two common approaches here:
http://ws.apache.org/xmlrpc/ssl.html
WebLogic has its own stuff:
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/security/SSL_client.html#wp1029670
As long as you have the certificates configured correctly in your trust store accessible to Tomcat, there are no changes to Apache Axis HTTP code.

Categories