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)
To use the plugin, add
simple_rsa as a
dependency in your pubspec.yaml file.
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');
See the example application source for a complete sample app using the Simple RSA encryption.
Adlan Arif Zakaria (adlanarifzr) iOS compatibility, sign and verify method.
Demonstrates how to use the simple_rsa plugin.
For help getting started with Flutter, view our online documentation.
Add this to your package's pubspec.yaml file:
dependencies: simple_rsa: ^0.0.5
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support
flutter pub get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Jul 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
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.
flutter format to format
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.