openpgp

Last updated:

0 purchases

openpgp Image
openpgp Images
Add to Cart

Description:

openpgp

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





Contents #

OpenPGP

Contents
Usage
Generate methods

Encrypt methods
Decrypt methods
Sign methods
Verify methods
Encode methods
Decode methods
Metadata methods
Convert methods


Setup

Android
iOS
Web
MacOS
Linux
Windows


Example
Native Code
Upgrade Library
Tests



Usage #
Generate methods #

void main() async {
var keyOptions = KeyOptions()..rsaBits = 2048;
var keyPair = await OpenPGP.generate(
options: Options()
..name = 'test'
..email = '[email protected]'
..passphrase = passphrase
..keyOptions = keyOptions);
}
copied to clipboard
Encrypt methods #

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

}

copied to clipboard
Decrypt methods #

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

}
copied to clipboard
Sign methods #

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

}

copied to clipboard
Verify methods #

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

}

copied to clipboard
Encode methods #

void main() async {
var bytesSample = Uint8List.fromList('data'.codeUnits);

var result = await OpenPGP.armorEncode("PGP MESSAGE", bytesSample);
}

copied to clipboard
Decode methods #

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

copied to clipboard
Metadata methods #

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

copied to clipboard
Convert methods #

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

copied to clipboard
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
copied to clipboard
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
copied to clipboard
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
copied to clipboard
Tests #
You need to run
make test
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.