Closed julemand101 closed 2 years ago
Hi, thanks for your ticket, this is indeed not correct. However we have a PR already open that refactors this and fixes it. Can you try to use that branch instead and see if everything works as expected?
This is fixed in the latest release (0.0.2) since we reworked some of this logic.
The code found in: https://github.com/icapps/flutter_secure_file_storage/blob/d0317a33cf51faeaf00fd465df934341979b52f1/lib/src/encryption_util.dart#L19-L27
Is problematic since
string.codeUnits
(used when encrypting) returns UTF-16 code units:https://api.dart.dev/stable/2.15.1/dart-core/String/codeUnits.html
While the decryption logic uses
utf8.decode
which is used to decode UTF-8.You should use
utf8.encode
to encode yourString
if your intension is to use UTF-8.