密码保护 Open XML 文字处理文档 [英] Password protect Open XML Wordprocessing Document

查看:56
本文介绍了密码保护 Open XML 文字处理文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为 Open XML 文字处理文档添加基本密码保护.我可以使用 COM 接口,当我有大量文档要处理时,它非常;或者我可以将数据直接放在 下的 docx 文件中,速度非常快.但是,查看加密密码的要求似乎需要数小时的编程时间.有没有人已经编码了这个算法?我正在用 C# 编码.

I need to add basic password protection to an Open XML Wordprocessing document. I can either use the COM interface, which is very slow when I have a large number of documents to process; or I can put the data directly in the docx file under <w:settings> <w:documentProtection> which is very fast. However, looking at the requirements to encrypt the password looks like it will take hours of programming. Does anyone have this algorithm already coded? I'm coding in C#.

推荐答案

我有类似 @Brij 的东西,希望得到密码哈希的算法.后来我在MSDN论坛上发现了一些不完整的代码,也发现Word 2007密码保护很容易绕过.所以现在我只是把一个随机的散列和盐放进去,所以没有人,包括我,知道实际的密码.这足以防止意外更改;鉴于不可能防止故意更改,我不会让它变得更安全.

I had something similar to @Brij and was hoping to get the algorithm for the password hash. I subsequently found some incomplete code on the MSDN forum, and also discovered that the Word 2007 password protection is very easily got around. So for now I'm just putting a random hash and salt in so no one, including me, knows the actual password. That's enough effort to prevent accidental changing; and given it's impossible to prevent intentional changing, I'm not going to make it any more secure.

这篇关于密码保护 Open XML 文字处理文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆