-
Notifications
You must be signed in to change notification settings - Fork 11
breaking!: Reorganize atchops #770
base: trunk
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,16 @@ | ||
| library at_chops; | ||
| // export cryptography wrappers | ||
| export 'src/hashing/hashing.dart'; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added files named after the directories in src to make export management easier. |
||
| export 'src/encryption/encryption.dart'; | ||
| export 'src/signing/signing.dart'; | ||
| export 'src/padding/padding.dart'; | ||
|
|
||
| export 'src/algorithm/aes_encryption_algo.dart'; | ||
| export 'src/algorithm/algo_type.dart'; | ||
| export 'src/algorithm/at_iv.dart'; | ||
| export 'src/algorithm/default_signing_algo.dart'; | ||
| export 'src/algorithm/ecc_signing_algo.dart'; | ||
| export 'src/algorithm/pkam_signing_algo.dart'; | ||
| export 'src/algorithm/rsa_encryption_algo.dart'; | ||
| export 'src/at_chops_base.dart'; | ||
| export 'src/at_chops_impl.dart'; | ||
| // export inteface types | ||
| export 'src/key/key.dart'; | ||
| export 'src/model/model.dart'; | ||
|
|
||
| // Class to encrypt/decrypt atKeys file based on the password specified. | ||
| export 'src/at_keys_crypto.dart'; | ||
| export 'src/key/at_key_pair.dart'; | ||
| export 'src/key/at_private_key.dart'; | ||
| export 'src/key/at_public_key.dart'; | ||
| export 'src/key/impl/aes_key.dart'; | ||
| export 'src/key/impl/at_chops_keys.dart'; | ||
| export 'src/key/impl/at_encryption_key_pair.dart'; | ||
| export 'src/key/impl/at_pkam_key_pair.dart'; | ||
| export 'src/key/key_type.dart'; | ||
| export 'src/metadata/at_signing_input.dart'; | ||
| export 'src/metadata/encryption_metadata.dart'; | ||
| export 'src/metadata/encryption_result.dart'; | ||
| export 'src/metadata/signing_metadata.dart'; | ||
| export 'src/metadata/signing_result.dart'; | ||
|
|
||
| // A model class which represents the encrypted AtKeys with a passphrase. | ||
| export 'src/model/at_encrypted.dart'; | ||
| // export at_platform cryptography wrappers | ||
| export 'src/at_platform/at_platform.dart'; | ||
|
|
||
| // Class representing the hashing parameters to pass to an hashing algorithm. | ||
| export 'src/model/hash_params.dart' hide HashParams; | ||
| export 'src/util/at_chops_util.dart'; | ||
| // misc | ||
| export 'src/at_chops_util.dart'; | ||
| export 'src/at_keys_crypto.dart'; | ||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,8 +3,9 @@ import 'dart:convert'; | |
| import 'dart:typed_data'; | ||
|
|
||
| import 'package:at_chops/at_chops.dart'; | ||
| import 'package:at_chops/src/factory/at_hashing_algo_factory.dart'; | ||
| import 'package:at_chops/src/model/hash_params.dart'; | ||
| import 'package:at_chops/src/encryption/encryption.dart'; | ||
| import 'package:at_chops/src/hashing/hashing.dart'; | ||
| import 'package:at_chops/src/at_chops_util.dart'; | ||
| import 'package:at_commons/at_commons.dart'; | ||
|
|
||
| /// An abstract class that provides cryptographic operations for AtKeys using | ||
|
|
@@ -65,7 +66,7 @@ class _AtKeysCryptoImpl implements AtKeysCrypto { | |
| String hashKey = | ||
| await _getHashKey(passPhrase, _hashingAlgoType, hashParams: hashParams); | ||
|
|
||
| AESKey aesKey = AESKey(hashKey); | ||
| AtAESKey aesKey = AtAESKey(hashKey); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. renamed to prevent namespace collisions with other packages. |
||
| StringAESEncryptor atEncryptionAlgorithm = StringAESEncryptor(aesKey); | ||
|
|
||
| InitialisationVector iv = AtChopsUtil.generateRandomIV(16); | ||
|
|
@@ -92,7 +93,7 @@ class _AtKeysCryptoImpl implements AtKeysCrypto { | |
| // 1. Generate hash key based on the hashing algo type: | ||
| String hashKey = | ||
| await _getHashKey(passPhrase, _hashingAlgoType, hashParams: hashParams); | ||
| AESKey aesKey = AESKey(hashKey); | ||
| AtAESKey aesKey = AtAESKey(hashKey); | ||
| StringAESEncryptor atEncryptionAlgorithm = StringAESEncryptor(aesKey); | ||
|
|
||
| Uint8List iv = base64Decode(atEncrypted.iv!); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,18 +2,18 @@ import 'dart:async'; | |
| import 'dart:typed_data'; | ||
|
|
||
| import 'package:at_chops/at_chops.dart'; | ||
| import 'package:at_chops/src/algorithm/at_algorithm.dart'; | ||
| import 'package:at_chops/src/algorithm/default_hashing_algo.dart'; | ||
| import 'package:at_chops/src/factory/at_hashing_algo_factory.dart'; | ||
| import 'package:at_chops/src/model/signing_result.dart'; | ||
|
|
||
| /// Base class for all Cryptographic and Hashing Operations. Callers have to either implement | ||
| /// specific encryption, signing or hashing algorithms. Otherwise default implementation of specific algorithms will be used. | ||
| abstract class AtChops { | ||
| final AtChopsKeys _atChopsKeys; | ||
| AtChopsKeys get atChopsKeys; | ||
|
|
||
| AtChopsKeys get atChopsKeys => _atChopsKeys; | ||
| const AtChops.init(); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This constructor does nothing, it only exists to allow the class to be extended. |
||
|
|
||
| AtChops(this._atChopsKeys); | ||
| factory AtChops(AtChopsKeys keys) { | ||
| return AtChopsImpl(keys); | ||
| } | ||
|
|
||
| /// Returns an instance of [AtHashingAlgorithm] based on the provided [hashingAlgoType]. | ||
| /// | ||
|
|
@@ -87,7 +87,7 @@ abstract class AtChops { | |
| AtSigningResult verify(AtSigningVerificationInput verifyInput); | ||
|
|
||
| /// Create a hash of input [signedData] using a [hashingAlgorithm]. | ||
| /// Refer to [DefaultHash] for default implementation of hashing. | ||
| /// Refer to [Md5HashingAlgo] for default implementation of hashing. | ||
| String hash(Uint8List signedData, AtHashingAlgorithm hashingAlgorithm); | ||
|
|
||
| /// Reads a public key from a secure element or any other source | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example of the place we need the cast, atChopsKeys has been generalized