当前位置: 动力学知识库 > 问答 > 编程问答 >

java - How to secure communication in client-server app?

问题描述:

I've got backend running on the tomcat server and client running in the browser. Application is built on Spring 3 MVC + Spring security framework. How to secure the communication ? Is there other option than just to set the server to be accessed only via HTTPS ? I've got no experience with this so it might be a stupid question, but will this affect my application and do I have to set something up in my app, when the server shall communicate with client via GET/POST request via https ?

网友答案:

HTTPS is the (S)ecure form of HTTP, since you have an HTTP client server application I would certainly used HTTPS. All you need is to create an SSL certicate for your website and restrict access to your website to HTTPS only, then you are 99.99% secure. Your certicate can be either commercial from Versign or equivalent or some open source engine. for the clients nothing needs to be done to support HTTPS

网友答案:

It depends somewhat what you mean by "secure." If you want privacy, you must use TLS (SSL) as a transport.

If you're only concerned with authentication, then you have another option: Digest Authentication.

Digest Authentication allows the client (browser, usually) and the server to exchange authentication credentials in a secure manner without securing the entire communication. If you use Digest Authentication, then third parties can still:

  1. See what data the client and server exchange
  2. Insert themselves between the client and server and alter the exchange

What third parties cannot do is spoof the authentication or steal username/passwords in transit.

If that's not secure enough, you need TLS. You do not necessarily have to purchase a certificate. You can use OpenSSL to generate your own. This certificate will not automatically be trusted by browsers, however, so you can't really use it for public sites.

You will need to consult your server documentation for how to set up HTTPS or Digest Authentication, depending on which fits your needs.

网友答案:

Your application should not be affected by switching from HTTP to HTTPS, Tomcat handles this or maybe an Apache in front. It's important to understand, that HTTPS is a server-thing, not an application topic, because the client makes a connection to the server (Tomcat), not to your application. Check out the Tomcat documentation, it's pretty clear about how things work.

And, like the others said: From what you've said it's best to use HTTPS (TLS/SSL). Certificates are a bit frightning at the beginning, but it's worth to invest the time.

分享给朋友:
您可能感兴趣的文章:
随机阅读: