Kaydet (Commit) 0fe1b2fb authored tarafından Eike Rathke's avatar Eike Rathke

Read algorithmName, hashValue, saltValue, spinCount, tdf#115933 prep

Change-Id: I799d4652099059fcd09088c02537ed5dec087259
üst 62767cf6
...@@ -30,8 +30,12 @@ namespace xls { ...@@ -30,8 +30,12 @@ namespace xls {
/** Settings for workbook write protection. */ /** Settings for workbook write protection. */
struct FileSharingModel struct FileSharingModel
{ {
OUString maUserName; /// User who added the write protection password. OUString maUserName; /// User who added the write protection password.
sal_uInt16 mnPasswordHash; /// Hash value of the write protection password. OUString maAlgorithmName; /// Algorithm name, "SHA-512", "SHA-1", ...
OUString maHashValue; /// Hash value computed by the algorithm, base-64 encoded
OUString maSaltValue; /// Salt value to be prepended to the password, base-64 encoded
sal_uInt32 mnSpinCount; /// Spin count, iterations to run algorithm
sal_uInt16 mnPasswordHash; /// Hash value of the write protection password. (unrelated to the above)
bool mbRecommendReadOnly; /// True = recommend read-only mode on opening. bool mbRecommendReadOnly; /// True = recommend read-only mode on opening.
explicit FileSharingModel(); explicit FileSharingModel();
......
...@@ -63,6 +63,7 @@ const sal_Int16 API_SHOWMODE_PLACEHOLDER = 2; /// Show placeholder ...@@ -63,6 +63,7 @@ const sal_Int16 API_SHOWMODE_PLACEHOLDER = 2; /// Show placeholder
} // namespace } // namespace
FileSharingModel::FileSharingModel() : FileSharingModel::FileSharingModel() :
mnSpinCount( 0 ),
mnPasswordHash( 0 ), mnPasswordHash( 0 ),
mbRecommendReadOnly( false ) mbRecommendReadOnly( false )
{ {
...@@ -108,6 +109,10 @@ WorkbookSettings::WorkbookSettings( const WorkbookHelper& rHelper ) : ...@@ -108,6 +109,10 @@ WorkbookSettings::WorkbookSettings( const WorkbookHelper& rHelper ) :
void WorkbookSettings::importFileSharing( const AttributeList& rAttribs ) void WorkbookSettings::importFileSharing( const AttributeList& rAttribs )
{ {
maFileSharing.maUserName = rAttribs.getXString( XML_userName, OUString() ); maFileSharing.maUserName = rAttribs.getXString( XML_userName, OUString() );
maFileSharing.maAlgorithmName = rAttribs.getString( XML_algorithmName, OUString());
maFileSharing.maHashValue = rAttribs.getString( XML_hashValue, OUString());
maFileSharing.maSaltValue = rAttribs.getString( XML_saltValue, OUString());
maFileSharing.mnSpinCount = rAttribs.getUnsigned( XML_spinCount, 0);
maFileSharing.mnPasswordHash = oox::core::CodecHelper::getPasswordHash( rAttribs, XML_reservationPassword ); maFileSharing.mnPasswordHash = oox::core::CodecHelper::getPasswordHash( rAttribs, XML_reservationPassword );
maFileSharing.mbRecommendReadOnly = rAttribs.getBool( XML_readOnlyRecommended, false ); maFileSharing.mbRecommendReadOnly = rAttribs.getBool( XML_readOnlyRecommended, false );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment