1

I want to make a mobile application using Flutter like this

https://play.google.com/store/apps/details?id=com.enchantedcloud.photovault

but I don't know how to keep the data actually safe

I have used aes_crpyt package ( https://pub.dev/packages/aes_crypt ) which allows me to encrpyt and decrpyt files but how can I retrieve the data to be shown in the application without being decrypted as normal files which can be opened using any explorer which can access root files

4

1 回答 1

0

你可以查看这个包:flutter_secure_storage。从文档中:

  • 钥匙串用于 iOS
  • AES 加密用于 Android。AES 密钥使用 RSA 加密,RSA 密钥存储在 KeyStore 中

这样,您的数据可以SharedPreferences通过加密以更安全的方式保存。

示例语法:

import 'package:flutter_secure_storage/flutter_secure_storage.dart';

// Create storage
final storage = new FlutterSecureStorage();

// Read value 
String value = await storage.read(key: key);

// Read all values
Map<String, String> allValues = await storage.readAll();

// Delete value 
await storage.delete(key: key);

// Delete all 
await storage.deleteAll();

// Write value 
await storage.write(key: key, value: value);

因为任何数据库的目的都是只存储纯粹的信息组织数据。它不适合存储媒体、文档或图像等大文件。有 2 种选择:

  1. 将加密文件上传到 Firebase,然后将加密路径保存到 DB
  2. 将加密文件保存到本地存储,然后存储加密路径

我推荐第一种方法,因为您可以避免将加密文件保存在本地并冒着将其暴露给其他用户的风险。

于 2021-05-11T02:36:09.467 回答