From 5017477d44bb640b2f2cde2354e177e668a92383 Mon Sep 17 00:00:00 2001 From: Nguyen Van Nguyen Date: Wed, 11 Dec 2024 09:49:26 +0700 Subject: [PATCH] WIP Signed-off-by: Nguyen Van Nguyen --- lib/src/common/argon2_s2k.dart | 2 +- lib/src/common/armor.dart | 2 +- lib/src/common/generic_s2k.dart | 2 +- lib/src/cryptor/aead/eax.dart | 2 +- lib/src/cryptor/aead/gcm.dart | 2 +- lib/src/cryptor/aead/ocb.dart | 4 ++-- lib/src/cryptor/asymmetric/dsa.dart | 8 ++++---- lib/src/cryptor/asymmetric/elgamal.dart | 7 ++++--- lib/src/cryptor/symmetric/blowfish.dart | 2 +- lib/src/cryptor/symmetric/buffered_cipher.dart | 2 +- lib/src/cryptor/symmetric/camellia.dart | 2 +- lib/src/cryptor/symmetric/cast5.dart | 2 +- lib/src/cryptor/symmetric/idea.dart | 2 +- lib/src/cryptor/symmetric/twofish.dart | 2 +- lib/src/key/private_key.dart | 2 ++ lib/src/message/verification.dart | 2 +- lib/src/packet/aead_encrypted_data.dart | 2 +- lib/src/packet/compressed_data.dart | 2 +- lib/src/packet/image_user_attribute.dart | 2 +- lib/src/packet/key/aes_key_wrapper.dart | 2 +- lib/src/packet/key/camellia_key_wrapper.dart | 2 +- lib/src/packet/key/dsa_public_material.dart | 2 +- lib/src/packet/key/dsa_secret_material.dart | 2 +- lib/src/packet/key/ecdh_public_material.dart | 2 +- lib/src/packet/key/ecdh_secret_material.dart | 2 +- lib/src/packet/key/ecdh_session_key_cryptor.dart | 2 +- lib/src/packet/key/ecdsa_public_material.dart | 2 +- lib/src/packet/key/ecdsa_secret_material.dart | 2 +- lib/src/packet/key/eddsa_legacy_public_material.dart | 2 +- lib/src/packet/key/eddsa_legacy_secret_material.dart | 2 +- lib/src/packet/key/eddsa_public_material.dart | 2 +- lib/src/packet/key/eddsa_secret_material.dart | 2 +- lib/src/packet/key/elgamal_public_material.dart | 2 +- lib/src/packet/key/elgamal_secret_material.dart | 4 +++- lib/src/packet/key/elgamal_session_key_cryptor.dart | 2 +- lib/src/packet/key/montgomery_public_material.dart | 2 +- lib/src/packet/key/montgomery_secret_material.dart | 2 +- lib/src/packet/key/montgomery_session_key_cryptor.dart | 4 +++- lib/src/packet/key/rsa_public_material.dart | 2 +- lib/src/packet/key/rsa_secret_material.dart | 2 +- lib/src/packet/key/rsa_session_key_cryptor.dart | 2 +- lib/src/packet/key/session_key.dart | 2 +- lib/src/packet/literal_data.dart | 3 ++- lib/src/packet/marker.dart | 2 +- lib/src/packet/one_pass_signature.dart | 2 +- lib/src/packet/packet_list.dart | 2 +- lib/src/packet/padding.dart | 2 +- lib/src/packet/public_key.dart | 2 +- lib/src/packet/public_key_encrypted_session_key.dart | 4 ++-- lib/src/packet/public_subkey.dart | 2 +- lib/src/packet/secret_key.dart | 2 +- lib/src/packet/secret_subkey.dart | 4 ++-- lib/src/packet/signature.dart | 5 +++-- lib/src/packet/signature/embedded_signature.dart | 2 +- lib/src/packet/signature/exportable_certification.dart | 3 +-- lib/src/packet/signature/features.dart | 2 +- .../packet/signature/intended_recipient_fingerprint.dart | 2 +- lib/src/packet/signature/issuer_fingerprint.dart | 2 +- lib/src/packet/signature/issuer_key_id.dart | 2 +- lib/src/packet/signature/key_expiration_time.dart | 2 +- lib/src/packet/signature/key_flags.dart | 2 +- lib/src/packet/signature/key_server_preferences.dart | 2 +- lib/src/packet/signature/notation_data.dart | 3 ++- lib/src/packet/signature/policy_uri.dart | 2 +- lib/src/packet/signature/preferred_aead_algorithms.dart | 2 +- lib/src/packet/signature/preferred_aead_ciphers.dart | 2 +- .../signature/preferred_compression_algorithms.dart | 2 +- lib/src/packet/signature/preferred_hash_algorithms.dart | 2 +- lib/src/packet/signature/preferred_key_server.dart | 2 +- .../packet/signature/preferred_symmetric_algorithms.dart | 2 +- lib/src/packet/signature/primary_user_id.dart | 2 +- lib/src/packet/signature/regular_expression.dart | 2 +- lib/src/packet/signature/revocable.dart | 2 +- lib/src/packet/signature/revocation_key.dart | 2 +- lib/src/packet/signature/revocation_reason.dart | 2 +- lib/src/packet/signature/signature_creation_time.dart | 2 +- lib/src/packet/signature/signature_expiration_time.dart | 2 +- lib/src/packet/signature/signature_target.dart | 2 +- lib/src/packet/signature/signer_user_id.dart | 2 +- lib/src/packet/signature/trust_signature.dart | 2 +- lib/src/packet/sym_encrypted_data.dart | 4 ++-- .../packet/sym_encrypted_integrity_protected_data.dart | 2 +- lib/src/packet/sym_encrypted_session_key.dart | 4 ++-- lib/src/packet/trust.dart | 4 ++-- lib/src/packet/user_attribute.dart | 5 +++-- lib/src/packet/user_id.dart | 4 ++-- 86 files changed, 110 insertions(+), 100 deletions(-) diff --git a/lib/src/common/argon2_s2k.dart b/lib/src/common/argon2_s2k.dart index 29762bdc..de9b622b 100644 --- a/lib/src/common/argon2_s2k.dart +++ b/lib/src/common/argon2_s2k.dart @@ -13,7 +13,7 @@ import 'helpers.dart'; /// Implementation of the Argon2 string-to-key specifier /// See https://www.rfc-editor.org/rfc/rfc9580#section-3.7 -class Argon2S2k implements S2kInterface { +final class Argon2S2k implements S2kInterface { /// Default salt length static const saltLength = 16; diff --git a/lib/src/common/armor.dart b/lib/src/common/armor.dart index 3a59d414..4d27db0d 100644 --- a/lib/src/common/armor.dart +++ b/lib/src/common/armor.dart @@ -17,7 +17,7 @@ import 'helpers.dart'; /// encoding of the binary data and a checksum. /// See https://www.rfc-editor.org/rfc/rfc9580#section-6 /// Author Nguyen Van Nguyen -class Armor { +final class Armor { static const version = 'Dart PG v2'; static const comment = 'The Dart OpenPGP library'; diff --git a/lib/src/common/generic_s2k.dart b/lib/src/common/generic_s2k.dart index 34314446..86728aa8 100644 --- a/lib/src/common/generic_s2k.dart +++ b/lib/src/common/generic_s2k.dart @@ -14,7 +14,7 @@ import 'helpers.dart'; /// Implementation of the string-to-key specifier /// See https://www.rfc-editor.org/rfc/rfc9580#section-3.7 -class GenericS2k implements S2kInterface { +final class GenericS2k implements S2kInterface { /// Default salt length static const saltLength = 8; diff --git a/lib/src/cryptor/aead/eax.dart b/lib/src/cryptor/aead/eax.dart index 520002bb..0c0c6164 100644 --- a/lib/src/cryptor/aead/eax.dart +++ b/lib/src/cryptor/aead/eax.dart @@ -13,7 +13,7 @@ import '../../type/aead.dart'; /// EAX Authenticated-Encryption class /// Author Nguyen Van Nguyen -class Eax implements AeadInterface { +final class Eax implements AeadInterface { final Uint8List key; final SymmetricAlgorithm symmetric; diff --git a/lib/src/cryptor/aead/gcm.dart b/lib/src/cryptor/aead/gcm.dart index 3cc692fb..81211ed9 100644 --- a/lib/src/cryptor/aead/gcm.dart +++ b/lib/src/cryptor/aead/gcm.dart @@ -13,7 +13,7 @@ import '../../type/aead.dart'; /// GCM Authenticated-Encryption class /// Author Nguyen Van Nguyen -class Gcm implements AeadInterface { +final class Gcm implements AeadInterface { final Uint8List key; final SymmetricAlgorithm symmetric; diff --git a/lib/src/cryptor/aead/ocb.dart b/lib/src/cryptor/aead/ocb.dart index fc1a276d..90b78878 100644 --- a/lib/src/cryptor/aead/ocb.dart +++ b/lib/src/cryptor/aead/ocb.dart @@ -13,7 +13,7 @@ import '../../type/aead.dart'; /// OCB Authenticated-Encryption class /// Author Nguyen Van Nguyen -class Ocb implements AeadInterface { +final class Ocb implements AeadInterface { final Uint8List key; final SymmetricAlgorithm symmetric; @@ -81,7 +81,7 @@ class Ocb implements AeadInterface { /// An implementation of RFC 7253 on The OCB Authenticated-Encryption Algorithm. /// See https://tools.ietf.org/html/rfc7253 /// Author Nguyen Van Nguyen -class OCBCipher implements AEADCipher { +final class OCBCipher implements AEADCipher { static const _blockSize = 16; final BlockCipher _hashCipher; diff --git a/lib/src/cryptor/asymmetric/dsa.dart b/lib/src/cryptor/asymmetric/dsa.dart index 678fe97f..9ad9e147 100644 --- a/lib/src/cryptor/asymmetric/dsa.dart +++ b/lib/src/cryptor/asymmetric/dsa.dart @@ -12,7 +12,7 @@ import '../../common/helpers.dart'; /// Implementation of DSA (digital signature algorithm) /// Author Nguyen Van Nguyen -class DSASigner implements Signer { +final class DSASigner implements Signer { final Digest? _digest; late DSAAsymmetricKey? _key; @@ -150,7 +150,7 @@ class DSASigner implements Signer { } } -class DSASignature implements Signature { +final class DSASignature implements Signature { final BigInt r; final BigInt s; @@ -191,14 +191,14 @@ abstract class DSAAsymmetricKey implements AsymmetricKey { DSAAsymmetricKey(this.prime, this.order, this.generator); } -class DSAPublicKey extends DSAAsymmetricKey implements PublicKey { +final class DSAPublicKey extends DSAAsymmetricKey implements PublicKey { /// public exponent y = g ** x mod p final BigInt y; DSAPublicKey(this.y, super.prime, super.order, super.generator); } -class DSAPrivateKey extends DSAAsymmetricKey implements PrivateKey { +final class DSAPrivateKey extends DSAAsymmetricKey implements PrivateKey { /// secret exponent final BigInt x; diff --git a/lib/src/cryptor/asymmetric/elgamal.dart b/lib/src/cryptor/asymmetric/elgamal.dart index 145d8383..4360af4a 100644 --- a/lib/src/cryptor/asymmetric/elgamal.dart +++ b/lib/src/cryptor/asymmetric/elgamal.dart @@ -11,7 +11,7 @@ import '../../common/helpers.dart'; /// Asymmetric block cipher using basic ElGamal algorithm. /// Author Nguyen Van Nguyen -class ElGamalEngine implements AsymmetricBlockCipher { +final class ElGamalEngine implements AsymmetricBlockCipher { late ElGamalAsymmetricKey? _key; late SecureRandom _random; @@ -149,14 +149,15 @@ abstract class ElGamalAsymmetricKey implements AsymmetricKey { ElGamalAsymmetricKey(this.prime, this.generator); } -class ElGamalPublicKey extends ElGamalAsymmetricKey implements PublicKey { +final class ElGamalPublicKey extends ElGamalAsymmetricKey implements PublicKey { /// public exponent y = g ** x mod p final BigInt y; ElGamalPublicKey(this.y, super.prime, super.generator); } -class ElGamalPrivateKey extends ElGamalAsymmetricKey implements PrivateKey { +final class ElGamalPrivateKey extends ElGamalAsymmetricKey + implements PrivateKey { /// secret exponent final BigInt x; diff --git a/lib/src/cryptor/symmetric/blowfish.dart b/lib/src/cryptor/symmetric/blowfish.dart index 54ff69f9..3a763572 100644 --- a/lib/src/cryptor/symmetric/blowfish.dart +++ b/lib/src/cryptor/symmetric/blowfish.dart @@ -15,7 +15,7 @@ import 'base_engine.dart'; /// All the algorithms herein are from Applied Cryptography /// and implement a simplified cryptography interface. /// Author Nguyen Van Nguyen -class BlowfishEngine extends BaseEngine { +final class BlowfishEngine extends BaseEngine { static const _kp = [ 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, // 0 - 3 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, diff --git a/lib/src/cryptor/symmetric/buffered_cipher.dart b/lib/src/cryptor/symmetric/buffered_cipher.dart index 8dc36143..0acd0709 100644 --- a/lib/src/cryptor/symmetric/buffered_cipher.dart +++ b/lib/src/cryptor/symmetric/buffered_cipher.dart @@ -10,7 +10,7 @@ import 'package:pointycastle/api.dart'; /// Buffered cipher. /// Author Nguyen Van Nguyen -class BufferedCipher { +final class BufferedCipher { final BlockCipher _underlyingCipher; final Uint8List _buffer; diff --git a/lib/src/cryptor/symmetric/camellia.dart b/lib/src/cryptor/symmetric/camellia.dart index 7e848d5c..9eee7101 100644 --- a/lib/src/cryptor/symmetric/camellia.dart +++ b/lib/src/cryptor/symmetric/camellia.dart @@ -12,7 +12,7 @@ import '../../common/extensions.dart'; /// Camellia - based on RFC 3713. /// Author Nguyen Van Nguyen -class CamelliaEngine extends BaseEngine { +final class CamelliaEngine extends BaseEngine { static const _blockSize = 16; static const _mask8 = 0xff; diff --git a/lib/src/cryptor/symmetric/cast5.dart b/lib/src/cryptor/symmetric/cast5.dart index d1c12450..57189a62 100644 --- a/lib/src/cryptor/symmetric/cast5.dart +++ b/lib/src/cryptor/symmetric/cast5.dart @@ -18,7 +18,7 @@ import '../../common/extensions.dart'; /// /// and implement a simplified cryptography interface. /// Author Nguyen Van Nguyen -class CAST5Engine extends BaseEngine { +final class CAST5Engine extends BaseEngine { static const _sBox1 = [ 0x30fb40d4, 0x9fa0ff0b, 0x6beccd2f, 0x3f258c7a, 0x1e213f2f, 0x9c004dd3, 0x6003e540, 0xcf9fc949, // 0 - 7 diff --git a/lib/src/cryptor/symmetric/idea.dart b/lib/src/cryptor/symmetric/idea.dart index 4f6c1999..78585641 100644 --- a/lib/src/cryptor/symmetric/idea.dart +++ b/lib/src/cryptor/symmetric/idea.dart @@ -12,7 +12,7 @@ import '../../common/extensions.dart'; /// A class that provides a basic International Data Encryption Algorithm (IDEA) engine. /// Author Nguyen Van Nguyen -class IDEAEngine extends BaseEngine { +final class IDEAEngine extends BaseEngine { static const _mask = 0xffff; static const _base = 0x10001; diff --git a/lib/src/cryptor/symmetric/twofish.dart b/lib/src/cryptor/symmetric/twofish.dart index 58806bc3..2cc716b3 100644 --- a/lib/src/cryptor/symmetric/twofish.dart +++ b/lib/src/cryptor/symmetric/twofish.dart @@ -12,7 +12,7 @@ import '../../common/extensions.dart'; /// A class that provides Twofish encryption operations. /// Author Nguyen Van Nguyen -class TwofishEngine extends BaseEngine { +final class TwofishEngine extends BaseEngine { /// Q-Table 0 static const _q0 = [ 0xa9, 0x67, 0xb3, 0xe8, 0x04, 0xfd, 0xa3, 0x76, // 0 - 7 diff --git a/lib/src/key/private_key.dart b/lib/src/key/private_key.dart index a7b72682..30c57cae 100644 --- a/lib/src/key/private_key.dart +++ b/lib/src/key/private_key.dart @@ -19,6 +19,8 @@ import '../type/private_key.dart'; import '../type/secret_key_packet.dart'; import 'base_key.dart'; +/// OpenPGP private key class +/// Author Nguyen Van Nguyen final class PrivateKey extends BaseKey implements PrivateKeyInterface { PrivateKey(super.packetList); diff --git a/lib/src/message/verification.dart b/lib/src/message/verification.dart index 64ee2315..76f822d9 100644 --- a/lib/src/message/verification.dart +++ b/lib/src/message/verification.dart @@ -11,7 +11,7 @@ import '../type/verification.dart'; /// Verification class /// Author Nguyen Van Nguyen -class Verification implements VerificationInterface { +final class Verification implements VerificationInterface { @override final Uint8List keyID; diff --git a/lib/src/packet/aead_encrypted_data.dart b/lib/src/packet/aead_encrypted_data.dart index 5ef5759e..81bb0208 100644 --- a/lib/src/packet/aead_encrypted_data.dart +++ b/lib/src/packet/aead_encrypted_data.dart @@ -16,7 +16,7 @@ import 'base_packet.dart'; /// Implementation of the Symmetrically Encrypted Authenticated Encryption with /// Additional Data (AEAD) Protected Data Packet - Type 20 /// Author Nguyen Van Nguyen -class AeadEncryptedDataPacket extends BasePacket +final class AeadEncryptedDataPacket extends BasePacket implements EncryptedDataPacketInterface { static const version = 1; diff --git a/lib/src/packet/compressed_data.dart b/lib/src/packet/compressed_data.dart index cf9dbce8..78333976 100644 --- a/lib/src/packet/compressed_data.dart +++ b/lib/src/packet/compressed_data.dart @@ -13,7 +13,7 @@ import 'base_packet.dart'; /// Implementation of the Compressed Data (COMP) Packet - Type 11 /// Author Nguyen Van Nguyen -class CompressedDataPacket extends BasePacket { +final class CompressedDataPacket extends BasePacket { /// Default zip/zlib compression level, between 1 and 9 static const deflateLevel = 6; diff --git a/lib/src/packet/image_user_attribute.dart b/lib/src/packet/image_user_attribute.dart index 67f40362..d073c8a3 100644 --- a/lib/src/packet/image_user_attribute.dart +++ b/lib/src/packet/image_user_attribute.dart @@ -10,7 +10,7 @@ import 'user_attribute_subpacket.dart'; /// Implementation of the Image User Attribute Subpacket /// Author Nguyen Van Nguyen -class ImageUserAttribute extends UserAttributeSubpacket { +final class ImageUserAttribute extends UserAttributeSubpacket { static const jpeg = 1; ImageUserAttribute( diff --git a/lib/src/packet/key/aes_key_wrapper.dart b/lib/src/packet/key/aes_key_wrapper.dart index 420587dc..49aab451 100644 --- a/lib/src/packet/key/aes_key_wrapper.dart +++ b/lib/src/packet/key/aes_key_wrapper.dart @@ -10,7 +10,7 @@ import 'key_wrapper.dart'; /// An implementation of the AES Key Wrapper from the NIST Key Wrap Specification. /// Author Nguyen Van Nguyen -class AesKeyWrapper extends KeyWrapper { +final class AesKeyWrapper extends KeyWrapper { AesKeyWrapper(final int keySize) : super( BlockCipher('AES/ECB'), diff --git a/lib/src/packet/key/camellia_key_wrapper.dart b/lib/src/packet/key/camellia_key_wrapper.dart index 5a7eb7fb..d31ddcfd 100644 --- a/lib/src/packet/key/camellia_key_wrapper.dart +++ b/lib/src/packet/key/camellia_key_wrapper.dart @@ -11,7 +11,7 @@ import 'key_wrapper.dart'; /// An implementation of the Camellia key wrapper based on RFC 3657/RFC 3394. /// Author Nguyen Van Nguyen -class CamelliaKeyWrapper extends KeyWrapper { +final class CamelliaKeyWrapper extends KeyWrapper { CamelliaKeyWrapper(final int keySize) : super( ECBBlockCipher(CamelliaEngine()), diff --git a/lib/src/packet/key/dsa_public_material.dart b/lib/src/packet/key/dsa_public_material.dart index b1f8582b..e1b99f13 100644 --- a/lib/src/packet/key/dsa_public_material.dart +++ b/lib/src/packet/key/dsa_public_material.dart @@ -15,7 +15,7 @@ import '../../type/verification_key_material.dart'; /// DSA public key material /// Author Nguyen Van Nguyen -class DSAPublicMaterial implements VerificationKeyMaterial { +final class DSAPublicMaterial implements VerificationKeyMaterial { /// DSA prime p final BigInt prime; diff --git a/lib/src/packet/key/dsa_secret_material.dart b/lib/src/packet/key/dsa_secret_material.dart index 5641ed27..f3b1daf0 100644 --- a/lib/src/packet/key/dsa_secret_material.dart +++ b/lib/src/packet/key/dsa_secret_material.dart @@ -15,7 +15,7 @@ import 'dsa_public_material.dart'; /// DSA secret key material /// Author Nguyen Van Nguyen -class DSASecretMaterial implements SigningKeyMaterialInterface { +final class DSASecretMaterial implements SigningKeyMaterialInterface { /// DSA secret exponent x final BigInt exponent; diff --git a/lib/src/packet/key/ecdh_public_material.dart b/lib/src/packet/key/ecdh_public_material.dart index 41ef2c76..99069378 100644 --- a/lib/src/packet/key/ecdh_public_material.dart +++ b/lib/src/packet/key/ecdh_public_material.dart @@ -14,7 +14,7 @@ import 'ec_public_material.dart'; /// ECDH public key material /// Author Nguyen Van Nguyen -class ECDHPublicMaterial extends ECPublicMaterial { +final class ECDHPublicMaterial extends ECPublicMaterial { final int reserved; /// Hash algorithm used with the KDF diff --git a/lib/src/packet/key/ecdh_secret_material.dart b/lib/src/packet/key/ecdh_secret_material.dart index d6e4c47d..79e1b703 100644 --- a/lib/src/packet/key/ecdh_secret_material.dart +++ b/lib/src/packet/key/ecdh_secret_material.dart @@ -17,7 +17,7 @@ import 'ecdh_public_material.dart'; /// ECDH secret key material /// Author Nguyen Van Nguyen -class ECDHSecretMaterial extends ECSecretMaterial +final class ECDHSecretMaterial extends ECSecretMaterial implements SecretKeyMaterialInterface { @override final ECDHPublicMaterial publicMaterial; diff --git a/lib/src/packet/key/ecdh_session_key_cryptor.dart b/lib/src/packet/key/ecdh_session_key_cryptor.dart index 65081789..18bfb625 100644 --- a/lib/src/packet/key/ecdh_session_key_cryptor.dart +++ b/lib/src/packet/key/ecdh_session_key_cryptor.dart @@ -23,7 +23,7 @@ import 'session_key_cryptor.dart'; /// ECDH session key cryptor class /// Author Nguyen Van Nguyen -class ECDHSessionKeyCryptor extends SessionKeyCryptor { +final class ECDHSessionKeyCryptor extends SessionKeyCryptor { /// 20 octets representing the UTF-8 encoding of the string 'Anonymous Sender ' static const _anonymousSender = [ 0x41, 0x6e, 0x6f, 0x6e, // 0 - 3 diff --git a/lib/src/packet/key/ecdsa_public_material.dart b/lib/src/packet/key/ecdsa_public_material.dart index c347535a..1cfa6239 100644 --- a/lib/src/packet/key/ecdsa_public_material.dart +++ b/lib/src/packet/key/ecdsa_public_material.dart @@ -14,7 +14,7 @@ import '../../type/verification_key_material.dart'; /// ECDSA public key material /// Author Nguyen Van Nguyen -class ECDSAPublicMaterial extends ECPublicMaterial +final class ECDSAPublicMaterial extends ECPublicMaterial implements VerificationKeyMaterial { ECDSAPublicMaterial(super.oid, super.q); diff --git a/lib/src/packet/key/ecdsa_secret_material.dart b/lib/src/packet/key/ecdsa_secret_material.dart index 07f34c98..57598a26 100644 --- a/lib/src/packet/key/ecdsa_secret_material.dart +++ b/lib/src/packet/key/ecdsa_secret_material.dart @@ -16,7 +16,7 @@ import 'ecdsa_public_material.dart'; /// ECDSA secret key material /// Author Nguyen Van Nguyen -class ECDSASecretMaterial extends ECSecretMaterial +final class ECDSASecretMaterial extends ECSecretMaterial implements SigningKeyMaterialInterface { @override final ECDSAPublicMaterial publicMaterial; diff --git a/lib/src/packet/key/eddsa_legacy_public_material.dart b/lib/src/packet/key/eddsa_legacy_public_material.dart index 0babea81..0e0402c3 100644 --- a/lib/src/packet/key/eddsa_legacy_public_material.dart +++ b/lib/src/packet/key/eddsa_legacy_public_material.dart @@ -14,7 +14,7 @@ import 'ec_public_material.dart'; /// EdDSA legacy public key material /// Author Nguyen Van Nguyen -class EdDSALegacyPublicMaterial extends ECPublicMaterial +final class EdDSALegacyPublicMaterial extends ECPublicMaterial implements VerificationKeyMaterial { EdDSALegacyPublicMaterial(super.oid, super.q); diff --git a/lib/src/packet/key/eddsa_legacy_secret_material.dart b/lib/src/packet/key/eddsa_legacy_secret_material.dart index c23e630f..c7395140 100644 --- a/lib/src/packet/key/eddsa_legacy_secret_material.dart +++ b/lib/src/packet/key/eddsa_legacy_secret_material.dart @@ -17,7 +17,7 @@ import 'eddsa_legacy_public_material.dart'; /// EdDSA legacy secret key material /// Author Nguyen Van Nguyen -class EdDSALegacySecretMaterial implements SigningKeyMaterialInterface { +final class EdDSALegacySecretMaterial implements SigningKeyMaterialInterface { /// Ed's seed parameter final BigInt seed; diff --git a/lib/src/packet/key/eddsa_public_material.dart b/lib/src/packet/key/eddsa_public_material.dart index aeff5ab0..9b829b57 100644 --- a/lib/src/packet/key/eddsa_public_material.dart +++ b/lib/src/packet/key/eddsa_public_material.dart @@ -16,7 +16,7 @@ import '../../type/verification_key_material.dart'; /// EdDSA public key material /// Author Nguyen Van Nguyen -class EdDSAPublicMaterial implements VerificationKeyMaterial { +final class EdDSAPublicMaterial implements VerificationKeyMaterial { final Uint8List publicKey; final EdDSACurve curve; diff --git a/lib/src/packet/key/eddsa_secret_material.dart b/lib/src/packet/key/eddsa_secret_material.dart index c9da507b..7b4a2f23 100644 --- a/lib/src/packet/key/eddsa_secret_material.dart +++ b/lib/src/packet/key/eddsa_secret_material.dart @@ -16,7 +16,7 @@ import 'eddsa_public_material.dart'; /// EdDSA secret key material /// Author Nguyen Van Nguyen -class EdDSASecretMaterial implements SigningKeyMaterialInterface { +final class EdDSASecretMaterial implements SigningKeyMaterialInterface { final Uint8List secretKey; @override diff --git a/lib/src/packet/key/elgamal_public_material.dart b/lib/src/packet/key/elgamal_public_material.dart index 7f9012cf..beedc6ee 100644 --- a/lib/src/packet/key/elgamal_public_material.dart +++ b/lib/src/packet/key/elgamal_public_material.dart @@ -12,7 +12,7 @@ import '../../type/key_material.dart'; /// ElGamal public key material /// Author Nguyen Van Nguyen -class ElGamalPublicMaterial implements KeyMaterialInterface { +final class ElGamalPublicMaterial implements KeyMaterialInterface { /// Elgamal prime p final BigInt prime; diff --git a/lib/src/packet/key/elgamal_secret_material.dart b/lib/src/packet/key/elgamal_secret_material.dart index 079737ca..e788466b 100644 --- a/lib/src/packet/key/elgamal_secret_material.dart +++ b/lib/src/packet/key/elgamal_secret_material.dart @@ -11,7 +11,9 @@ import '../../cryptor/asymmetric/elgamal.dart'; import '../../type/secret_key_material.dart'; import 'elgamal_public_material.dart'; -class ElGamalSecretMaterial implements SecretKeyMaterialInterface { +/// ElGamal secret key material +/// Author Nguyen Van Nguyen +final class ElGamalSecretMaterial implements SecretKeyMaterialInterface { /// Elgamal secret exponent x. final BigInt exponent; diff --git a/lib/src/packet/key/elgamal_session_key_cryptor.dart b/lib/src/packet/key/elgamal_session_key_cryptor.dart index 378f5de7..4fa91515 100644 --- a/lib/src/packet/key/elgamal_session_key_cryptor.dart +++ b/lib/src/packet/key/elgamal_session_key_cryptor.dart @@ -15,7 +15,7 @@ import 'session_key_cryptor.dart'; /// ElGamal session key cryptor class /// Author Nguyen Van Nguyen -class ElGamalSessionKeyCryptor extends SessionKeyCryptor { +final class ElGamalSessionKeyCryptor extends SessionKeyCryptor { /// MPI of ElGamal (Diffie-Hellman) value g**k mod p. final BigInt gamma; diff --git a/lib/src/packet/key/montgomery_public_material.dart b/lib/src/packet/key/montgomery_public_material.dart index 8d906369..d08fdf32 100644 --- a/lib/src/packet/key/montgomery_public_material.dart +++ b/lib/src/packet/key/montgomery_public_material.dart @@ -11,7 +11,7 @@ import '../../enum/montgomery_curve.dart'; /// Montgomery public key material /// Author Nguyen Van Nguyen -class MontgomeryPublicMaterial implements KeyMaterialInterface { +final class MontgomeryPublicMaterial implements KeyMaterialInterface { final Uint8List publicKey; final MontgomeryCurve curve; diff --git a/lib/src/packet/key/montgomery_secret_material.dart b/lib/src/packet/key/montgomery_secret_material.dart index ebaeabf0..9311705f 100644 --- a/lib/src/packet/key/montgomery_secret_material.dart +++ b/lib/src/packet/key/montgomery_secret_material.dart @@ -15,7 +15,7 @@ import 'montgomery_public_material.dart'; /// Montgomery secret key material /// Author Nguyen Van Nguyen -class MontgomerySecretMaterial implements SecretKeyMaterialInterface { +final class MontgomerySecretMaterial implements SecretKeyMaterialInterface { final Uint8List secretKey; @override diff --git a/lib/src/packet/key/montgomery_session_key_cryptor.dart b/lib/src/packet/key/montgomery_session_key_cryptor.dart index 45e8d79b..47e7252d 100644 --- a/lib/src/packet/key/montgomery_session_key_cryptor.dart +++ b/lib/src/packet/key/montgomery_session_key_cryptor.dart @@ -14,7 +14,9 @@ import 'montgomery_public_material.dart'; import 'montgomery_secret_material.dart'; import 'session_key_cryptor.dart'; -class MontgomerySessionKeyCryptor extends SessionKeyCryptor { +/// Montgomery session key cryptor +/// Author Nguyen Van Nguyen +final class MontgomerySessionKeyCryptor extends SessionKeyCryptor { /// The ephemeral key used to establish the shared secret final Uint8List ephemeralKey; diff --git a/lib/src/packet/key/rsa_public_material.dart b/lib/src/packet/key/rsa_public_material.dart index 88dca9d1..0e87913e 100644 --- a/lib/src/packet/key/rsa_public_material.dart +++ b/lib/src/packet/key/rsa_public_material.dart @@ -13,7 +13,7 @@ import '../../type/verification_key_material.dart'; /// RSA public key material /// Author Nguyen Van Nguyen -class RSAPublicMaterial implements VerificationKeyMaterial { +final class RSAPublicMaterial implements VerificationKeyMaterial { /// RSA modulus n final BigInt modulus; diff --git a/lib/src/packet/key/rsa_secret_material.dart b/lib/src/packet/key/rsa_secret_material.dart index 155c225e..94c103aa 100644 --- a/lib/src/packet/key/rsa_secret_material.dart +++ b/lib/src/packet/key/rsa_secret_material.dart @@ -16,7 +16,7 @@ import 'rsa_public_material.dart'; /// RSA secret key material /// Author Nguyen Van Nguyen -class RSASecretMaterial implements SigningKeyMaterialInterface { +final class RSASecretMaterial implements SigningKeyMaterialInterface { static const publicExponent = 65537; static const mrTests = 64; diff --git a/lib/src/packet/key/rsa_session_key_cryptor.dart b/lib/src/packet/key/rsa_session_key_cryptor.dart index bb194d28..5f88e88f 100644 --- a/lib/src/packet/key/rsa_session_key_cryptor.dart +++ b/lib/src/packet/key/rsa_session_key_cryptor.dart @@ -15,7 +15,7 @@ import 'session_key_cryptor.dart'; /// RSA session key cryptor class /// Author Nguyen Van Nguyen -class RSASessionKeyCryptor extends SessionKeyCryptor { +final class RSASessionKeyCryptor extends SessionKeyCryptor { /// multiprecision integer (MPI) of RSA encrypted value m**e mod n. final BigInt encrypted; diff --git a/lib/src/packet/key/session_key.dart b/lib/src/packet/key/session_key.dart index 3ca51e21..87ba0adb 100644 --- a/lib/src/packet/key/session_key.dart +++ b/lib/src/packet/key/session_key.dart @@ -13,7 +13,7 @@ import '../../enum/symmetric_algorithm.dart'; /// Session key class /// Author Nguyen Van Nguyen -class SessionKey implements SessionKeyInterface { +final class SessionKey implements SessionKeyInterface { @override final SymmetricAlgorithm symmetric; diff --git a/lib/src/packet/literal_data.dart b/lib/src/packet/literal_data.dart index 6e7e03ce..860efa17 100644 --- a/lib/src/packet/literal_data.dart +++ b/lib/src/packet/literal_data.dart @@ -14,7 +14,8 @@ import 'base_packet.dart'; /// Implementation of the Literal Data (LIT) Packet - Type 11 /// Author Nguyen Van Nguyen -class LiteralDataPacket extends BasePacket implements LiteralDataInterface { +final class LiteralDataPacket extends BasePacket + implements LiteralDataInterface { @override final LiteralFormat format; diff --git a/lib/src/packet/marker.dart b/lib/src/packet/marker.dart index 2a397818..f034b464 100644 --- a/lib/src/packet/marker.dart +++ b/lib/src/packet/marker.dart @@ -10,7 +10,7 @@ import 'base_packet.dart'; /// Implementation of the Marker (MARKER) Packet - Type 10 /// Author Nguyen Van Nguyen -class MarkerPacket extends BasePacket { +final class MarkerPacket extends BasePacket { static const marker = 'PGP'; MarkerPacket() : super(PacketType.marker); diff --git a/lib/src/packet/one_pass_signature.dart b/lib/src/packet/one_pass_signature.dart index c12eb60e..e6e272d5 100644 --- a/lib/src/packet/one_pass_signature.dart +++ b/lib/src/packet/one_pass_signature.dart @@ -12,7 +12,7 @@ import 'base_packet.dart'; /// Implementation an OpenPGP One-Pass (OPS) Signature Packet - Type 4. /// Author Nguyen Van Nguyen -class OnePassSignaturePacket extends BasePacket { +final class OnePassSignaturePacket extends BasePacket { final int version; final SignatureType signatureType; diff --git a/lib/src/packet/packet_list.dart b/lib/src/packet/packet_list.dart index 3ff0698b..524cb2fc 100644 --- a/lib/src/packet/packet_list.dart +++ b/lib/src/packet/packet_list.dart @@ -13,7 +13,7 @@ import 'base_packet.dart'; /// This class represents a list of OpenPGP packets. /// Author Nguyen Van Nguyen -class PacketList extends ListBase +final class PacketList extends ListBase implements PacketListInterface { @override final List packets; diff --git a/lib/src/packet/padding.dart b/lib/src/packet/padding.dart index 15d954c4..7977ed0b 100644 --- a/lib/src/packet/padding.dart +++ b/lib/src/packet/padding.dart @@ -11,7 +11,7 @@ import 'base_packet.dart'; /// Implementation of the Padding (PADDING) Packet - Type 21. /// Author Nguyen Van Nguyen -class PaddingPacket extends BasePacket { +final class PaddingPacket extends BasePacket { static const paddingMin = 16; static const paddingMax = 32; diff --git a/lib/src/packet/public_key.dart b/lib/src/packet/public_key.dart index bafee2a7..1a81e426 100644 --- a/lib/src/packet/public_key.dart +++ b/lib/src/packet/public_key.dart @@ -18,7 +18,7 @@ import '../type/key_packet.dart'; import 'key/public_material.dart'; import 'base_packet.dart'; -/// Implementation of the Public Key (PUBKEY) Packet - Type 6 +/// Public Key (PUBKEY) Packet - Type 6 /// Author Nguyen Van Nguyen class PublicKeyPacket extends BasePacket implements KeyPacketInterface { static const keyIDSize = 8; diff --git a/lib/src/packet/public_key_encrypted_session_key.dart b/lib/src/packet/public_key_encrypted_session_key.dart index 31f216b4..c209e5c7 100644 --- a/lib/src/packet/public_key_encrypted_session_key.dart +++ b/lib/src/packet/public_key_encrypted_session_key.dart @@ -15,9 +15,9 @@ import 'base_packet.dart'; import 'key/public_material.dart'; import 'key/session_key_cryptor.dart'; -/// Implementation of the Public-Key Encrypted Session Key (PKESK) Packet - Type 1 +/// Public Key Encrypted Session Key (PKESK) Packet - Type 1 /// Author Nguyen Van Nguyen -class PublicKeyEncryptedSessionKeyPacket extends BasePacket { +final class PublicKeyEncryptedSessionKeyPacket extends BasePacket { final int version; final int keyVersion; diff --git a/lib/src/packet/public_subkey.dart b/lib/src/packet/public_subkey.dart index 1f6e0e08..76cbdaee 100644 --- a/lib/src/packet/public_subkey.dart +++ b/lib/src/packet/public_subkey.dart @@ -12,7 +12,7 @@ import 'public_key.dart'; /// Implementation of the Public Subkey (PUBSUBKEY) Packet - Type 14 /// Author Nguyen Van Nguyen -class PublicSubkeyPacket extends PublicKeyPacket +final class PublicSubkeyPacket extends PublicKeyPacket implements SubkeyPacketInterface { @override get type => PacketType.publicSubkey; diff --git a/lib/src/packet/secret_key.dart b/lib/src/packet/secret_key.dart index d9eda0ab..e14005d6 100644 --- a/lib/src/packet/secret_key.dart +++ b/lib/src/packet/secret_key.dart @@ -29,7 +29,7 @@ import 'key/public_material.dart'; import 'key/secret_material.dart'; import 'base_packet.dart'; -/// Implementation of the Secret Key (SECKEY) Packet - Type 5 +/// Secret Key (SECKEY) Packet - Type 5 /// Author Nguyen Van Nguyen class SecretKeyPacket extends BasePacket implements SecretKeyPacketInterface { @override diff --git a/lib/src/packet/secret_subkey.dart b/lib/src/packet/secret_subkey.dart index 74834aa7..7029223c 100644 --- a/lib/src/packet/secret_subkey.dart +++ b/lib/src/packet/secret_subkey.dart @@ -17,9 +17,9 @@ import '../type/subkey_packet.dart'; import 'public_subkey.dart'; import 'secret_key.dart'; -/// Implementation of the Secret Subkey (SECSUBKEY) Packet - Type 7 +/// Secret Subkey (SECSUBKEY) Packet - Type 7 /// Author Nguyen Van Nguyen -class SecretSubkeyPacket extends SecretKeyPacket +final class SecretSubkeyPacket extends SecretKeyPacket implements SubkeyPacketInterface { @override get type => PacketType.secretSubkey; diff --git a/lib/src/packet/signature.dart b/lib/src/packet/signature.dart index 81215dc5..b6728c55 100644 --- a/lib/src/packet/signature.dart +++ b/lib/src/packet/signature.dart @@ -18,9 +18,10 @@ import '../type/user_id_packet.dart'; import 'base_packet.dart'; import 'subpacket_reader.dart'; -/// Implementation of the Signature (SIG) Packet - Type 2 +/// Signature (SIG) Packet - Type 2 /// Author Nguyen Van Nguyen -class SignaturePacket extends BasePacket implements SignaturePacketInterface { +final class SignaturePacket extends BasePacket + implements SignaturePacketInterface { @override final int version; diff --git a/lib/src/packet/signature/embedded_signature.dart b/lib/src/packet/signature/embedded_signature.dart index 31394a77..622dc5b4 100644 --- a/lib/src/packet/signature/embedded_signature.dart +++ b/lib/src/packet/signature/embedded_signature.dart @@ -12,7 +12,7 @@ import '../signature_subpacket.dart'; /// This subpacket contains a complete Signature packet body specified /// Author Nguyen Van Nguyen -class EmbeddedSignature extends SignatureSubpacket { +final class EmbeddedSignature extends SignatureSubpacket { EmbeddedSignature(final Uint8List data, {super.critical, super.isLong}) : super(SignatureSubpacketType.embeddedSignature, data); diff --git a/lib/src/packet/signature/exportable_certification.dart b/lib/src/packet/signature/exportable_certification.dart index 8eb74093..1bd833c8 100644 --- a/lib/src/packet/signature/exportable_certification.dart +++ b/lib/src/packet/signature/exportable_certification.dart @@ -11,9 +11,8 @@ 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 -class ExportableCertification extends SignatureSubpacket { +final class ExportableCertification extends SignatureSubpacket { ExportableCertification( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/features.dart b/lib/src/packet/signature/features.dart index f5c15baa..288eb87b 100644 --- a/lib/src/packet/signature/features.dart +++ b/lib/src/packet/signature/features.dart @@ -13,7 +13,7 @@ import '../signature_subpacket.dart'; /// The Features subpacket denotes which advanced OpenPGP features a /// user's implementation supports. /// Author Nguyen Van Nguyen -class Features extends SignatureSubpacket { +final class Features extends SignatureSubpacket { Features( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/intended_recipient_fingerprint.dart b/lib/src/packet/signature/intended_recipient_fingerprint.dart index 6be44a28..f3c1555e 100644 --- a/lib/src/packet/signature/intended_recipient_fingerprint.dart +++ b/lib/src/packet/signature/intended_recipient_fingerprint.dart @@ -14,7 +14,7 @@ import '../signature_subpacket.dart'; /// The IntendedRecipientFingerprint sub-packet class /// Giving the intended recipient fingerprint. /// Author Nguyen Van Nguyen -class IntendedRecipientFingerprint extends SignatureSubpacket { +final class IntendedRecipientFingerprint extends SignatureSubpacket { IntendedRecipientFingerprint( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/issuer_fingerprint.dart b/lib/src/packet/signature/issuer_fingerprint.dart index 83173962..d62030ce 100644 --- a/lib/src/packet/signature/issuer_fingerprint.dart +++ b/lib/src/packet/signature/issuer_fingerprint.dart @@ -13,7 +13,7 @@ import '../signature_subpacket.dart'; /// The OpenPGP Key fingerprint of the key issuing the signature. /// Author Nguyen Van Nguyen -class IssuerFingerprint extends SignatureSubpacket { +final class IssuerFingerprint extends SignatureSubpacket { IssuerFingerprint( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/issuer_key_id.dart b/lib/src/packet/signature/issuer_key_id.dart index 9a055295..5a325c8f 100644 --- a/lib/src/packet/signature/issuer_key_id.dart +++ b/lib/src/packet/signature/issuer_key_id.dart @@ -12,7 +12,7 @@ import '../signature_subpacket.dart'; /// The OpenPGP Key ID of the key issuing the signature. /// Author Nguyen Van Nguyen -class IssuerKeyID extends SignatureSubpacket { +final class IssuerKeyID extends SignatureSubpacket { IssuerKeyID( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/key_expiration_time.dart b/lib/src/packet/signature/key_expiration_time.dart index 9453cee4..78631856 100644 --- a/lib/src/packet/signature/key_expiration_time.dart +++ b/lib/src/packet/signature/key_expiration_time.dart @@ -16,7 +16,7 @@ import '../signature_subpacket.dart'; /// or has a value of zero, the key never expires. This is found only on /// a self-signature. /// Author Nguyen Van Nguyen -class KeyExpirationTime extends SignatureSubpacket { +final class KeyExpirationTime extends SignatureSubpacket { KeyExpirationTime( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/key_flags.dart b/lib/src/packet/signature/key_flags.dart index 9f45f755..8e753afb 100644 --- a/lib/src/packet/signature/key_flags.dart +++ b/lib/src/packet/signature/key_flags.dart @@ -12,7 +12,7 @@ import '../signature_subpacket.dart'; /// This subpacket contains a list of binary flags that hold information about a key. /// Author Nguyen Van Nguyen -class KeyFlags extends SignatureSubpacket { +final class KeyFlags extends SignatureSubpacket { KeyFlags( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/key_server_preferences.dart b/lib/src/packet/signature/key_server_preferences.dart index fc96fd09..a22afe2a 100644 --- a/lib/src/packet/signature/key_server_preferences.dart +++ b/lib/src/packet/signature/key_server_preferences.dart @@ -15,7 +15,7 @@ import '../signature_subpacket.dart'; /// key holder has about how the key is handled on a key server. /// All undefined flags MUST be zero. /// Author Nguyen Van Nguyen -class KeyServerPreferences extends SignatureSubpacket { +final class KeyServerPreferences extends SignatureSubpacket { KeyServerPreferences( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/notation_data.dart b/lib/src/packet/signature/notation_data.dart index 72043448..a81e4cd9 100644 --- a/lib/src/packet/signature/notation_data.dart +++ b/lib/src/packet/signature/notation_data.dart @@ -16,7 +16,8 @@ import '../signature_subpacket.dart'; /// 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. /// Author Nguyen Van Nguyen -class NotationData extends SignatureSubpacket implements NotationDataInterface { +final class NotationData extends SignatureSubpacket + implements NotationDataInterface { static const saltName = "salt@notations.dart-pg.org"; static const headerFlagLength = 4; diff --git a/lib/src/packet/signature/policy_uri.dart b/lib/src/packet/signature/policy_uri.dart index 2993d91b..ad541a20 100644 --- a/lib/src/packet/signature/policy_uri.dart +++ b/lib/src/packet/signature/policy_uri.dart @@ -14,7 +14,7 @@ import '../signature_subpacket.dart'; /// This subpacket contains a URI of a document that describes the policy /// under which the signature was issued. /// Author Nguyen Van Nguyen -class PolicyURI extends SignatureSubpacket { +final class PolicyURI extends SignatureSubpacket { PolicyURI( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/preferred_aead_algorithms.dart b/lib/src/packet/signature/preferred_aead_algorithms.dart index ff1c99e1..065e975e 100644 --- a/lib/src/packet/signature/preferred_aead_algorithms.dart +++ b/lib/src/packet/signature/preferred_aead_algorithms.dart @@ -12,7 +12,7 @@ import '../signature_subpacket.dart'; /// PreferredAeadAlgorithms sub-packet class /// Author Nguyen Van Nguyen -class PreferredAeadAlgorithms extends SignatureSubpacket { +final class PreferredAeadAlgorithms extends SignatureSubpacket { PreferredAeadAlgorithms( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/preferred_aead_ciphers.dart b/lib/src/packet/signature/preferred_aead_ciphers.dart index 79c5a145..1c8e36c4 100644 --- a/lib/src/packet/signature/preferred_aead_ciphers.dart +++ b/lib/src/packet/signature/preferred_aead_ciphers.dart @@ -13,7 +13,7 @@ import '../signature_subpacket.dart'; /// The PreferredAeadCiphers sub-packet class /// Author Nguyen Van Nguyen -class PreferredAeadCiphers extends SignatureSubpacket { +final class PreferredAeadCiphers extends SignatureSubpacket { PreferredAeadCiphers( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/preferred_compression_algorithms.dart b/lib/src/packet/signature/preferred_compression_algorithms.dart index e08ac3d7..6c1f811c 100644 --- a/lib/src/packet/signature/preferred_compression_algorithms.dart +++ b/lib/src/packet/signature/preferred_compression_algorithms.dart @@ -13,7 +13,7 @@ import '../signature_subpacket.dart'; /// Compression algorithm numbers that indicate which algorithms the key /// holder prefers to use. /// Author Nguyen Van Nguyen -class PreferredCompressionAlgorithms extends SignatureSubpacket { +final class PreferredCompressionAlgorithms extends SignatureSubpacket { PreferredCompressionAlgorithms( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/preferred_hash_algorithms.dart b/lib/src/packet/signature/preferred_hash_algorithms.dart index 1f5be56f..cf498dc3 100644 --- a/lib/src/packet/signature/preferred_hash_algorithms.dart +++ b/lib/src/packet/signature/preferred_hash_algorithms.dart @@ -13,7 +13,7 @@ import '../signature_subpacket.dart'; /// Message digest algorithm numbers that indicate which algorithms the /// key holder prefers to receive. /// Author Nguyen Van Nguyen -class PreferredHashAlgorithms extends SignatureSubpacket { +final class PreferredHashAlgorithms extends SignatureSubpacket { PreferredHashAlgorithms( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/preferred_key_server.dart b/lib/src/packet/signature/preferred_key_server.dart index d8a84a72..ed8ce82d 100644 --- a/lib/src/packet/signature/preferred_key_server.dart +++ b/lib/src/packet/signature/preferred_key_server.dart @@ -13,7 +13,7 @@ import '../signature_subpacket.dart'; /// This is a URI of a key server that the key holder prefers be used for updates. /// Author Nguyen Van Nguyen -class PreferredKeyServer extends SignatureSubpacket { +final class PreferredKeyServer extends SignatureSubpacket { PreferredKeyServer( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/preferred_symmetric_algorithms.dart b/lib/src/packet/signature/preferred_symmetric_algorithms.dart index f31427e0..bcbe2974 100644 --- a/lib/src/packet/signature/preferred_symmetric_algorithms.dart +++ b/lib/src/packet/signature/preferred_symmetric_algorithms.dart @@ -13,7 +13,7 @@ import '../signature_subpacket.dart'; /// Symmetric algorithm numbers that indicate which algorithms the key /// holder prefers to use. /// Author Nguyen Van Nguyen -class PreferredSymmetricAlgorithms extends SignatureSubpacket { +final class PreferredSymmetricAlgorithms extends SignatureSubpacket { PreferredSymmetricAlgorithms( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/primary_user_id.dart b/lib/src/packet/signature/primary_user_id.dart index aeac5c62..d053ab2b 100644 --- a/lib/src/packet/signature/primary_user_id.dart +++ b/lib/src/packet/signature/primary_user_id.dart @@ -12,7 +12,7 @@ import '../signature_subpacket.dart'; /// 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. /// Author Nguyen Van Nguyen -class PrimaryUserID extends SignatureSubpacket { +final class PrimaryUserID extends SignatureSubpacket { PrimaryUserID(final Uint8List data, {super.critical, super.isLong}) : super(SignatureSubpacketType.primaryUserID, data); diff --git a/lib/src/packet/signature/regular_expression.dart b/lib/src/packet/signature/regular_expression.dart index ed6794c9..ecb438e4 100644 --- a/lib/src/packet/signature/regular_expression.dart +++ b/lib/src/packet/signature/regular_expression.dart @@ -14,7 +14,7 @@ import '../signature_subpacket.dart'; /// Used in conjunction with trust Signature packets (of level > 0) to /// limit the scope of trust that is extended. /// Author Nguyen Van Nguyen -class RegularExpression extends SignatureSubpacket { +final class RegularExpression extends SignatureSubpacket { RegularExpression(final Uint8List data, {super.critical, super.isLong}) : super(SignatureSubpacketType.revocable, data); diff --git a/lib/src/packet/signature/revocable.dart b/lib/src/packet/signature/revocable.dart index c0b3c6f3..001f4aa1 100644 --- a/lib/src/packet/signature/revocable.dart +++ b/lib/src/packet/signature/revocable.dart @@ -12,7 +12,7 @@ import '../signature_subpacket.dart'; /// Signature's revocability status. The packet body contains a /// Boolean flag indicating whether the signature is revocable. /// Author Nguyen Van Nguyen -class Revocable extends SignatureSubpacket { +final class Revocable extends SignatureSubpacket { Revocable( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/revocation_key.dart b/lib/src/packet/signature/revocation_key.dart index f40e8eac..233ec53e 100644 --- a/lib/src/packet/signature/revocation_key.dart +++ b/lib/src/packet/signature/revocation_key.dart @@ -14,7 +14,7 @@ import '../signature_subpacket.dart'; /// Authorizes the specified key to issue revocation signatures for this key. /// Author Nguyen Van Nguyen -class RevocationKey extends SignatureSubpacket { +final class RevocationKey extends SignatureSubpacket { RevocationKey(final Uint8List data, {super.critical, super.isLong}) : super(SignatureSubpacketType.revocationKey, data); diff --git a/lib/src/packet/signature/revocation_reason.dart b/lib/src/packet/signature/revocation_reason.dart index 7e070236..1f2edc1f 100644 --- a/lib/src/packet/signature/revocation_reason.dart +++ b/lib/src/packet/signature/revocation_reason.dart @@ -14,7 +14,7 @@ import '../signature_subpacket.dart'; /// This subpacket is used only in key revocation and certification /// revocation signatures. /// Author Nguyen Van Nguyen -class RevocationReason extends SignatureSubpacket { +final class RevocationReason extends SignatureSubpacket { RevocationReason(final Uint8List data, {super.critical, super.isLong}) : super(SignatureSubpacketType.revocationReason, data); diff --git a/lib/src/packet/signature/signature_creation_time.dart b/lib/src/packet/signature/signature_creation_time.dart index 7d7597e7..be72202d 100644 --- a/lib/src/packet/signature/signature_creation_time.dart +++ b/lib/src/packet/signature/signature_creation_time.dart @@ -13,7 +13,7 @@ import '../signature_subpacket.dart'; /// The time the signature was made. /// MUST be present in the hashed area. /// Author Nguyen Van Nguyen -class SignatureCreationTime extends SignatureSubpacket { +final class SignatureCreationTime extends SignatureSubpacket { SignatureCreationTime( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/signature_expiration_time.dart b/lib/src/packet/signature/signature_expiration_time.dart index 30a04c66..92c19d31 100644 --- a/lib/src/packet/signature/signature_expiration_time.dart +++ b/lib/src/packet/signature/signature_expiration_time.dart @@ -14,7 +14,7 @@ import '../signature_subpacket.dart'; /// after the signature creation time that the signature expires. /// If this is not present or has a value of zero, it never expires. /// Author Nguyen Van Nguyen -class SignatureExpirationTime extends SignatureSubpacket { +final class SignatureExpirationTime extends SignatureSubpacket { SignatureExpirationTime( final Uint8List data, { super.critical, diff --git a/lib/src/packet/signature/signature_target.dart b/lib/src/packet/signature/signature_target.dart index 09aeed5c..0dd59208 100644 --- a/lib/src/packet/signature/signature_target.dart +++ b/lib/src/packet/signature/signature_target.dart @@ -13,7 +13,7 @@ import '../signature_subpacket.dart'; /// This subpacket identifies a specific target signature to which a signature refers. /// Author Nguyen Van Nguyen -class SignatureTarget extends SignatureSubpacket { +final class SignatureTarget extends SignatureSubpacket { SignatureTarget(final Uint8List data, {super.critical, super.isLong}) : super(SignatureSubpacketType.signatureTarget, data); diff --git a/lib/src/packet/signature/signer_user_id.dart b/lib/src/packet/signature/signer_user_id.dart index 54e6159a..fd1bc437 100644 --- a/lib/src/packet/signature/signer_user_id.dart +++ b/lib/src/packet/signature/signer_user_id.dart @@ -13,7 +13,7 @@ import '../signature_subpacket.dart'; /// This subpacket allows a keyholder to state which User ID is /// responsible for the signing. /// Author Nguyen Van Nguyen -class SignerUserID extends SignatureSubpacket { +final class SignerUserID extends SignatureSubpacket { SignerUserID(final Uint8List data, {super.critical, super.isLong}) : super(SignatureSubpacketType.signerUserID, data); diff --git a/lib/src/packet/signature/trust_signature.dart b/lib/src/packet/signature/trust_signature.dart index 047a4aa7..7c6ac8de 100644 --- a/lib/src/packet/signature/trust_signature.dart +++ b/lib/src/packet/signature/trust_signature.dart @@ -12,7 +12,7 @@ import '../signature_subpacket.dart'; /// Signer asserts that the key is not only valid but also trustworthy at /// the specified level. /// Author Nguyen Van Nguyen -class TrustSignature extends SignatureSubpacket { +final class TrustSignature extends SignatureSubpacket { TrustSignature(final Uint8List data, {super.critical, super.isLong}) : super(SignatureSubpacketType.trustSignature, data); diff --git a/lib/src/packet/sym_encrypted_data.dart b/lib/src/packet/sym_encrypted_data.dart index 5537f4c6..cf3716cc 100644 --- a/lib/src/packet/sym_encrypted_data.dart +++ b/lib/src/packet/sym_encrypted_data.dart @@ -15,10 +15,10 @@ import '../cryptor/symmetric/buffered_cipher.dart'; import '../enum/symmetric_algorithm.dart'; import 'base_packet.dart'; -/// Implementation of the Symmetrically Encrypted Data (SED) Packet - Type 9 +/// Symmetrically Encrypted Data (SED) Packet - Type 9 /// The encrypted contents will consist of more OpenPGP packets. /// Author Nguyen Van Nguyen -class SymEncryptedDataPacket extends BasePacket +final class SymEncryptedDataPacket extends BasePacket implements EncryptedDataPacketInterface { @override final Uint8List encrypted; diff --git a/lib/src/packet/sym_encrypted_integrity_protected_data.dart b/lib/src/packet/sym_encrypted_integrity_protected_data.dart index 0ccb4517..ae3effb0 100644 --- a/lib/src/packet/sym_encrypted_integrity_protected_data.dart +++ b/lib/src/packet/sym_encrypted_integrity_protected_data.dart @@ -19,7 +19,7 @@ import 'base_packet.dart'; /// Symmetric Encrypted Integrity Protected Data (SEIPD) Packet - Type 18 /// Author Nguyen Van Nguyen -class SymEncryptedIntegrityProtectedDataPacket extends BasePacket +final class SymEncryptedIntegrityProtectedDataPacket extends BasePacket implements EncryptedDataPacketInterface { static const saltSize = 32; static const mdcSuffix = [0xd3, 0x14]; diff --git a/lib/src/packet/sym_encrypted_session_key.dart b/lib/src/packet/sym_encrypted_session_key.dart index 27d0d9e1..61949739 100644 --- a/lib/src/packet/sym_encrypted_session_key.dart +++ b/lib/src/packet/sym_encrypted_session_key.dart @@ -19,9 +19,9 @@ import '../type/session_key.dart'; import 'base_packet.dart'; import 'key/session_key.dart'; -/// Implementation of the Symmetric Key Encrypted Session Key (SKESK) Packet - Type 3 +/// Symmetric Key Encrypted Session Key (SKESK) Packet - Type 3 /// Author Nguyen Van Nguyen -class SymEncryptedSessionKeyPacket extends BasePacket { +final class SymEncryptedSessionKeyPacket extends BasePacket { final int version; final SymmetricAlgorithm symmetric; diff --git a/lib/src/packet/trust.dart b/lib/src/packet/trust.dart index f2ee76b8..4504d7b4 100644 --- a/lib/src/packet/trust.dart +++ b/lib/src/packet/trust.dart @@ -8,9 +8,9 @@ import 'dart:typed_data'; import 'base_packet.dart'; -/// Implementation of the Trust (TRUST) Packet - Type 12 +/// Trust (TRUST) Packet - Type 12 /// Author Nguyen Van Nguyen -class TrustPacket extends BasePacket { +final class TrustPacket extends BasePacket { final Uint8List levelAndTrustAmount; TrustPacket(this.levelAndTrustAmount) : super(PacketType.trust); diff --git a/lib/src/packet/user_attribute.dart b/lib/src/packet/user_attribute.dart index a3fd4dd2..f0816df9 100644 --- a/lib/src/packet/user_attribute.dart +++ b/lib/src/packet/user_attribute.dart @@ -13,9 +13,10 @@ import 'image_user_attribute.dart'; import 'subpacket_reader.dart'; import 'user_attribute_subpacket.dart'; -/// Implementation of the User Attribute (UAT) Packet - Type 17 +/// User Attribute (UAT) Packet - Type 17 /// Author Nguyen Van Nguyen -class UserAttributePacket extends BasePacket implements UserIDPacketInterface { +final class UserAttributePacket extends BasePacket + implements UserIDPacketInterface { final List attributes; UserAttributePacket(this.attributes) : super(PacketType.userAttribute); diff --git a/lib/src/packet/user_id.dart b/lib/src/packet/user_id.dart index c032e976..78b2e7cf 100644 --- a/lib/src/packet/user_id.dart +++ b/lib/src/packet/user_id.dart @@ -11,9 +11,9 @@ import '../common/helpers.dart'; import '../type/user_id_packet.dart'; import 'base_packet.dart'; -/// Implementation of the User ID (UID) Packet - Type 13 +/// User ID (UID) Packet - Type 13 /// Author Nguyen Van Nguyen -class UserIDPacket extends BasePacket implements UserIDPacketInterface { +final class UserIDPacket extends BasePacket implements UserIDPacketInterface { final String userID; final String name;