rsa_encrypt 1.0.3
rsa_encrypt 1.0.3 #
RSA encryption package.
Getting Started #
RSA keys generator, String encryption and decryption and String signing.
How it works #
let say Alice want to send a message to Bob. a normal messaging solution would be : Alice write the message and send it to Bob the only problem is that the Message will be transferred in PlainText and every one who intercept the message can read it.
This is were RSA comes to play:

We generate keys( public & private ) for Bob.

If Alice wanted to send a message to Bob she have to encrypt that message with Bob's public keys.

Then the encrypted message will be transferred to Bob and only Bob's private key can decrypt that message.
that way no none can decrypt the message except the owner of that specific private key.
How to use #
in order to use RSA encryption you need to generate 2 keys a public key (used to encrypt a text) and a private key (used to decrypt a text).
Those are the functions and header needed:
import 'package:rsa_encrypt/rsa_encrypt.dart';
import 'package:pointycastle/api.dart' as crypto;
//Future to hold our KeyPair
Future<crypto.AsymmetricKeyPair> futureKeyPair;
//to store the KeyPair once we get data from our future
crypto.AsymmetricKeyPair keyPair;
Future<crypto.AsymmetricKeyPair<crypto.PublicKey, crypto.PrivateKey>> getKeyPair()
{
var helper = RsaKeyHelper();
return helper.computeRSAKeyPair(helper.getSecureRandom());
}
 Generate KeyPair with the function getKeyPair() store the returned value in futureKeyPair.
 Once we get data from the future we can store that data in keyPair (Now we have acces to our private and public key).
 In order to view our keys as "a string" we need to use two functions encodePrivateKeyToPemPKCS1(keyPair.privateKey) & encodePublicKeyToPemPKCS1(keyPair.publicKey).
 In order to encrypt and decrypt strings you can use two functions
 encrypt() : use this function to encrypt a string, pass your string as first argument and a public key as the second one. [IMPORTANT]: this will return a string so you should store the returned value in a variable.
 decrypt() : use this function to decrypt an encrypted String, pass your encrypted String as first argument and a private key as the second. this will also return a string dont forget to store it :) .
A youtube video will be available soon!
More on RSA #
The RSA Encryption Algorithm (1 of 2: Computing an Example)
The RSA Encryption Algorithm (2 of 2: Generating the Keys)
How to solve RSA Algorithm Problems?
depends on pointycastle, asn1lib.
thanks to GonĂ§alo Palma for his Article.
For help getting started with Flutter, view our
online documentation, which offers tutorials,
samples, guidance on mobile development, and a full API reference.
[1.0.3]  12/08/2019.
 Documentation on how to use this package.
rsa_example #
RSA encryption package example.
How to use #
in order to use RSA encryption you need to generate 2 keys a public key (used to encrypt a text) and a private key (used to decrypt a text).
Those are the functions and header needed:
import 'package:rsa_encrypt/rsa_encrypt.dart';
import 'package:pointycastle/api.dart' as crypto;
//Future to hold our KeyPair
Future<crypto.AsymmetricKeyPair> futureKeyPair;
//to store the KeyPair once we get data from our future
crypto.AsymmetricKeyPair keyPair;
Future<crypto.AsymmetricKeyPair<crypto.PublicKey, crypto.PrivateKey>> getKeyPair()
{
var helper = RsaKeyHelper();
return helper.computeRSAKeyPair(helper.getSecureRandom());
}
 Generate KeyPair with the function getKeyPair() store the returned value in futureKeyPair.
 Once we get data from the future we can store that data in keyPair (Now we have acces to our private and public key).
 In order to view our keys as "a string" we need to use two functions encodePrivateKeyToPemPKCS1(keyPair.privateKey) & encodePublicKeyToPemPKCS1(keyPair.publicKey).
 In order to encrypt and decrypt strings you can use two functions
 encrypt() : use this function to encrypt a string, pass your string as first argument and a public key as the second one. [IMPORTANT]: this will return a string so you should store the returned value in a variable.
 decrypt() : use this function to decrypt an encrypted String, pass your encrypted String as first argument and a private key as the second. this will also return a string dont forget to store it :) .
A youtube video will be available soon
Getting Started #
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies:
rsa_encrypt: ^1.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:rsa_encrypt/rsa_encrypt.dart';
Popularity:
Describes how popular the package is relative to other packages.
[more]

62

Health:
Code health derived from static analysis.
[more]

100

Maintenance:
Reflects how tidy and uptodate the package is.
[more]

90

Overall:
Weighted score of the above.
[more]

79

We analyzed this package on Jan 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
 Dart: 2.7.0
 pana: 0.13.4
 Flutter: 1.12.13+hotfix.5
Maintenance issues and suggestions
Support latest dependencies. (10 points)
The version constraint in pubspec.yaml
does not support the latest published versions for 1 dependency (asn1lib
).
Dependencies
Package  Constraint  Resolved  Available 

Direct dependencies  
Dart SDK  >=2.1.0 <3.0.0  
asn1lib  ^0.5.14  0.5.15  0.6.0 
flutter  0.0.0  
pointycastle  ^1.0.2  1.0.2  
Transitive dependencies  
collection  1.14.11  1.14.12  
meta  1.1.8  
sky_engine  0.0.99  
typed_data  1.1.6  
vector_math  2.0.8  
Dev dependencies  
flutter_test 