Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving protected files does not work #478

Open
SheinEA opened this issue Jun 11, 2024 · 4 comments
Open

Saving protected files does not work #478

SheinEA opened this issue Jun 11, 2024 · 4 comments

Comments

@SheinEA
Copy link

SheinEA commented Jun 11, 2024

The file is password protected, but has areas for editing - saving does not work.
The file is protected by the user's password - deleting this password programmatically does not work.

@SheinEA
Copy link
Author

SheinEA commented Jun 16, 2024

The library does not take into account that when a file is password protected, there are areas that are allowed to be edited. Now there is simply a check for the presence of a password and it is impossible to save the protected file. Even if you know the password, you won't be able to remove it because the checksum doesn't match, because a salt is used and it's not clear what kind of salt it is. It is likely that you also need to password protect the file through this library, and not through the editor. How to bypass password protection in this case, because it breaks the whole process? In earlier versions of the library this was not the case, we saved protected files and put our own protection on top, this was suitable for our process, but now we cannot do this. What to do in such a situation?

@evancekafando
Copy link

Hi

You can load and edit a password protected document. However, you will be required to provide the "password" wihtin the Save() method if you want to save the edited document. Failed to do so, you will encounter a "password protected document" exception or "Incorrect Password Excpetion" if you provide a wrong password.

You can bypass password protection by using Document.RemovePasswordProtection( string password ) method, edit the document, reset password protection by using Document.AddPasswordProtection( EditRestrictions editRestrictions, string password ). But still, you need to provide the right password in RemovePasswordProtection() and Save() methods.

Regarding your last point, as of not being able to remove it because the checksum not matching, you may be using password protected documents that uses Advanced Encryption Standard algorithm for password encrpytion. This has been brought to our attention lately. Later versions of Words (2016 and up) uses AES encryption type. Support for AES password encprypted documents has been implemented recently and should be made available in version 3.1. Could you please attach a sample document with the password used to protect the document so we can run some tests and confirm.

Thank you.
-The Xceed Team

@SheinEA
Copy link
Author

SheinEA commented Jul 5, 2024

Hi

image

test.docx

@evancekafando
Copy link

evancekafando commented Oct 12, 2024

Hello

The issue has been identified and fixed. It will be included in version version 3.1.

Thank you.
The Xceed Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants