Library for use openPGP with support for android, ios, macos, linux, web and hover
import 'package:openpgp/openpgp.dart';
var keyPair = await OpenPGP.generate(
options: Options(
name: 'test',
comment: 'test',
email: 'test@test.com',
passphrase: "123456",
keyOptions: KeyOptions(
rsaBits: 2048,
cipher: Cypher.aes128,
compression: Compression.none,
hash: Hash.sha256,
compressionLevel: 0,
),
),
);import 'package:fast_rsa/rsa.dart';
var bytesSample := Uint8List.fromList('data'.codeUnits)
var result = await OpenPGP.encrypt("text","[publicKey here]");
var result = await OpenPGP.encryptSymmetric("text","[passphrase here]");
var result = await OpenPGP.encryptBytes(bytesSample,"[publicKey here]");
var result = await OpenPGP.encryptSymmetricBytes(bytesSample,"[passphrase here]");
import 'package:fast_rsa/rsa.dart';
var bytesSample := Uint8List.fromList('data'.codeUnits)
var result = await OpenPGP.decrypt("text encrypted","[privateKey here]","[passphrase here]");
var result = await OpenPGP.decryptSymmetric("text encrypted","[passphrase here]");
var result = await OpenPGP.decryptBytes(bytesSample,"[privateKey here]","[passphrase here]");
var result = await OpenPGP.decryptSymmetricBytes(bytesSample,"[passphrase here]");import 'package:fast_rsa/rsa.dart';
var bytesSample := Uint8List.fromList('data'.codeUnits)
var result = await OpenPGP.sign("text","[publicKey here]","[privateKey here]","[passphrase here]");
var result = await OpenPGP.signBytesToString(bytesSample,"[publicKey here]","[privateKey here]","[passphrase here]");
import 'package:fast_rsa/rsa.dart';
var bytesSample := Uint8List.fromList('data'.codeUnits)
var result = await OpenPGP.verify("text signed","text","[publicKey here]");
var result = await OpenPGP.verifyBytes("text signed", bytesSample,"[publicKey here]");
Add this lines to android/app/proguard-rules.pro for proguard support
-keep class go.** { *; }
-keep class openpgp.** { *; }
no additional setup required
add to you pubspec.yaml
assets:
- packages/openpgp/web/assets/wasm_exec.js
- packages/openpgp/web/assets/openpgp.wasmref: https://github.com/jerson/flutter-openpgp/blob/master/example/pubspec.yaml
and in you web/index.html
<script
src="assets/packages/openpgp/web/assets/wasm_exec.js"
type="application/javascript"
></script>ref: https://github.com/jerson/flutter-openpgp/blob/master/example/web/index.html
add to you linux/app_configuration.mk
EXTRA_LDFLAGS=-lopenpgpref: https://github.com/jerson/flutter-openpgp/blob/master/example/linux/app_configuration.mk
no additional setup required
just update your plugins
hover plugins getInside example folder
cd example && flutter runthe native library is made in Golang and build with gomobile for faster performance