summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-02-23 19:49:45 +0100
committerEike Rathke <erack@redhat.com>2018-02-23 19:50:39 +0100
commit6d67347311923dbe3975cfa197649f5856c00723 (patch)
treeeb113f29370c11b1dea6eb75edf003cd22ab199c /sc/inc
parent1f159a4df7dcf9c4b1a35d16aee2303b8fa34b27 (diff)
Move OOXML password definitions to struct ScOoxPasswordHash, tdf#104250 prep
Change-Id: I595d5ae8db6f739900afdfdde1e36b0a0b1d2179
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/tabprotection.hxx22
1 files changed, 15 insertions, 7 deletions
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();
}
};