原文:http://technet.microsoft.com/en-us/library/jj923033.aspx


Translated:2013/9/28 by Soda (转载请注明出处)


概览:介绍如何使用Office2013 DocRecrypt工具解除OOXMLOffice Open XML)格式的WordExcel以及PPT文件的密码


适用于:


通过组策略来下发注册表修改,将证书与受密码保护的文档关联起来。证书信息会嵌入到文件头部。如果忘记或遗失了密码,使用DocRecrypt命令行工具和私钥就能解锁这个文档,或是更改为其他的密码。


在这篇文章中

1.概述

2.配置客户端

3.配置管理端

4.如何使用DocRecrypt工具


概述:

用户有各式各样的Word,Excel,PPT加密需求,比如:

  1. 集团预算表

  2. 咨询顾问的客户的敏感数据

  3. 教师的试卷(word格式)防止被篡改

  4. 媒体专业人士或者科研人士要保证自己的研究成果在发表之前不被泄露


起初,如果文档的原始创建者也忘记了密码,或者是离职了。这个文件基本上是放弃恢复的状态。但是如果使用office2013和公司的私钥证书存储生成的托管key,管理员就能解锁改文件,去除密码或者设置一个新密码。作为IT管理员,同时也是公司私钥存储的保管员,可以悄悄的将公钥信息使用组策略注册表推送到每台客户端里。当客户端用户创建了受密码保护的Office2013文档,公钥就会被自动的包含在文件头部,接下来你就能使用Docrecrypt工具去除密码,或者创建新密码。只需要具备以下几点:

1.新的officeDocRecrypt工具

2.包含有嵌入的公钥的office文档

3.权限,和与证书相关联的公私钥


保持私钥安全

此功能并没有规定一套系统的管理与分发私钥的流程,包括私钥如何存储,密码需要破解或重置时需要的权限和认证,文件被处理之后存储在何处。这些决策应该遵循公司的标准和流程。


为了保持这些受密码保护的文件高度安全,我们推荐你和你的公司遵照如下策略:


1.不要将私钥下发到客户端,这是最重要的策略

2.将用来生成托管Key与公钥的证书存储锁起来!(废话

3.确保证书管理角色被分发给多个不同的管理者。(防止一手遮天


如果不能坚定地遵循以上建议,那么这些受密码保护的文件的安全也无法被保证。

你的公司里应该具有完善的ADCS(AD Certificate Service)管理模型以及CA架构策略包括,离线的公钥和证书存储。相关更多信息,请参照:

Implement Role-Based Administration.


证书是如何被定位的

由于大多数私钥证书可能位于IT管理员的电脑上,所以想要知道正确的证书被如何定位也是非常合理的。在证书管理器里(Certificate Manager certmgr.msc)里,office2013 DocRecrypt工具会首先搜索逻辑存储,然后是当前用户存储。在每一种存储里,该工具会首先搜索那些不需要Windows System enforcement Pin(系统强制PIN?)的证书,然后才会去搜索需要PIN的证书


特别注意

只能作用于OFFICE XML文件


保护word/excel/ppt文档的其他途径:请参阅

Protect your document, workbook, or presentation with passwords, permission, and other restrictions. 注意,用户可以独立的应用任何一种保护途径,如果IT管理员移除了密码,其他的保护设置仍然存在。去除密码并不影响其他的保护设置。


有一些因素会影响到你去除文档密码的过程,请参照下面的表格:

Considerations when removing the password on a file

Issue 问题

Advice 建议

File is marked as read-only or hidden.

文件被标记为只读或者隐藏

The Office DocRecrypt tool does not work on files that are marked as read-only or hidden. But, you can remove the setting, decrypt the file, and then set it back to Read-only or Hidden after the search.

DocRecrypt工具并不能作用于那些被标记为只读或隐藏的文件,但是你可以先去掉这些设置,再解除密码,然后再给其加上只读或隐藏的属性

File is stored in multiple places.

文件被存储在多个地点

The Office DocRecrypt tool only removes password protection on the specific instance of the file that you reference. But, you should remove password-protection on files referenced on RAID or other hard disk configurations also.

DocRecrypt工具只能去除你当前指定的实例文件,所以,你也需要移除RAID或是其他种类磁盘配置上文件的密码保护。

File is located in a shared workbook.

文件位于共享工作簿


The Office DocRecrypt tool does not work on co-authored files that contain embedded files.

DocRecrypt工具无法作用于含有嵌入式文档的协作办公文件

File is digitally signed.

文件被数字签名了

Removing the password protection from a digitally signed file doesn't compromise the validity of the digital signature.

从已被数字签名的文件里移除密码保护并不会影响数字签名的有效性

Filename begins with a hyphen (“-“).

文件以「-」开头

If the name of the file that you want to search by using the Office DocRecrypt tool contains a hyphen, enclose the file name in quotation marks.

如果使用DocRecrypt工具处理的文件名字里含有「-」,请用引号括起该文件名

Requestor doesn’t have permissions to open the file.

无权打开该文件

The IT admin determines whether the person who requests that a file be decrypted actually has the authority to view the contents of the file when the password is removed or reassigned. Similarly, if a password-protected file has an access control list associated with it, the decryption process removes the association. You must reinstate it afterward.

IT管理员需要确定请求移除或重设该文档密码的人,是否真正能查看该文件的内容。同理,如果被移除或重设密码的文件含有访问权限控制设置,解密的过程会移除该设置,你需要还原这些访问权限设置

File or destination location is read-only.

文件或目标位置是只读的

Make sure that both the password-protected file and the destination location are read/write.

保证受密码保护的文档以及目标位置是可读写的

Certificate was revoked or is expired.

证书被撤销或过期了

Your IT department must make sure that your private key certificates are valid and up-to-date. Also, be aware that the Office DocRecrypt tool does not check for private key certificate revocation status.

你的IT部门必须确保私钥证书是最新并且有效的。此外,也要注意DocRecrypt工具并不会去检查私钥证书撤销状态。

Password-protected file is located in the cloud.

密码保护的文件位于云端

The file must be copied to a hard disk or a read/write UNC share before it can be decrypted.

被解密的文件必须拷贝到硬盘上,或者可读写的UNC共享位置里。


为密码保护移除措施设置客户端电脑

如果要让你的IT部门可以移除密码保护的Office文档,当在企业内部署OFFICE 2013时,首先要将证书公钥分发下去,并且在客户端电脑上做一些注册表的修改。以下是两条路:


  1. 通过组策略管理模板,这是中大型环境的首选

  2. 或者通过手动的修改客户端注册表,小型环境或单台PC的首选


通过GPO设置多台客户端PC的密码保护

  1. 下载组策略管理模板(下载32位版本,我做实验用64位版本未发现该选项),

Office 2013 Preview Administrative Template files (ADMX/ADML) and Office Customization Tool

  1. 使用本地组策略编辑器打开该模板(如何使用ADMX模板请参照:http://technet.microsoft.com/zh-cn/library/cc709647(v=ws.10).aspx),导航到托管密钥设置,打开用户设置,选择管理模板,Microsoft Office 2013,安全设置,然后托管证书,20个托管密钥已经可以被配置,以托管密钥#n命名

  2. 选择其中一个托管密钥,从右键菜单里选择编辑,会出现托管密钥#N的对话框

  3. 选择已启用,(停用该Key则选择已停用)。

  4. 在「证书哈希」栏,键入证书的唯一ID标识符,即指纹。例如,该证书指纹是9131517191121d94d143117fc126213c1781d21c,则在该栏填入这串数字。数字里可以包含空格,如果你想让它的可读性更高一点:)

  5. 如果有必要,在注释里填入更多详细的关于该证书的细节。这是个可选项

  6. 单击确定

5e164d27gx6D0mvH9b329&690


更多关于管理模板,the Office Customization Tool,组策略,组策略启动脚本,请参阅以下文章:


使用新的注册表选项为单一客户端设置密码保护移除措施


要设置密码保护移除措施,你需要创建一个新的注册表键值来指定受密码保护的文件绑定的公钥证书.

note

 注意:

For specific directions about how to create a registry key, refer to the Help that is available from the Registry Editor (regedit.exe) Help menu.

更多关于如何创建注册表键值,你可以从注册表编辑器(regedit.exe)的帮助菜单里找到更详细的说明。

  1. 打开客户端PC的注册表编辑器,在以下注册表路径里创建一个键值项

Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\15.0 \common\Security\Crypto\EscrowCerts

创建新的键值,或是使用.reg的批处理文件,关于如何使用regedit.exe创建.reg文件,请参阅Creating a .reg File.

在客户端PC上创建键值项

Registry element

注册表元素

Description

描述

Key Name

键值项名称

This must be EscrowCerts.

必须为EscrowCerts

Data Type

数值类型

Key

Key

Parent

父项

Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\15.0\ common\Security\Crypto\

  1. 在第一步创建的键值项中,添加进如下表所示的公钥证书信息。每一个公钥证书单独占用一个条目

添加公钥证书信息

Registry element

Description

Key Name

键值名称

Unique user-defined name that describes the public key certificate. For example, EscrowCert01, EscrowCert02, and so on.

用户自定义的用来描述公钥的唯一名称,例如EscrowCert01,EscrowCert02等

Type

数据类型

STRING

字符串

Value

The hash that is used as the certificate unique identifier, also known as a “thumbprint” in the Windows Certificate dialog box. For example, if your certificate thumbprint is 9131517191121d94d143117fc126213c1781d21c, set this value to that number. This hash can include spaces if you want to make it more readable.

hash值是代表证书的唯一标识符,也就是Windows证书对话框里的「指纹」,如果该证书的指纹是 9131517191121d94d143117fc126213c1781d21c,那么该值就应该设置成这串字符。为了增强可读性,可以在其中加入空格

5e164d27gx6D0mvfwLX55&690


  1. 当注册表条目就位后,将证书推送到客户端电脑上。公钥证书会被存储在windows证书管理器里(certmgr.msc)的证书-当前用户,或者逻辑的,个人存储。

  2. 有关更多的通过组策略讲公钥证书下发至客户端PC,请参照

Distribute Certificates to Client Computers by Using Group Policy.


Important

 重要:

The IT admin must make sure that the certificate that was used for this process is valid and has not expired.

IT管理员必须确保此过程中使用的证书是有效的并且未过期的。


当用户使用密码来保护他们创建的OFFICE 2013 word/PowerPoint/Excel文件时,一个适当的公钥信息会被存储在文件头部,管理员只需要将公钥与私钥配对即可删除或更改该文档的密码保护。


设置包含私钥与DocRecrypt Tool的管理员电脑

IT管理员无需设置注册表里包含与客户端相同的键值项,也无需公钥的拷贝副本,只需要以下两样:

  1. 可用的匹配私钥与证书对

  2. DocRecrypt Tool


设置IT管理员的电脑:

  1. 在证书管理器里使用证书导入向导导入所使用证书的匹配私钥

  2. 下载并安装office DocRecrypt Tool,可以在这里下载到它  Microsoft Download Center.

如果是使用64位的操作系统,OfficeDocRecryptTool会被安装到以下位置:

  • %programfiles(x86)%\Microsoft Office\DOCRECRYPT

如果是使用32位的操作系统,OfficeDocRecryptTool会被安装到以下位置:

  • %programfiles%\Microsoft Office\DOCRECRYPT


就这些,所有这些准备做好后,就能接触或是更改Word/Excel/PowerPoint的保护密码了


使用office DocRecrypt tool

note

注意:

When files are decrypted, they are stored in memory. They are never stored on disk and never stored in a temporary directory.

当文件被解密后,它们会被存在内存当中,而不会存储在硬盘也不会存储在临时目录里。


按照以下指示来从命令行使用该工具,你也可以使用批处理或脚本来使DocRecrypt命令静默运行。

导航到DocRecrypt工具的安装目录打开命令行,按照以下语法来执行:

DocRecrypt  [-p <new_password>] -i <inputfile_or_folder> [-o <outputfile_or_folder>] [-q]

下面的表格描述了每一个开关选项的作用:

Parameter

Description

-p <new_password>

-p <新密码>

(Optional) This is the new password that will be assigned to the input file, or the output file if an output file name is supplied.

(可选的)该选项会给指定的文件加上一个新的密码,或是为移除密码后的输出文件加上一个新的密码(如果-o后指定了输出的文件名的话)

-i <inputfile_or_folder>

-I <输入文件,或输入目录>

This is the file or folder that contains files that are locked because the password is unknown. If you specify a folder, the Office DocRecrypt tool will ignore any files that are not Office Open XML format.

该选项后面是指定需要移除密码的文件名,如果你指定了一个文件夹,该工具会自动忽略该文件夹里所有不是Office Open XML格式的文件

-o <outputfile_or_folder>

-o <输出文件名或输出的文件夹>

(Optional) This is the name of a new output file or folder for files that will be created from the input files. Again, any files that are not Office Open XML format are ignored.

(可选的)该选项是指定输出的文件名或是输出的目录名。(-i后接的是目录,那么这里也需要接目录。-i后接的是文件名,这里也必须接文件名)

-q


(Optional) Indicates that you want to run the Office DocRecrypt tool in quiet mode, usually in a script. Quiet mode does not show a UI and it fails if a certificate requires the IT admin to enter a PIN. If your certificate requires a PIN, do not use quiet mode.

(可选的)该选项代表你希望DocRecrypt工具以静默模式运行,通常出现在脚本中。静默模式不会出现UI的提示,如果证书需要管理员输入pin码,则不要使用静默模式,因为它不会提示


举例:

移除文件的密码,使用以下命令:

DocRecrypt -I lockedfile

移除文件密码,并应用一个新密码12345,使用以下命令:

DocRecrypt -p 12345 -I lockedfile

移除文件密码后创建一个新文件并且应用一个新密码12345,使用以下命令:

DocRecrypt -p 12345 -I lockedfile -o newfile


另请参阅:

DocRecrypt tool on the Microsoft Download Center

Content roadmap for Office 2013 identity, authentication, and authorization