Library for use openPGP with support for android, ios, macos, windows, linux and web
import 'package:openpgp/openpgp.dart';
void main() async {
var keyOptions = KeyOptions()..rsaBits = 2048;
var keyPair = await OpenPGP.generate(
options: Options()
..name = 'test'
..email = '[email protected]'
..passphrase = passphrase
..keyOptions = keyOptions);
}
import 'package:fast_rsa/rsa.dart';
void main() async {
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';
void main() async {
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';
void main() async {
var bytesSample = Uint8List.fromList('data'.codeUnits);
var result = await OpenPGP.sign("text","[privateKey here]","[passphrase here]");
var result = await OpenPGP.signBytesToString(bytesSample,"[privateKey here]","[passphrase here]");
// sign including data
var result = await OpenPGP.signData("text","[privateKey here]","[passphrase here]");
var result = await OpenPGP.signDataBytesToString(bytesSample,"[privateKey here]","[passphrase here]");
}
import 'package:fast_rsa/rsa.dart';
void main() async {
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]");
// verify signed with data
var result = await OpenPGP.verifyData("text signed","[publicKey here]");
var result = await OpenPGP.verifyDataBytes(bytesSample,"[publicKey here]");
}
import 'package:fast_rsa/rsa.dart';
void main() async {
var bytesSample = Uint8List.fromList('data'.codeUnits);
var result = await OpenPGP.armorEncode("PGP MESSAGE", bytesSample);
}
import 'package:fast_rsa/rsa.dart';
void main() async {
var result = await OpenPGP.armorDecode("message here");
}
import 'package:fast_rsa/rsa.dart';
void main() async {
var result = await OpenPGP.getPrivateKeyMetadata("[privateKey here]");
var result = await OpenPGP.getPublicKeyMetadata("[publicKey here]");
}
import 'package:fast_rsa/rsa.dart';
void main() async {
var result = await OpenPGP.convertPrivateKeyToPublicKey("[privateKey here]");
}
No additional setup required.
No additional setup required.
Add to you pubspec.yaml
.
assets:
- packages/openpgp/web/assets/worker.js
- packages/openpgp/web/assets/wasm_exec.js
- packages/openpgp/web/assets/openpgp.wasm
ref: https://github.com/jerson/flutter-openpgp/blob/master/example/pubspec.yaml
No additional setup required.
No additional setup required.
No additional setup required.
Inside example folder.
cd example && flutter run
check our web demo: [https://flutter-openpgp.jerson.dev/]
Native library is made in Go
for faster performance.
[https://github.com/jerson/openpgp-mobile]
You need to run
make upgrade
You need to run
make test