开发者

Sending sensitive data from server to server via client

开发者 https://www.devze.com 2022-12-20 11:21 出处:网络
I have situation where I need to authenticate a client across multiple web services.Basically each开发者_Go百科 service needs to identify the client and know a few other small pieces of information ab

I have situation where I need to authenticate a client across multiple web services. Basically each开发者_Go百科 service needs to identify the client and know a few other small pieces of information about the client.

The way I have it working now is that the needed identifying information is stored in a session table in a database by the authenticating web server. The web server hands the client an string, which IDs the database entry and gets passed to the other web services. The web services then use this string to pull the needed information about the client from the database entry.

It has occurred to me that it might be possible to give the client an encrypted blob that contains the user ID and other needed information, which is rather small, and avoid using the database for this completely. The client would just pass around the blob (like the string in the previous paragraph) without needing to know what it contains, and only the web services would know how to decrypt it.

This should eliminate the need for the database to store the session information and would make the whole process a good bit simpler. With the database you have to worry about cleaning up old sessions and timeouts and so on.

So my question: is passing around sensitive data from service to service via client considered safe and acceptable? Is it possible to do this in a way that would eliminate worry about the client tampering with the data? What encryption algorithms would be good to use? I'm using .Net - specific classes would be quite helpful.


That seems like a reasonable approach to simplify your app, but remember that if you use the client to store identifying data, you'll always be vulnerable to session hijacking attacks.

In other words, no matter how well you encrypt the blob, someone else can take the user's browser data and copy it, and impersonate the user. The ASP.Net session cookie is always vulnerable to this too, btw.

The only way to be completely secure is to use SSL.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号