Thrift C++ client and Java server two way SSL - java

I am trying to setup a two way SSL connection in between thrift C++ client and thrift Java server. Since I am new to thrift and client server connections, can someone help me with it?
Currently the part I am stuck at is that I am generating the .pem files for the key and certificate. I can use them directly for the thrift C++ client but how can I use it for in thrift Java server? As far as I know the thrift Java server supports the .jks format keystore and trust stores along with the password/key.
It will be great if someone who already have done something like that can provide me a sample working implementation for thrift C++ client two way SSL connection with the thrift Java server.

Related

grpc-dotnet backwards compatibility

previously I've used grpc C-core for .net 2.x and it was working fine, with groc running on .net core 2.2 on server side and C#, Java grpc clients, using pem files for TLS.
Now I've noticed that the new grpc-dptnet no longer supports pem files. Does that mean everything breaks? no more backwards compatibility? I was looking forward to use the new worker service in .net core 3 to rewrite my grpc windows service, without the front end knowing it, so front end continues to use pem files for TLS. But it seems to be impossible now.
So can someone please advice me..
How many types of pfx files are there? client pfx, server pfx? or just one client pfx?
How does Java grpc client make use of the pfx file to connect to grpc server, esp when server is done in grpc-dotnet and not the C core grpc.
is there a difference between the pfx cert used by IIS and the one used by grpc server? will it cause a conflict if client side pfx is used on IIS with developer SSL cert.. for the case when asp.net web appp is also running grpc service.. esp when on the same port.. then what would happen?
How do I detect disconnect for grpc? previously with grpc-C-core, I would call Connect first, then wait for connection change status.. now with httpClient, I don't think this is possible.. or am I wrong?
I'm finding the new grpc-dotnet far more confusing and difficult to understand than the original grpc C core for .net. At least that was clear how to config ports, certs (generating pem files using openssl was very easy and all that matters was the CN field). Now with the pfx file format, I'm really confused.. so please bear with me if I sound stupid..

Communicating between Java SSLSocket and HTML5

Just a quick question, can I use SSL in html5 with websockets to communicate with my java server that is using SSLSockets?
I have been trying to connect using another java client using ssl sockets, which works, but I have not tried to do it through html5. Is it even possible?
For the record, I am using github pages to host my server, and I have a custom domain provided by Namecheap and an SSL certificate from Comodo.
Is it even possible to communicate between java and html5 using SSL?
WebSockets are not the same as "normal" TCP sockets but instead a protocol layer on top of TCP. And thus WebSockets over SSL can not communicate directly with SSLSockets. To communicate with WebSockets (with or without SSL) you would need a library implementing the WebSocket protocol.

Porting java sockets client to HTML5 socket.io

I have a multi-player game that uses Java sockets, the server is a standard Java application and the client is a Java applet that runs in the web-browser.
Now since last Java's update (Java 7 update 51) all applets require code signing, so I would like to move way from the applet and rewrite the client in HTML5.
I've been looking into the socket.io and it seems quite easy, but I can't find any information on how to implement it into my server.
I would like to keep the server in Java, because it will be a lot of work to port it, so is there any libs that I could use on my server to make the communication possible between a java sockets server and a socket.io client, or what is the best approach? do I really need to port the entirely server?
Thanks.
The html5 WebSocket on which socket.io works is not equal to a "normal" C or Java socket. It implements its own protocol over TCP which includes handshakes and other stuff. To port your server you have to use a library maybe this helps you.
For more information on the WebSocket protocol see here.

Subscribe/Publish messages to/from SocketIO/nodejs server from Java application?

Having a NodeJS + SocketIO server in javascript. Are there options to have a Java application to connect to that NodeJS/SocketIO server so that it can publish and subscribe messages?
I made something similar recently for teaching (node.js server, java client in publish/subscribe).
Actually, you should consider Faye : http://faye.jcoglan.com/
You can attach a websocket and/or bayeux server in a node.js instance using faye.
You can then connect any client that implement one or both of these protocol.
I successfully used it in the past for a lab with students in which a server is node.js publishing information, and a java client subscribe to faye using the cometd library (http://cometd.org/).
Source code of :
this server with faye but also traditional http server is located at : https://github.com/cgravier/WI-UCLab/blob/master/context-server-nodejs/simulateArduino.js
the java client using Cometd : https://github.com/cgravier/WI-UCLab/tree/master/context-client-java (sorry it is a library hell, it is designed for student that I was explicitly told were not familiar with maven (or equivalent), and it is 3h lab... anyway.)
Although the document is in French, I guess the figure at page 4 in https://github.com/cgravier/WI-UCLab/blob/master/lab%20document/context-awareness.pdf is self explanable.
HTH
fafhrd
I have used this one android-websockets which includes both SocketIO and Pure Websockets communication, but did not find it so stable, it had issues connecting to the server but this one socket.io-java-client seems like alright but have not used it.

How do you encrypt data between client and server running in Flash and Java?

We have a multiclient system where the client is written in Flash and the server is written in Java. Currently, communication is done in Flash by usage of flash.net.Socket and the protocol is written in JSON. The server uses a custom port to receive connections and then proceed to talk with each client. As expected, data is sent and received on both fronts as raw bytes, which are then decoded as needed.
We would like to encrypt the communication between clients and server. I have some basic understanding about public/private key encryption, but I do not know what is the best way to exchange keys or what libraries are available (on both languages) to do this.
What would be the best strategy to attack this problem and where should I start looking for libraries/methods to implement this encryption?
No need to reinvent the wheel. Use ssl/tls. There's an as3 ssl implementation that we've used in several commercial projects. Make sure you create a root cert store for the as3 component and populate it with at least the root ca for your server cert. On the server, use java's built in ssl server socket.
Alternatively, you could do away with the custom server, if this is at all possible, and use https, kind of like you would with Ajax in HTML/JavaScript.

Categories