Skip to content

Deals with Issue #61, one line code change fix to a test (latter in second commit) #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 25 commits into from

Conversation

4gatepylon
Copy link

Deals with Issue #61
(#61)

Fixes the sphinx linking issue on readthedocs. Also makes a small fix to a buggy test. Read the second commit message for details on this.

A lot of seeming change is just python black reformatting the code to look as it should.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

No files were moved, added, or removed. Just edited.

mattsb42-aws and others added 23 commits June 20, 2019 17:36
Add keyring interface
* Adding Keyring API

* Delete __init__.py

* Delete raw_keyring.py

* Added docstring to public class

* Edited docstring

* Edited docstring again

* Changes in docstring statements

* Docstring changes

* Changes in docstring

* Raw keyring initial

* Raw keyring encrypt commit

* Encrypt functions for Raw RSA and AES

* Raw RSA and AES initial

* Changes in raw keyrings according to new keyring materials

* Updated with autoformat

* Modified base

* Corrected tox and flake errors

* Docstring error correction

* Added docstrings and corrected errors

* Some more changes in docstrings

* Updating base API

* Made all suggested changes

* Corrected tox and flake8 errors

* Minor change in raw-keyrings

* Adding Keyring API

* Delete __init__.py

* Delete raw_keyring.py

* Added docstring to public class

* Edited docstring

* Edited docstring again

* Changes in docstring statements

* Docstring changes

* Changes in docstring

* Raw keyring initial

* Raw keyring encrypt commit

* Encrypt functions for Raw RSA and AES

* Raw RSA and AES initial

* bump attrs to 19.1.0

* add keyring trace and integrate into updated encrytion/decryption materials

* s/KeyRing/Keyring/g

* align cryptographic materials and add write-only interface

* encrypted_data_keys must only contain EncryptedDataKey

* fix test to be Python 2 compatible

* Changes in raw keyrings according to new keyring materials

* Updated with autoformat

* Modified base

* data encryption key must be set before encrypted data keys can be added to EncryptionMaterials

* Corrected tox and flake errors

* Docstring error correction

* Added docstrings and corrected errors

* Some more changes in docstrings

* Updating base API

* add signing/verification key checks to Encryption/DecryptionMaterials

* DecryptionMaterials.algorithm must be set before DecryptionMaterials.add_data_encryption_key can be called

* update materials docs and typehints

* Made all suggested changes

* EncryptionMaterials must not be initialized with encrypted_data_keys but no data_encryption_key

* add is_complete properties to EncryptionMaterials and DecryptionMaterials

* Corrected tox and flake8 errors

* Minor change in raw-keyrings

* change KeyringTraceFlag values to bitshifted ints to match other implementations

* normalize EncryptionMaterials._encrypted_data_keys to list and encrypted_data_keys to tuple

* temporarily pin pydocstyle at <4.0.0 to avoid issue breaking flake8-docstrings

* temporarily cap pydocstyle at <4.0.0 for decrypt oracle

* Changes to keyring trace in raw keyrings

* Adding test files

* Adding tests

* Changed data encryption key type to RawDataKey

* Added keyring trace to pytest encryption materials

* Changed value of keyring_trace.wrapping_key

* Few changes to match new API

* Tox errors

* Functional tests pass

* Formatting errors corrected and functional tests pass

* Corrected too broad exception error and deleted empty return statement from tests

* Changed Exeception to BaseException to solve broad exception error

* Added suppress broad exception

* Added pylint disable broad exception

* Changed wrapping keys for RSA keyrings from WrappingKey to cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey/RSAPublicKey

* Fixed tox errors

* More tox errors

* Moved code for generation of plaintext to be before the check for key being private or public

* Tox errors

* Added metaclass to base API and unit tests for base API

* Changed metaclass to six.add_metaclass in base API

* Fixed pylint errors

* Fixed more pylint errors

* Removed RawAESKeyring instance

* Changed on_encrypt_helper to generate_data_key and removed on_decrypt_helper. Renamed base API unit test file

* Changed docstring for generate_data_key

* Changed decryption_materials.data_key to decryption_materials.data_encryption_key and fixed pylint errors

* Fixed pylint errors

* Changed raw keyrings to have class methods for PEM and DER encoded keys

* Unit tests for raw keyrings

* Changes for PEM encoding

* Changed base API to remove metaclass and modified tests

* Delete raw_keyring.py

* Delete test_f_keyring_raw_aes.py

* Delete test_f_keyring_raw_rsa.py

* Delete test_keyring_raw_aes.py

* Delete test_keyring_raw_rsa.py

* Suggested changes

* Made suggested changes to base API and tests

* Made suggested changes to base API tests

* Ignore commit

* Corrected tox and pylint errors in base API unit tests

* Removed try except for Iterable

* Removed try except for Iterable from test_utils

* Added try except for Iterable in base API

* Resolved isort errors
* Adding Keyring API

* Delete __init__.py

* Delete raw_keyring.py

* Added docstring to public class

* Edited docstring

* Edited docstring again

* Changes in docstring statements

* Docstring changes

* Changes in docstring

* Raw keyring initial

* Raw keyring encrypt commit

* Encrypt functions for Raw RSA and AES

* Raw RSA and AES initial

* Changes in raw keyrings according to new keyring materials

* Updated with autoformat

* Modified base

* Corrected tox and flake errors

* Docstring error correction

* Added docstrings and corrected errors

* Some more changes in docstrings

* Updating base API

* Made all suggested changes

* Corrected tox and flake8 errors

* Minor change in raw-keyrings

* Adding Keyring API

* Delete __init__.py

* Delete raw_keyring.py

* Added docstring to public class

* Edited docstring

* Edited docstring again

* Changes in docstring statements

* Docstring changes

* Changes in docstring

* Raw keyring initial

* Raw keyring encrypt commit

* Encrypt functions for Raw RSA and AES

* Raw RSA and AES initial

* bump attrs to 19.1.0

* add keyring trace and integrate into updated encrytion/decryption materials

* s/KeyRing/Keyring/g

* align cryptographic materials and add write-only interface

* encrypted_data_keys must only contain EncryptedDataKey

* fix test to be Python 2 compatible

* Changes in raw keyrings according to new keyring materials

* Updated with autoformat

* Modified base

* data encryption key must be set before encrypted data keys can be added to EncryptionMaterials

* Corrected tox and flake errors

* Docstring error correction

* Added docstrings and corrected errors

* Some more changes in docstrings

* Updating base API

* add signing/verification key checks to Encryption/DecryptionMaterials

* DecryptionMaterials.algorithm must be set before DecryptionMaterials.add_data_encryption_key can be called

* update materials docs and typehints

* Made all suggested changes

* EncryptionMaterials must not be initialized with encrypted_data_keys but no data_encryption_key

* add is_complete properties to EncryptionMaterials and DecryptionMaterials

* Corrected tox and flake8 errors

* Minor change in raw-keyrings

* change KeyringTraceFlag values to bitshifted ints to match other implementations

* normalize EncryptionMaterials._encrypted_data_keys to list and encrypted_data_keys to tuple

* temporarily pin pydocstyle at <4.0.0 to avoid issue breaking flake8-docstrings

* temporarily cap pydocstyle at <4.0.0 for decrypt oracle

* Changes to keyring trace in raw keyrings

* Adding test files

* Adding tests

* Changed data encryption key type to RawDataKey

* Added keyring trace to pytest encryption materials

* Changed value of keyring_trace.wrapping_key

* Few changes to match new API

* Tox errors

* Functional tests pass

* Formatting errors corrected and functional tests pass

* Corrected too broad exception error and deleted empty return statement from tests

* Changed Exeception to BaseException to solve broad exception error

* Added suppress broad exception

* Added pylint disable broad exception

* Changed wrapping keys for RSA keyrings from WrappingKey to cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey/RSAPublicKey

* Fixed tox errors

* More tox errors

* Moved code for generation of plaintext to be before the check for key being private or public

* Tox errors

* Added metaclass to base API and unit tests for base API

* Changed metaclass to six.add_metaclass in base API

* Fixed pylint errors

* Fixed more pylint errors

* Removed RawAESKeyring instance

* Changed on_encrypt_helper to generate_data_key and removed on_decrypt_helper. Renamed base API unit test file

* Changed docstring for generate_data_key

* Changed decryption_materials.data_key to decryption_materials.data_encryption_key and fixed pylint errors

* Fixed pylint errors

* Changed raw keyrings to have class methods for PEM and DER encoded keys

* Unit tests for raw keyrings

* Changes for PEM encoding

* Made suggested changes to raw keyrings

* partial commit for raw keyrings

* Made suggested changes

* Changed wrapping_key_id in deserialize_wrapped_key() back to self.key_name

* Decryption and PEM input now works

* Adding sample

* Removed test comments

* Unit tests for raw aes and rsa

* All unit tests working

* All unit tests done. Functional tests - key_info_prefix_vectors for AES and compatibility with MKP for RSA remaining

* Delete sample_aes.py

* Corrected tox and pylint errors

* Removed print statements used while debugging

* Partial commit for changes to tests

* Partial commit for tests for raw keyrings

* All tests except compatibility of raw rsa with mkp and key info prefix in raw aes

* Pulled from keyring branch

* Updated base API

* Added test for key info prefix

* Changed unittest.mock to mock

* Raw keyrings test partial commit

* All tests for raw keyrings work

* Removed unused imports

* Removed unused imports
* Adding Keyring API

* Delete __init__.py

* Delete raw_keyring.py

* Added docstring to public class

* Edited docstring

* Edited docstring again

* Changes in docstring statements

* Docstring changes

* Changes in docstring

* Raw keyring initial

* Raw keyring encrypt commit

* Encrypt functions for Raw RSA and AES

* Raw RSA and AES initial

* raw keyrings first commit

* Multi keyring first commit

* Changes in the base file

* Temporary changes in multiple files

* Committing initial code

* Deleted raw aes test

* Multi Keyrings

* Updating base API and raw keyrings

* Corrected tox errors

* Added typehints

* Updated raw keyrings

* Updated raw keyrings

* Changes in error conditions for multi keyrings

* Made all suggested changes in multi-keyrings

* Corrected tox errors

* Added docstring to __attrs_post_init__

* Changed variable name neither_generator_nor_children_defined to neither_generator_nor_children

* Changed raw keyrings

* Corrected tox errors

* Updated raw keyrings

* Updated raw keyrings and functional test for multi keyrings

* Functional tests for multi-keyrings work

* Autoformat errors corrected and changed Exception to BaseException to solve broad exception error

* Added pylint disable broad except to raw keyrings and added multi parametrize to multi keyrings functional test

* Removed duplicate import statements

* Changes in functional test for multi keyrings according to change in raw keyrings

* Changed RSA key structure to RSAPublicKey/RSAPrivateKey and functional test passes

* Removed unwanted commented lines from test

* Pylint errors

* More pylint errors

* Made suggested changes in multi keyring

* Multi keyring unit tests

* Optimized loop for decryption keyring

* Unit tests for multi keyrings and added sample encryption materials and multi keyrings in test_utils

* Multi keyrings unit tests

* Making changes in tests and API

* Almost all unit tests done

* Unit tests for multi keyrings

* Unit tests for multi keyrings

* Unit tests for multi-keyrings working except the one to check if no further keyrings are called if data encryption key is added

* Made changes in raw keyrings to match the latest version

* Removed unused imports

* Made suggested changes

* Removed unused imports

* Resolved formatting errors

* Made suggested changes - partial

* Made all suggested changes

* apply autoformatting x_x
…all changes so formatting

may be slightly different, but it should be the same functionality wise.  I have a couple errors
that I believe are not from my own changes (they were there on master when I pulled and pertain to
there not being valid AWS credentials for tests for the most part), but they should not be important.
instead of AlgorithmSuite.  Changed messages in the docs accordingly.
Now if you go to RTD you will see everything links together nicely.

What I did not do: change the variable names from "algorithm" to i.e.
"algorithm_suite".  Mainly because this is a rabbit hole and not immediately
important I think.  To do it you need to change every single thing that
calls another thing that calls another thing that has "algorithm" instead
of "algorithm_suite" and I wanted to keep it simple.

I also found what I think was an incorrect test.  In
/test/integration/test_i_aws_encryption_sdk_client.py in function
test_remove_bad_client() there was an assertion error for my tox env tests
that the dict containing the regional clients was not empty when it should
have been supposedly.  I believe that it was not meant for it to be empty,
but for the bad client "us-fakey-12" to be removed, and it was assumed that
in __init__ for KMSMasterKeyProvider() no regional clients were added, but
this is false because there is a default added depending on some features
of the botocore session etc...  So when it was checking to see if it was
empty it wanted to see that a bad client was added, and then was rightfully
removed -> back to an empty dict, but if the dict did not start out empty
the test would fail.  So I made a one line change of this test to make it
test that specifically the dict did not contain the exact bad client that
the test was using.

Please get back to me on this final change because you guys know this SDK
way better than me and I don't want to break anything.  Thanks!
@4gatepylon
Copy link
Author

Also it looks like appveyor doesn't like some stuff not sure if it's me or the issue we found before?

@mattsb42-aws
Copy link
Member

mattsb42-aws commented Aug 6, 2019

Appveyor is a known issue #159.

Please run tox -re autoformat over this. There are a variety of formatting changes that look off. They might be because of the change from Algorithm to AlgorithmSuite though.

@mattsb42-aws
Copy link
Member

tox -re lint will also catch all of the other linters as well, if you want to check them locally before waiting on the CI.

@4gatepylon
Copy link
Author

Made the formatting changes. flake8 and pylint pass now for me locally, so I believe it should be ok.

@4gatepylon 4gatepylon mentioned this pull request Aug 13, 2019
@4gatepylon
Copy link
Author

Please go to PR #187 which is reset to correct commit.

@4gatepylon 4gatepylon closed this Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants