Clarification on Protect Method

Hi,

I used the following code: to protect the document:

doc.Protect(Aspose.Word.ProtectionType.AllowOnlyComments);

It worked fine. The questions I have are:

1) What is the password assigned to the document? When I opened it Word and tried to unprotect it, Word wanted a password and did not accept .

2) Does the Unprotect method clear the protection from just the current document? Any document created through Aspose.Word?

I am looking to generate documents that nobody can change.

Thanks,

Brad

Hi,

When you protect a document using Aspose.Word, it assigns a random password hash and you cannot unprotect it in MS Word. This is by design. The reason is that the actual password is not stored in the file, but only a hash is stored and we don’t know the algorithm how to encrypt a password.

Aspose.Word can unprotect any document regardless of a password and it will clear the password.

I’ve made some changes in Aspose.Word 1.7.9 to protecting/unprotecting scheme. This change fixes the issue where Aspose.Word Protect method always assigns a random password, in the new hotfix it will only assign a password if there is no existing password in the document.

Roman,

I am trying to create Word documents that another user can NOT unprotect under any circumstance. It seems the the Aspose Work component would work fine, since it assigned the random password, but my concern lies with the fact that you say it can unprotect ANY document. How is this really protecting the document if someone can just unprotect it using Aspose? Is there any was to prevent the document from ANY future changes?

Thanks,

Brad

MS Word document protection is not absolute, there is plenty of hacking tools to remove document protection available, so Aspose.Word is not alone in being able to open and reset protection.