From 6d67347311923dbe3975cfa197649f5856c00723 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Fri, 23 Feb 2018 19:49:45 +0100 Subject: Move OOXML password definitions to struct ScOoxPasswordHash, tdf#104250 prep Change-Id: I595d5ae8db6f739900afdfdde1e36b0a0b1d2179 --- sc/inc/tabprotection.hxx | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'sc/inc') diff --git a/sc/inc/tabprotection.hxx b/sc/inc/tabprotection.hxx index 3f2fc7b4e189..0b3a3ed62105 100644 --- a/sc/inc/tabprotection.hxx +++ b/sc/inc/tabprotection.hxx @@ -39,6 +39,18 @@ enum ScPasswordHash PASSHASH_UNSPECIFIED }; +/// OOXML password definitions: algorithmName, hashValue, saltValue, spinCount +struct ScOoxPasswordHash +{ + OUString maAlgorithmName; /// "SHA-512", ... + OUString maHashValue; /// base64 encoded hash value + OUString maSaltValue; /// base64 encoded salt value + sal_uInt32 mnSpinCount; /// spin count, iteration runs + + ScOoxPasswordHash() : mnSpinCount(0) {} + bool hasPassword() const { return !maHashValue.isEmpty(); } +}; + namespace ScPassHashHelper { /** Check for the compatibility of all password hashes. If there is at @@ -117,13 +129,9 @@ struct ScEnhancedProtection OUString maTitle; ::std::vector< sal_uInt8 > maSecurityDescriptor; // imported as raw BIFF data OUString maSecurityDescriptorXML; // imported from OOXML - // OOXML password definitions - OUString maAlgorithmName; - OUString maHashValue; - OUString maSaltValue; - sal_uInt32 mnSpinCount; + ScOoxPasswordHash maPasswordHash; - ScEnhancedProtection() : mnAreserved(0), mnPasswordVerifier(0), mnSpinCount(0) {} + ScEnhancedProtection() : mnAreserved(0), mnPasswordVerifier(0) {} bool hasSecurityDescriptor() const { @@ -132,7 +140,7 @@ struct ScEnhancedProtection bool hasPassword() const { - return mnPasswordVerifier != 0 || !maHashValue.isEmpty(); + return mnPasswordVerifier != 0 || maPasswordHash.hasPassword(); } }; -- cgit