-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Nguyen Van Nguyen <[email protected]>
- Loading branch information
Showing
27 changed files
with
76 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,13 @@ import '../enum/armor_type.dart'; | |
import '../helpers.dart'; | ||
|
||
/// ASCII Armor class | ||
/// OpenPGP's Radix-64 encoding. | ||
/// It is composed of two parts: a base64 | ||
/// encoding of the binary data and a checksum. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-6 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class Armor { | ||
static const version = 'Dart PG v1.0.0'; | ||
static const version = 'Dart PG v1.2.0'; | ||
static const comment = 'Dart Privacy Guard'; | ||
|
||
static const messageBegin = '-----BEGIN PGP MESSAGE'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
// file that was distributed with this source code. | ||
|
||
/// Compression algorithm enum | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-9.3 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
enum CompressionAlgorithm { | ||
uncompressed(0), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
// file that was distributed with this source code. | ||
|
||
/// Public-Key Algorithms | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-9.1 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
enum KeyAlgorithm { | ||
/// RSA (Encrypt or Sign) [HAC] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,8 @@ import '../../enum/signature_subpacket_type.dart'; | |
import '../signature_packet.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Packet embedded signature | ||
/// This subpacket contains a complete Signature packet body specified in Section 5.2 | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.26 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class EmbeddedSignature extends SignatureSubpacket { | ||
EmbeddedSignature(final Uint8List data, {super.critical, super.isLong}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,9 @@ import 'dart:typed_data'; | |
import '../../enum/signature_subpacket_type.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// This subpacket denotes whether a certification signature is | ||
/// "exportable", to be used by other users than the signature's issuer. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.11 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class ExportableCertification extends SignatureSubpacket { | ||
ExportableCertification( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,9 @@ import '../../enum/signature_subpacket_type.dart'; | |
import '../../enum/support_feature.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// The Features subpacket denotes which advanced OpenPGP features a | ||
/// user's implementation supports. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.24 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class Features extends SignatureSubpacket { | ||
Features( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,8 @@ import '../../enum/signature_subpacket_type.dart'; | |
import '../key_packet.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Packet giving the issuer key fingerprint. | ||
/// The OpenPGP Key fingerprint of the key issuing the signature. | ||
/// See https://datatracker.ietf.org/doc/html/draft-ietf-openpgp-rfc4880bis#section-5.2.3.28 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class IssuerFingerprint extends SignatureSubpacket { | ||
IssuerFingerprint(final Uint8List data, {super.critical, super.isLong}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ import '../../enum/signature_subpacket_type.dart'; | |
import '../../helpers.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Packet giving the issuer key ID. | ||
/// The OpenPGP Key ID of the key issuing the signature. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.5 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class IssuerKeyID extends SignatureSubpacket { | ||
IssuerKeyID(final Uint8List data, {super.critical, super.isLong}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,11 @@ import '../../crypto/math/int_ext.dart'; | |
import '../../enum/signature_subpacket_type.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Packet giving time after creation at which the key expires. | ||
/// The validity period of the key. This is the number of seconds after | ||
/// the key creation time that the key expires. If this is not present | ||
/// or has a value of zero, the key never expires. This is found only on | ||
/// a self-signature. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.6 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class KeyExpirationTime extends SignatureSubpacket { | ||
KeyExpirationTime( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,8 @@ import '../../enum/key_flag.dart'; | |
import '../../enum/signature_subpacket_type.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Packet holding the key flag values. | ||
/// This subpacket contains a list of binary flags that hold information about a key. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.21 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class KeyFlags extends SignatureSubpacket { | ||
KeyFlags( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,10 @@ import '../../enum/signature_subpacket_type.dart'; | |
import '../../helpers.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// This is a list of one-bit flags that indicate preferences that the | ||
/// key holder has about how the key is handled on a key server. | ||
/// All undefined flags MUST be zero. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.17 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class KeyServerPreferences extends SignatureSubpacket { | ||
KeyServerPreferences( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,9 @@ import 'dart:typed_data'; | |
import '../../enum/signature_subpacket_type.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Class provided a NotationData object according to RFC2440, Chapter 5.2.3.15. Notation Data | ||
/// This subpacket describes a "notation" on the signature that the issuer wishes to make. | ||
/// The notation has a name and a value, each of which are strings of octets. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.16 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class NotationData extends SignatureSubpacket { | ||
static const headerFlagLength = 4; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,9 @@ import '../../enum/signature_subpacket_type.dart'; | |
import '../../helpers.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// This subpacket contains a URI of a document that describes the policy | ||
/// under which the signature was issued. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.20 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class PolicyURI extends SignatureSubpacket { | ||
PolicyURI( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,9 @@ import '../../enum/compression_algorithm.dart'; | |
import '../../enum/signature_subpacket_type.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Compression algorithm numbers that indicate which algorithms the key | ||
/// holder prefers to use. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.9 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class PreferredCompressionAlgorithms extends SignatureSubpacket { | ||
PreferredCompressionAlgorithms( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,9 @@ import '../../enum/hash_algorithm.dart'; | |
import '../../enum/signature_subpacket_type.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Message digest algorithm numbers that indicate which algorithms the | ||
/// key holder prefers to receive. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.8 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class PreferredHashAlgorithms extends SignatureSubpacket { | ||
PreferredHashAlgorithms( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ import '../../enum/signature_subpacket_type.dart'; | |
import '../../helpers.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// This is a URI of a key server that the key holder prefers be used for updates. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.18 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class PreferredKeyServer extends SignatureSubpacket { | ||
PreferredKeyServer( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,9 @@ import '../../enum/signature_subpacket_type.dart'; | |
import '../../enum/symmetric_algorithm.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Symmetric algorithm numbers that indicate which algorithms the key | ||
/// holder prefers to use. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.7 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class PreferredSymmetricAlgorithms extends SignatureSubpacket { | ||
PreferredSymmetricAlgorithms( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,9 @@ import 'dart:typed_data'; | |
import '../../enum/signature_subpacket_type.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Packet giving whether or not the signature is signed using the primary user ID for the key. | ||
/// This is a flag in a User ID's self-signature that states whether this | ||
/// User ID is the main User ID for this key. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.19 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class PrimaryUserID extends SignatureSubpacket { | ||
PrimaryUserID(final Uint8List data, {super.critical, super.isLong}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,9 @@ import '../../enum/signature_subpacket_type.dart'; | |
import '../../helpers.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Used in conjunction with trust Signature packets (of level > 0) to | ||
/// limit the scope of trust that is extended. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.14 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class RegularExpression extends SignatureSubpacket { | ||
RegularExpression(final Uint8List data, {super.critical, super.isLong}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,9 @@ import 'dart:typed_data'; | |
import '../../enum/signature_subpacket_type.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Packet giving whether or not is revocable. | ||
/// Signature's revocability status. The packet body contains a | ||
/// Boolean flag indicating whether the signature is revocable. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.12 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class Revocable extends SignatureSubpacket { | ||
Revocable( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ import '../../enum/revocation_key_tag.dart'; | |
import '../../enum/signature_subpacket_type.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Authorizes the specified key to issue revocation signatures for this key. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.15 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class RevocationKey extends SignatureSubpacket { | ||
RevocationKey(final Uint8List data, {super.critical, super.isLong}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,9 @@ import '../../enum/revocation_reason_tag.dart'; | |
import '../../enum/signature_subpacket_type.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Represents revocation reason OpenPGP signature sub packet. | ||
/// This subpacket is used only in key revocation and certification | ||
/// revocation signatures. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.23 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class RevocationReason extends SignatureSubpacket { | ||
RevocationReason(final Uint8List data, {super.critical, super.isLong}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,9 @@ import '../../enum/signature_subpacket_type.dart'; | |
import '../../helpers.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// The time the signature was made. | ||
/// MUST be present in the hashed area. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.4 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class SignatureCreationTime extends SignatureSubpacket { | ||
SignatureCreationTime( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,10 @@ import '../../enum/signature_subpacket_type.dart'; | |
import '../../helpers.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Packet giving signature expiration time. | ||
/// The validity period of the signature. This is the number of seconds | ||
/// after the signature creation time that the signature expires. | ||
/// If this is not present or has a value of zero, it never expires. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.10 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class SignatureExpirationTime extends SignatureSubpacket { | ||
SignatureExpirationTime( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ import '../../enum/key_algorithm.dart'; | |
import '../../enum/signature_subpacket_type.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// RFC 4880, Section 5.2.3.25 - Signature Target subpacket. | ||
/// This subpacket identifies a specific target signature to which a signature refers. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.25 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class SignatureTarget extends SignatureSubpacket { | ||
SignatureTarget(final Uint8List data, {super.critical, super.isLong}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,9 @@ import 'dart:typed_data'; | |
import '../../enum/signature_subpacket_type.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Packet giving the User ID of the signer. | ||
/// This subpacket allows a keyholder to state which User ID is | ||
/// responsible for the signing. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.22 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class SignerUserID extends SignatureSubpacket { | ||
SignerUserID(final Uint8List data, {super.critical, super.isLong}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,9 @@ import 'dart:typed_data'; | |
import '../../enum/signature_subpacket_type.dart'; | ||
import '../signature_subpacket.dart'; | ||
|
||
/// Packet giving trust. | ||
/// Signer asserts that the key is not only valid but also trustworthy at | ||
/// the specified level. | ||
/// See https://www.rfc-editor.org/rfc/rfc4880#section-5.2.3.13 | ||
/// Author Nguyen Van Nguyen <[email protected]> | ||
class TrustSignature extends SignatureSubpacket { | ||
TrustSignature(final Uint8List data, {super.critical, super.isLong}) | ||
|