Commit 96bc698
committed
2.2.0 - Added export_private/public to KeyManager
The below list is mostly exhaustive list of all core changes in this version. Some small things may have been missed, but the majority
of changes are written below.
**New Features / Additions**
- `privex.helpers.crypto.KeyManager`
- Added `export_public` and `export_private` allowing you to export the currently loaded public/private key in KeyManager
- Added `export_key` which serialises a cryptography PrivateKey / PublicKey - intended for internal use by KeyManager, but
may be useful to others, so it's available as a public class method.
- Refactored `generate_keypair` to use `export_key`
- Added `identify_algorithm` which returns the string algorithm e.g. `'ed25519'` for a given cryptography PublicKey / PrivateKey instance
- Added attribute `type_name_map` which maps public/private key cryptography types to their string algorithm name
- Improved exception handling in `load_key` ensuring most common key decoding errors raise `InvalidFormat` instead of different package exceptions
- Added `Mocker` class to `helpers.common` - useful for mocking classes, or used as a makeshift replacement for modules/classes that couldn't be imported
- Added `mock_decorator` to `helpers.decorators` - intended to be used with `Mocker` - it's a decorator which simply... does nothing. purely pass-thru
- Added `HAS_CRYPTO` `HAS_SETUPPY_COMMON` `HAS_SETUPPY_BUMP` and `HAS_SETUPPY_COMMANDS` to `helpers.plugin` allowing for easier detection whether certain
modules are available or not (e.g. due to a user not having a certain dependency package installed).
**Testing**
- Re-wrote parts of the "How to use the unit tests" docs in `tests/__init__.py`
- Added PyTest skipping to tests/test_cache.py for redis tests (uses the new `Mocker` to ensure the tests work without PyTest installed)
- Added PyTest skipping to tests/test_net.py for dnspython tests (uses `Mocker` just like test_cache)
- Created a base class `CryptoBaseClass` for cryptography tests in `test_crypto.py`
- Moved signing/verification into a helper method `_sign_verify` in this base class
- Added new tests
- Split up KeyManager tests into `TestKeyManagerLoad`, `TestKeyManagerGeneration`, and `TestKeyManagerSignVerifyEncrypt`
- Added unit tests for outputting key pairs to files with `KeyManager.output_keypair`
- Added several unit tests for outputting and then loading key pairs from files with `KeyManager.load_keyfile`
- Added relatively thorough unit tests for the new `Mocker` class
**Documentation**
- Lots of small changes.
- Removed `:noindex:` from a lot of files because it was causing linking to classes/modules in pydoc comments to break.
This unfortunately means Sphinx throws a lot of warnings, but can't find a way to fix this without breaking class/module linking.
- Added docs for `Mocker` and `mock_decorator`
- Re-generated toctree files for various modules including `crypto` and `tests`1 parent e151da2 commit 96bc698
164 files changed
Lines changed: 2234 additions & 124 deletions
File tree
- docs/source
- _templates/autosummary
- helpers
- cache
- common
- mocker
- crypto
- keymanager
- decorators
- tests
- base
- privexbasecase
- test_bool
- testboolhelpers
- test_cache
- testcachedecoratormemory
- testcachedecoratorredis
- testmemorycache
- testrediscache
- test_crypto
- cryptobasecase
- testencrypthelper
- testkeymanagergeneration
- testkeymanagerload
- testkeymanagersignverifyencrypt
- test_general
- testgeneral
- testmocker
- test_net
- test_parse
- testparsehelpers
- test_rdns
- testipreversedns
- privex/helpers
- crypto
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments