Skip to content
pubscout

rsa_encrypt

2.0.0, released 6 years ago by an unverified publisher

RSA encryption/decryption with key generation for Flutter apps

WASM-ready
$ flutter pub add rsa_encrypt
Source repository

What it does

Provides functions to generate RSA key pairs, encode keys to PEM, encrypt strings with a public key, and decrypt with a private key. Supports null‑safety and works on all Flutter platforms.

AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need asymmetric encryption for secure data transfer
  • You want to avoid writing low‑level RSA code yourself
  • You need a quick, cross‑platform solution for key handling

Skip it when

  • You require advanced cryptographic features like OAEP padding or custom key sizes
  • You need integration with a backend service that already handles encryption
  • You prefer a pure Dart implementation without external dependencies

Strengths

  • Simple API, null‑safe, cross‑platform support
  • Built on well‑known libraries (pointycastle, asn1lib)
  • Includes key generation and PEM encoding

Weaknesses

  • Limited to basic RSA operations, no advanced padding options
  • Relies on external dependencies that may not be actively maintained
  • No built‑in unit tests shown

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
2

Add rsa_encrypt to pubspec and import the package; no special permissions or build_runner needed

import 'package:rsa_encrypt/rsa_encrypt.dart';
import 'package:pointycastle/api.dart' as crypto;

Future<crypto.AsymmetricKeyPair> getKeyPair() async {
  var helper = RsaKeyHelper();
  return helper.computeRSAKeyPair(helper.getSecureRandom());
}

String encrypt(String plain, crypto.PublicKey pub) => RsaEncrypt.encrypt(plain, pub);

String decrypt(String cipher, crypto.PrivateKey priv) => RsaEncrypt.decrypt(cipher, priv);

Alternatives

Packages that do the same job and could replace rsa_encrypt.

Works with

Packages commonly used together with rsa_encrypt: ones it builds on, ones built on it, and its own family.