simple_rsa 0.0.5

Simple RSA Encryption #

Flutter plugin to encrypt, decrypt (RSA/ECB/PCSK1), verify and sign string with a public and a private key

Support for ANDROID and iOS(thanks to adlanarifzr)

Installation #

To use the plugin, add simple_rsa as a dependency in your pubspec.yaml file.

Usage #

First, initialize private and public key. Preferably in BASE64 format.

final publicKey = '...';
final privateKey = '...';

After that, you can encrypt or decyrpt text

let plainText = 'something';
final encryptedText = await encryptString(plainText, utf8.decode(base64.decode(publicKey)));
final decryptedText = await decryptString(encryptedText, utf8.decode(base64.decode(privateKey)));

// Test
print(plainText == decryptedText ? 'true' : 'false');

Or you might want to sign and verify text

let plainText = 'something';
final signedText = await signString(plainText, utf8.decode(base64.decode(privateKey)));
final verified = await verifyString(plainText, signedText, utf8.decode(base64.decode(publicKey)));

// Test
print(verified ? 'true' : 'false');

Example #

See the example application source for a complete sample app using the Simple RSA encryption.

Contributions #

Adlan Arif Zakaria (adlanarifzr) iOS compatibility, sign and verify method.

0.0.5 #

  • Migrate to AndroidX

0.0.4 #

  • Edit encryptData for support input size greater then 512 bytes

0.0.3 #

  • Fixed iOS functions and optimize the code

0.0.2+1 #

  • Add method for decrypt string (more 512 byte) with public key (ANDROID)

0.0.2 #

  • Add iOS compatibility
  • Add signData and verifyData method

0.0.1 #

  • Initial experimentation

example/README.md

simple_rsa_example #

Demonstrates how to use the simple_rsa plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

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


dependencies:
  simple_rsa: ^0.0.5

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:simple_rsa/simple_rsa.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
81
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
88
Learn more about scoring.

We analyzed this package on Jul 17, 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 issues and suggestions

Document public APIs. (-1 points)

6 out of 6 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/simple_rsa.dart.

Run flutter format to format lib/simple_rsa.dart.

Maintenance suggestions

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.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8

Admin