AppCacheSecurity class
Handles AES-CBC encryption/decryption for the image cache.
Design:
- Key: Derived from the user-provided
LikeConfig.encryptionKeyvia SHA-256, or auto-generated as a cryptographically random 32-byte key persisted in SharedPreferences (unique per device/install). - IV: A fresh random 16-byte IV is generated for every file encryption and
prepended to the ciphertext (layout:
ciphertext). This means each file is independently and correctly decryptable with no shared state or IV reuse weaknesses.
Initialization: Call AppCacheSecurity.init inside LikeService.init before any file downloads occur.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
decryptBytes(
Uint8List encryptedBytes) → Uint8List - Decrypts encrypted bytes in-memory and returns the raw decrypted bytes.
-
decryptFile(
File encryptedFile) → Future< File> - Decrypts a file whose content was produced by encryptBytes.
-
encryptBytes(
Uint8List bytes) → Uint8List -
Encrypts
byteswith a freshly generated random IV. -
init(
) → Future< void> - Initializes the encryption engine.
-
reset(
) → void - Resets the encryption state. For testing only.