-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feat: implement SHA-512 algorithm to ProtectSheet #1115
Conversation
supports WorkbookProtection and WorksheetProtection
Codecov Report
@@ Coverage Diff @@
## master #1115 +/- ##
==========================================
- Coverage 98.12% 98.00% -0.12%
==========================================
Files 29 29
Lines 18554 18643 +89
==========================================
+ Hits 18206 18271 +65
- Misses 236 258 +22
- Partials 112 114 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR, I've left some comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the test spreadsheet attachment test/Worksheet-Workbook-Protection.xlsx
, just test and assert with XML snippets is enough.
I've add some test case and rewrite follow review comments. |
sorry for my carelessness. I will run |
- Make ProtectSheet support specify multi kind of hash algorithm - Make UnprotectSheet support remove sheet protection with password verification. - Following exported error constants or enumeration has been changed for typo fix: * `ErrDataValidationFormulaLenth` to `ErrDataValidationFormulaLength` * `ErrUnsupportEncryptMechanism` to `ErrUnsupportedEncryptMechanism` * `DataValidationTypeTextLeng` to `DataValidationTypeTextLength`
I made some changes based on your branch. |
implement SHA-512 algorithm to protectSheet and add ValidateSheetProtect
Description
add genISOPasswordHash, which implements SHA-512 algorithm salt hash generation that supports workbookProtection and worksheetProtection.
Motivation and Context
Excel 2007 supports hash password. Since Excel 2013, SHA-512 algorithm are the default method in creating workbook protection and worksheet protection. Although worksheet protection.password works well with
genSheetPasswd
(Excel 2013, 2019 both support), workbook protection only support SHA-512. And next I will implement protectWorkbook.How Has This Been Tested
I had set password to workbook protection and worksheet protection on file
test/Worksheet-Workbook-Protection.xlsx
with Mac Excel 2019.unzip it and read both protection xml lines to create
func TestGenISOPasswordHash
test1 and test2.test3 just run the algorithm twice to test whether hash value match.
Types of changes
Checklist