简体   繁体   English

安全存储应用程序如何工作

[英]How secure storage apps woks

I want to make a mobile application using Flutter like this我想像这样使用 Flutter 制作一个移动应用程序

https://play.google.com/store/apps/details?id=com.enchantedcloud.photovault 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我使用了 aes_crpyt package ( https://pub.dev/packages/aes_crypt ),它允许我加密和解密文件,但是我怎样才能检索要在应用程序中显示的数据而不用解密为可以打开的普通文件任何可以访问根文件的资源管理器

You can check out this package: flutter_secure_storage .您可以查看此 package: flutter_secure_storage From the documentation:从文档中:

  • Keychain is used for iOS钥匙扣用于 iOS
  • AES encryption is used for Android. AES 加密用于 Android。 AES secret key is encrypted with RSA and RSA key is stored in KeyStore AES 密钥使用 RSA 加密,RSA 密钥存储在 KeyStore 中

This way your data can be saved in a SharedPreferences fashion in a safer way through encryption.这样,您的数据可以通过加密以更安全的方式以SharedPreferences方式保存。

Sample syntax:示例语法:

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);

Since any database's purpose is to only store pure informational organized data.因为任何数据库的目的都是只存储纯粹的信息组织数据。 It's not suitable for storing large files such as media, documents, or images.它不适合存储媒体、文档或图像等大文件。 There are 2 alternatives:有 2 种选择:

  1. Upload the encrypted file to Firebase, then save the encrypted path to DB将加密文件上传到Firebase,然后将加密路径保存到DB
  2. Save encrypted file to local storage, then store the encrypted path将加密文件保存到本地存储,然后存储加密路径

I recommend the 1st method since you can avoid saving the encrypted files at local and risking chance to expose it to other users.我推荐第一种方法,因为您可以避免将加密文件保存在本地并冒着将其暴露给其他用户的风险。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM