Giter Site home page Giter Site logo

flutter_aes_ecb_pkcs5's Introduction

AES 128 pkcs5 only support

  • Provide generation of AES keys

  • Provide encrypt for AES keys

  • Provide decrypt for AES keys

  • Android uses java, iOS uses OC development

Usage

Use this package as a library

  1. Depend on it Add this to your package's pubspec.yaml file:
dependencies:
  flutter_aes_ecb_pkcs5: ^0.1.3
  1. Install it You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

  1. Import it Now in your Dart code, you can use:
import 'package:flutter_aes_ecb_pkcs5/flutter_aes_ecb_pkcs5.dart';

AES Use Example

import 'package:flutter_aes_ecb_pkcs5/flutter_aes_ecb_pkcs5.dart';

void main() {

    var data = "{\"username\":\"helloword\"}";
    
    //generate a 16-byte random key
    var key = await FlutterAesEcbPkcs5.generateDesKey(128);
    
    print(key);
    //encrypt
    var encryptText = await FlutterAesEcbPkcs5.encryptString(data, key);
    
    print(encryptText);
    //decrypt
    var decryptText  = await FlutterAesEcbPkcs5.decryptString(encryptText, key);
    
    print(decryptText);
  
}

Run Example Result

data:{"username":"helloword"}
create key:DA8FD2693B652D587EEE51E7ADD9DBB8
encryptText :851544E224F6C1C7F560AB82889DE0DF66EEB6762AB836F4EE13E31100F0EA16
decryptText :{"username":"helloword"}

License

The MIT License(http://opensource.org/licenses/MIT)

Please feel free to use and contribute to the development.

flutter_aes_ecb_pkcs5's People

Contributors

smallbuer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flutter_aes_ecb_pkcs5's Issues

Flutter 3: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.

Since Flutter 3.0, there is new warnings:

: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
../…/lib/responsive_wrapper.dart:622
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Apps/flutter/packages/flutter/lib/src/widgets/binding.dart').
package:flutter/…/widgets/binding.dart:1
    WidgetsBinding.instance!.addObserver(this);
                   ^

求助作者,与在线结果不一致

为什么在 (http://tool.chacuo.net/cryptaes) 网站上加密之后的结果不一样,而且无法解密

WX20221105-101725

String token = 'thingquitventureenough owner uselesschestrapidcomicreunionfoodgarage';
String key = '5371a97bf39c7b40088894a3b6d57931';
String result = await FlutterAesEcbPkcs5.encryptString(token, key);

AE9C0C8BFCAE37878E6B0BDA57AD1C5A2C483A43B877D6865CFB8BCCB0871B97B4B6712E3602AC487084CDA8C0AD10538A2A70DBFE829082BA2F838B2CF4A1801F3F381F473D424CE61FDC5F91EA7CBA

这玩意 练案例都跑不通啊

[VERBOSE-2:ui_dart_state.cc(199)] Unhandled Exception: MissingPluginException(No implementation found for method generateDesKey on channel flutter_aes_ecb_pkcs5)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:7)

#1 FlutterAesEcbPkcs5.generateDesKey (package:flutter_aes_ecb_pkcs5_fork/flutter_aes_ecb_pkcs5_fork.dart:27:11)

#2 _VideoDataState.downApkFunction (package:media_app/pages/video_data.dart:49:15)

加密报错

Unhandled Exception: MissingPluginException(No implementation found for method encrypt on channel flutter_aes_ecb_pkcs5)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:7)

#1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:334:12)
#2 FlutterAesEcbPkcs5.encryptString (package:flutter_aes_ecb_pkcs5/flutter_aes_ecb_pkcs5.dart:40:26)
#3 EncryptHelper.encode (package:zyb/utils/EncryptHelper.dart:24:37)
#4 DioUtils.postHttp (package:zyb/net/DioUtils.dart:70:24)
#5 AdvertisingPage.createState (package:zyb/widgets/advertising_page.dart:12:14)
#6 new StatefulElement (package:flutter/src/widgets/framework.dart:4635:25)
#7 StatefulWidget.createElement (package:flutter/src/widgets/framework.dart:900:38)
#8 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3485:40)
#9 Element.updateChild (package:flutter/src/widgets/fram<…>

supporting null-safety

I reckon with this library that would be fairly easy. Simply increase the min dart SDK in the pubspec.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.