搜索插件、代码仓与 APP 分类

插件详情v1.0.4

native_encryptor

使用原生代码在您的 Flutter 应用中安全地加密/解密数据。添加随机盐值和初始化向量以增强安全性。易于使用的 API,跨平台兼容。

AndroidiOSmacOS
近 30 天下载
22
喜欢数
6
Pub 分数
130

安装插件

flutter pub add native_encryptor

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

NativeEncryptor 是一个 Flutter 包,可在 Android、iOS 和 macOS 上使用原生代码实现数据的安全加密和解密。它通过在每次加密操作中自动添加随机盐值和初始化向量(IV),增强了安全性。设计上注重简洁性,提供易于使用的 API,同时保持跨平台兼容性。非常适合用于保护移动应用中的敏感用户数据,如凭据、令牌或个人信息。

适合场景

  • 用户凭据的安全存储
  • 本地应用数据加密
  • 敏感配置文件的保护
  • 加密负载的安全传输
  • 遵守数据隐私法规

主要特点

  • 使用原生加密以获得更好的性能
  • 自动生成随机盐和初始化向量
  • 跨平台支持 Android、iOS 和 macOS
  • 简单直观的 API
  • 通过随机加密参数增强安全性

适合对象

  • 需要高数据安全的应用程序
  • 开发注重隐私的应用程序的开发者
  • 需要符合GDPR或HIPAA的项目
  • 处理敏感用户信息的移动应用
  • 注重性能和安全的团队

使用建议

  • 每个平台都需要原生代码集成
  • 由于原生依赖项,应用大小可能会略有增加
  • 由于内存限制,不适合非常大的数据集
  • 加密算法的自定义有限
  • 取决于包外密钥管理的正确实现

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Native Encryptor for Flutter

A powerful plugin for secure data handling in your Flutter apps.

Key Features

  • Native Code Integration: Ensures top-tier security and performance.
  • Random Salt & IV: Adds an extra layer of protection.
  • Passphrase-Based Encryption: Customizable and flexible security.
  • User-Friendly API:** Simplifies integration into your Flutter app.
  • Cross-Platform Compatibility: Works seamlessly on both iOS and Android.
Screenshots
encrypted_value decrypted_value input_content

Installation

  1. Add to pubspec.yaml:

    YAML

dependencies:
   native_encryptor: <latest_version>
  1. Fetch the plugin:

Bash

flutter pub get
  1. Import in your Dart code: Dart
     import 'package:native_encryptor/native_encryptor.dart';
    

Basic Usage

Dart

import 'package:flutter/material.dart';
import 'package:native_encryptor/native_encryptor.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final    _nativeEncryptorPlugin = NativeEncryptor();
  final TextEditingController _controller = TextEditingController(text: "Secret Message");
  String? encryptedData;
  String? decryptedData;
  final String passphrase = "YourSecretPassphrase";

  Future<void> encrypt() async {
    encryptedData = await _nativeEncryptorPlugin.encrypt(
      passPhrase: passphrase,
      contentToEncrypt: _controller.text,
    );
    setState(() {});
  }

  Future<void> decrypt() async {
    decryptedData = await _nativeEncryptorPlugin.decrypt(
      passPhrase: passphrase,
      concatenatedCipherText: encryptedData!,
    );
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Native    Encryptor')),
        body: Padding(
          padding: const EdgeInsets.all(16.0),
          child: Column(
            children: [
              TextField(
                controller: _controller,
                decoration: const InputDecoration(labelText:    'Enter text'),
              ),
              ElevatedButton(onPressed: encrypt, child: const Text('Encrypt')),
              if (encryptedData != null)
                Text('Encrypted: $encryptedData'),
              ElevatedButton(onPressed: decrypt, child: const Text('Decrypt')),
              if (decryptedData != null)
                Text('Decrypted: $decryptedData'),
            ],
          ),
        ),
      ),
    );
  }
}

API Reference

  • encrypt({required String passPhrase, required String contentToEncrypt}) Encrypts the given content with the provided passphrase. Returns: The encrypted data as a string.
  • decrypt({required String passPhrase, required String concatenatedCipherText}) Decrypts the given encrypted data with the provided passphrase. Returns: The original decrypted content.
  • getPlatformVersion() Retrieves the current platform version for debugging purposes.

License

This plugin is licensed under the MIT License.

Contributing

We welcome contributions! Please feel free to open issues or submit pull requests.

Connect with me:

  • GitHub: https://github.com/subhashDev11
  • LinkedIn: https://www.linkedin.com/in/subhashcs/
  • Medium: https://medium.com/@subhashchandrashukla

Enhance your Flutter app's security with Native Encryptor!

所属分类

依赖

依赖清单 2 项

  • plugin_platform_interface^2.1.8
  • web^1.1.0

源码仓库

使用此插件的项目

暂无相关数据。