OpenPGP class final
Export high level API for developers. Author Nguyen Van Nguyen nguyennv1981@gmail.com
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
armorPublicKeys(
Iterable< KeyInterface> keys) → String - Armor multiple public key.
-
createCleartextMessage(
String text) → CleartextMessageInterface - Create new cleartext message object from text.
-
createLiteralMessage(
Uint8List literalData, {String filename = '', DateTime? time}) → LiteralMessageInterface - Create new literal message object from literal data.
-
decrypt(
String armored, {Iterable< PrivateKeyInterface> decryptionKeys = const [], Iterable<String> passwords = const []}) → LiteralMessageInterface -
Decrypt a armored encrypted message with
the user's private keys, or passwords.
One of
decryptionKeys
orpasswords
must be specified. -
decryptMessage(
EncryptedMessageInterface message, {Iterable< PrivateKeyInterface> decryptionKeys = const [], Iterable<String> passwords = const []}) → LiteralMessageInterface -
Decrypt an encrypted message with the user's private keys, or passwords.
One of
decryptionKeys
orpasswords
must be specified. -
decryptPrivateKey(
String armored, String passphrase, [Iterable< String> subkeyPassphrases = const []]) → PrivateKeyInterface - Read & unlock OpenPGP private key with the given passphrase.
-
decryptSessionKey(
PacketListInterface< PacketInterface> packetList, {Iterable<PrivateKeyInterface> decryptionKeys = const [], Iterable<String> passwords = const []}) → SessionKeyInterface - Decrypt encrypted session keys. Using private keys or passwords (not both).
-
encrypt(
LiteralMessageInterface message, {Iterable< KeyInterface> encryptionKeys = const [], Iterable<String> passwords = const [], Iterable<PrivateKeyInterface> signingKeys = const [], SymmetricAlgorithm? symmetric, CompressionAlgorithm? compression, NotationDataInterface? notationData, DateTime? time}) → EncryptedMessageInterface -
Encrypt a message using public keys, passwords or both at once.
At least one of
encryptionKeys
,passwords
must be specified. If signing keys are specified, those will be used to sign the message. -
encryptBinaryData(
Uint8List bytes, {Iterable< KeyInterface> encryptionKeys = const [], Iterable<String> passwords = const [], Iterable<PrivateKeyInterface> signingKeys = const [], SymmetricAlgorithm? symmetric, CompressionAlgorithm? compression, NotationDataInterface? notationData, DateTime? time}) → EncryptedMessageInterface -
Encrypt binary data using public keys, passwords or both at once.
At least one of
encryptionKeys
,passwords
must be specified. If signing keys are specified, those will be used to sign the message. -
encryptCleartext(
String cleartext, {Iterable< KeyInterface> encryptionKeys = const [], Iterable<String> passwords = const [], Iterable<PrivateKeyInterface> signingKeys = const [], SymmetricAlgorithm? symmetric, CompressionAlgorithm? compression, NotationDataInterface? notationData, DateTime? time}) → EncryptedMessageInterface -
Encrypt cleartext using public keys, passwords or both at once.
At least one of
encryptionKeys
,passwords
must be specified. If signing keys are specified, those will be used to sign the message. -
encryptPrivateKey(
PrivateKeyInterface privateKey, String passphrase, [Iterable< String> subkeyPassphrases = const []]) → PrivateKeyInterface - Lock a private key with the given passphrase. The private key must be decrypted.
-
encryptSessionKey(
SessionKeyInterface sessionKey, {Iterable< KeyInterface> encryptionKeys = const [], Iterable<String> passwords = const []}) → PacketListInterface<PacketInterface> - Encrypt a session key either with public keys, passwords, or both at once.
-
generateKey(
Iterable< String> userIDs, String passphrase, {KeyType type = KeyType.rsa, RSAKeySize rsaKeySize = RSAKeySize.normal, Ecc curve = Ecc.secp521r1, int keyExpiry = 0, bool signOnly = false, DateTime? time}) → PrivateKeyInterface -
Generate a new OpenPGP key pair.
Support RSA, ECC, Curve25519 and Curve448 key types.
The generated primary key will have signing capabilities.
One subkey with encryption capabilities is also generated if
signOnly
is false. -
generateSessionKey(
Iterable< KeyInterface> encryptionKeys, [SymmetricAlgorithm? symmetric]) → SessionKeyInterface - Generate a new session key object. Taking the algorithm preferences of the passed encryption keys, if any.
-
readEncryptedMessage(
String armored) → EncryptedMessageInterface - Read OpenPGP encrypted message from armored string. Return an encrypted message object.
-
readLiteralMessage(
String armored) → LiteralMessageInterface - Read OpenPGP literal message from armored string. Return a literal message object.
-
readPrivateKey(
String armored) → PrivateKeyInterface - Read OpenPGP private key from armored string. Return a private key object.
-
readPublicKey(
String armored) → KeyInterface - Read OpenPGP public key from armored string. Return a public key object.
-
readPublicKeys(
String armored) → Iterable< KeyInterface> - Read OpenPGP public key list from armored string. Return iterator of public key objects.
-
readSignature(
String armored) → SignatureInterface - Read OpenPGP signature from armored string. Return a signature object.
-
readSignedMessage(
String armored) → SignedMessageInterface - Read OpenPGP signed message from armored string. Return a signed message object.
-
sign(
LiteralMessageInterface message, Iterable< PrivateKeyInterface> signingKeys, {Iterable<KeyInterface> recipients = const [], NotationDataInterface? notationData, DateTime? time}) → LiteralMessageInterface - Sign a message & return signed literal message.
-
signCleartext(
String text, Iterable< PrivateKeyInterface> signingKeys, {Iterable<KeyInterface> recipients = const [], NotationDataInterface? notationData, DateTime? time}) → SignedCleartextMessageInterface - Sign a cleartext message. Return a signed message object.
-
signDetached(
LiteralMessageInterface message, Iterable< PrivateKeyInterface> signingKeys, {Iterable<KeyInterface> recipients = const [], NotationDataInterface? notationData, DateTime? time}) → SignatureInterface - Sign a message & return detached signature.
-
signDetachedCleartext(
String text, Iterable< PrivateKeyInterface> signingKeys, {Iterable<KeyInterface> recipients = const [], NotationDataInterface? notationData, DateTime? time}) → SignatureInterface - Sign a cleartext message & return detached signature.
-
verify(
String armored, Iterable< KeyInterface> verificationKeys, [DateTime? time]) → Iterable<VerificationInterface> - Verify signatures of cleartext signed message. Return verification array.
-
verifyDetached(
String text, String signature, Iterable< KeyInterface> verificationKeys, [DateTime? time]) → Iterable<VerificationInterface> - Verify detached signatures of cleartext message. Return verification array.
-
verifyInline(
String armored, Iterable< KeyInterface> verificationKeys, [DateTime? time]) → Iterable<VerificationInterface> - Verify signatures of signed literal message. Return verification array.