openpgp 3.7.2 copy "openpgp: ^3.7.2" to clipboard
openpgp: ^3.7.2 copied to clipboard

library for use OpenPGP with support for android and ios, macOS, linux, windows and web

OpenPGP #

Library for use openPGP with support for android, ios, macos, windows, linux and web

Integration Tests Android

Integration Tests Linux

Integration Tests Windows

Integration Tests iOS

Integration Tests macOS

Contents #

Usage #

Generate methods #

import 'package:openpgp/openpgp.dart';

void main() async {
    var keyOptions = KeyOptions()..rsaBits = 2048;
    var keyPair = await OpenPGP.generate(
            options: Options()
              ..name = 'test'
              ..email = 'test@test.com'
              ..passphrase = passphrase
              ..keyOptions = keyOptions);
}

Encrypt methods #

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]");

}

Decrypt methods #

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]");

}

Sign methods #

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]");

}

Verify methods #

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]");

}

Encode methods #

import 'package:fast_rsa/rsa.dart';

void main() async {
    var bytesSample = Uint8List.fromList('data'.codeUnits);
    
    var result = await OpenPGP.armorEncode("PGP MESSAGE", bytesSample);
}

Decode methods #

import 'package:fast_rsa/rsa.dart';

void main() async {    
    var result = await OpenPGP.armorDecode("message here");
}

Metadata methods #

import 'package:fast_rsa/rsa.dart';

void main() async {
    var result = await OpenPGP.getPrivateKeyMetadata("[privateKey here]");
    var result = await OpenPGP.getPublicKeyMetadata("[publicKey here]");
}

Convert methods #

import 'package:fast_rsa/rsa.dart';

void main() async {
    var result = await OpenPGP.convertPrivateKeyToPublicKey("[privateKey here]");
}

Setup #

Android #

No additional setup required.

iOS #

No additional setup required.

Web #

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

MacOS #

No additional setup required.

Linux #

No additional setup required.

Windows #

No additional setup required.

Example #

Inside example folder.

cd example && flutter run

check our web demo: [https://flutter-openpgp.jerson.dev/]

Native Code #

Native library is made in Go for faster performance.

[https://github.com/jerson/openpgp-mobile]

Upgrade Library #

You need to run

make upgrade

Tests #

You need to run

make test
34
likes
110
pub points
86%
popularity

Publisher

verified publisherjerson.dev

library for use OpenPGP with support for android and ios, macOS, linux, windows and web

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

ffi, flat_buffers, flutter, flutter_web_plugins, path

More

Packages that depend on openpgp