如何防止外部xml文件修改? [英] how to prevent external xml file modification?

查看:192
本文介绍了如何防止外部xml文件修改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个处理xml文件来存储一些数据的小型库,我只需要通过我在库中提供的方法来处理这些数据。



我知道xml对于人和机器都是可读的,如果有人真的想要修改xml文件,他可能会这样做,所以...你们有没有一个想法可以工作?你可以在其中存储更多的信息,比如内容的散列(在插入散列之前)。

p>

当你重新加载这个文件时,你可以检查哈希。如果它与您的文件的当前散列不匹配,那么它已被修改。


I'm coding a little library which will handle xml files to store some data, and I need this data to be handled only by the methods I provide in my library.

I know that xml is readable for both human and machine, and that if somebody really wants to modify the xml file he'll probably do it, so... do any of you have an idea that could work?

解决方案

You can store more information in it, such as a hash of the content (before the hash was inserted of course).

When you will reload this file, you can check the hash. If it doesn't match with the current hash of your file, well it has been modified.

这篇关于如何防止外部xml文件修改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
Java开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆