我正在开发一个Android项目,它将数据发送到我的Web服务并将它们存储在我的数据库中。 我正在使用HTTP协议连接到我的web服务。 使用JSON作为数据格式。
我向Web服务发送这些数据的数据和HASH(SHA256)。
在将数据存储到数据库之前,我通过使用HASH验证我发送的数据(数据)是否等于Web服务收到的数据。 如果不是,我发送一条错误消息。
有时候HASH的值是不同的,会导致错误消息,并且数据库中没有数据存储
所以我的问题:是否有另一种方法来验证数据在发送操作期间是否未被更改?
I'm working on an Android project which send datas to my Webservice and store them in my Database. I'm using a HTTP protocol to connect to my webservice. Using JSON for data format.
I send to the webservice the datas and the HASH (SHA256) of these datas.
Before storing the datas to the database, I verify by using HASH if what I've sent (datas) equals to what The Webservice received. If not, I send an error message.
Sometimes the values of the HASH are differents which cause an error message, and no datas storing in the database
So my question : Is there a another method to verify if the datas aren't altered during the sending operation?
最满意答案
哈希似乎适用于您的场景,因为您很好地检测到数据修改。
但是哈希可以随数据一起更改,因此这不是针对恶意攻击者的安全措施。 如果您担心安全问题,则可能对WS-Security感兴趣。
实质上,您必须使用加密通道(HTTPS)或在消息上签名。
The hash seems to work for your scenario, since you detect data modifications pretty well.
But a hash can be altered along with the data, so this is not a security measure against malicious attackers. If you're concerned about security, you might be interested in WS-Security.
Essentially, you must either use an encrypted channel (HTTPS) or sign your message.
发布者:admin,转转请注明出处:http://www.yc00.com/web/1690548371a367823.html
评论列表(0条)