flutter_cipher 0.0.3

flutter_cipher #

一个Flutter加密类库 A Flutter encryption class library

Getting Started #

兼容iOS和Android Compatible with iOS and Android

RSA: 密钥格式: PKCS#1 Key format: PKCS#1

案例: example:

Asymmetric rsa = Cipher.getAsymmetricInstance(RSA(publicKey: publicKey, privateKey: privateKey));

//encryption
var encryptPublic = rsa.encryptPublic(content);
var encryptPrivate = rsa.encryptPrivate(content);

//decrypt
var decryptPublic = rsa.decryptPublic(encryptPrivate);
var decryptPrivate = rsa.decryptPrivate(encryptPublic);

AES:

案例: example:

Key key = Key.fromUtf8('32 length key................');
IV iv = IV.fromLength(16);

Symmetry aes = Cipher.getSymmetryInstance(AES(key, iv)));

var encrypted = aes.encrypt(bytes);
var encrypted = aes.encryptString(str);

var content = aes.decrypt(encrypted);
var content = aes.decrypt2String(encrypted);

Finally, we would like to thank leocavalcante, as the main content of this library is derived from the encrypt library.

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_cipher: ^0.0.3

2. 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.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_cipher/flutter_cipher.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
63
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Jul 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/src/encrypted.dart. (-0.50 points)

Analysis of lib/src/encrypted.dart reported 1 hint:

line 41 col 17: Override hashCode if overriding ==.

Format lib/flutter_cipher.dart.

Run flutter format to format lib/flutter_cipher.dart.

Format lib/src/algorithm.dart.

Run flutter format to format lib/src/algorithm.dart.

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/algorithms/aes.dart (Run flutter format to format lib/src/algorithms/aes.dart.)
  • lib/src/algorithms/rsa.dart (Run flutter format to format lib/src/algorithms/rsa.dart.)
  • lib/src/cipher.dart (Run flutter format to format lib/src/cipher.dart.)

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and flutter_cipher.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
args ^1.5.1 1.5.2
asn1lib ^0.5.8 0.5.8
collection ^1.14.11 1.14.11
flutter 0.0.0
pointycastle ^1.0.1 1.0.1
Transitive dependencies
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test

Admin