diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-03-21 20:58:34 +0000 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-04-01 23:26:31 +0200 |
commit | 0ee75556a6c10384bba6b980476ec533c669d575 (patch) | |
tree | 378399441976e08d21dffe60e152fa9eadef7839 /uui/source/iahndl-authentication.cxx | |
parent | ab68c7a2eff2cdca7f48e0f09a9f169f273bbe45 (diff) |
make hash encoding match decoding
Seeing as old versions of the hash may be in the users config, add a
StorageVersion field to the office config Passwords section which
defaults to 0 to indicate the old hash is in use.
Try the old varient when StorageVersion is 0. When a new encoded master
password it set write StorageVersion of 1 to indicate a new hash is in
use and use the new style when StorageVersion is 1.
Change-Id: I3174c37a5891bfc849984e0ec5c2c392b9c6e7b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132080
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'uui/source/iahndl-authentication.cxx')
-rw-r--r-- | uui/source/iahndl-authentication.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index ad975d3f9ae7..951f0b8a1c6b 100644 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -436,8 +436,9 @@ executeMasterPasswordDialog( OUStringBuffer aBuffer; for (sal_uInt8 i : aKey) { - aBuffer.append(static_cast< sal_Unicode >('a' + (i >> 4))); - aBuffer.append(static_cast< sal_Unicode >('a' + (i & 15))); + // match PasswordContainer::DecodePasswords aMasterPasswd.copy(index * 2, 2).toUInt32(16)); + aBuffer.append(OUString::number(i >> 4, 16)); + aBuffer.append(OUString::number(i & 15, 16)); } rInfo.SetPassword(aBuffer.makeStringAndClear()); } |