xaldarof / encrypted-shared-preferences

Perfect for developers prioritizing security, Encrypted Shared Preferences integrates effortlessly into your projects, offering peace of mind and enhancing data privacy. Safeguard your app's data with this essential encryption solution
Apache License 2.0
10 stars 2 forks source link

use package in my app. Get this error. #7

Closed SimonQiu-bj closed 6 months ago

SimonQiu-bj commented 6 months ago

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:encrypt_shared_preferences/src/crypto/aes.dart': Failed assertion: line 7 pos 12: 'key.length == 16': is not true.

0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)

1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)

2 AESEncryptor.encrypt (package:encrypt_shared_preferences/src/crypto/aes.dart:7:12)

3 SharedPreferencesDecorator.save (package:encrypt_shared_preferences/src/shared_preferences_decorator.dart:157:30)

4 SharedPreferencesDecorator.setString (package:encrypt_shared_preferences/src/shared_preferences_decorator.dart:151:12)

5 EncryptedSharedPreferences.setString (package:encrypt_shared_preferences/src/enc_shared_pref.dart:63:23)

6 main (package:zz_yun_system_manager/main.dart:9:20)

SimonQiu-bj commented 6 months ago

i didn't set the _key

xaldarof commented 6 months ago

Hi, you should set key 16 length(128 bit) to fix this issue, or you can implement your own encryption algorithm using IEncryptor