Skip to content
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

Add encryption to SACC file #59

Closed
wants to merge 1 commit into from

Conversation

arthurmloureiro
Copy link
Contributor

@arthurmloureiro arthurmloureiro commented Oct 18, 2024

Related to #58

Add encryption and decryption functionalities for SACC files.

  • Encryption and Decryption:

    • Add generate_encryption_key, encrypt_data, and decrypt_data methods in src/smokescreen/datavector.py.
    • Modify save_concealed_datavector method to encrypt the SACC file before saving.
    • Add decrypt_sacc_file function in src/smokescreen/datavector.py.
  • Main Function:

    • Update main function in src/smokescreen/__main__.py to handle encryption and decryption.
    • Add decrypt, encrypted_file_path, and encryption_key_path arguments to the main function.
  • Tests:

    • Add tests for generate_encryption_key, encrypt_data, and decrypt_data methods in tests/test_datavector.py.
    • Add tests for the modified save_concealed_datavector method.
    • Add tests for decrypt_sacc_file function.
  • Documentation:

    • Add a section in docs/source/usage.rst to document the encryption and decryption functionalities.
  • Dependencies:

    • Add cryptography as a dependency in pyproject.toml and environment.yml.

Needs testing if the Fernet lib actually works with sacc!


For more details, open the Copilot Workspace session.

Related to #58

Add encryption and decryption functionalities for SACC files.

* **Encryption and Decryption**:
  - Add `generate_encryption_key`, `encrypt_data`, and `decrypt_data` methods in `src/smokescreen/datavector.py`.
  - Modify `save_concealed_datavector` method to encrypt the SACC file before saving.
  - Add `decrypt_sacc_file` function in `src/smokescreen/datavector.py`.

* **Main Function**:
  - Update `main` function in `src/smokescreen/__main__.py` to handle encryption and decryption.
  - Add `decrypt`, `encrypted_file_path`, and `encryption_key_path` arguments to the `main` function.

* **Tests**:
  - Add tests for `generate_encryption_key`, `encrypt_data`, and `decrypt_data` methods in `tests/test_datavector.py`.
  - Add tests for the modified `save_concealed_datavector` method.
  - Add tests for `decrypt_sacc_file` function.

* **Documentation**:
  - Add a section in `docs/source/usage.rst` to document the encryption and decryption functionalities.

* **Dependencies**:
  - Add `cryptography` as a dependency in `pyproject.toml` and `environment.yml`.

Needs testing if the Fernet lib actually works with sacc!

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/LSSTDESC/Smokescreen/issues/58?shareId=XXXX-XXXX-XXXX-XXXX).
@arthurmloureiro arthurmloureiro self-assigned this Oct 18, 2024
@arthurmloureiro
Copy link
Contributor Author

There are some unecessary files generated by the test with copilot spaces that should be removed before mergning

@arthurmloureiro
Copy link
Contributor Author

pytest results:

FAILED tests/test_datavector.py::test_save_concealed_datavector - AttributeError: 'Sacc' object has no attribute 'to_fits'. Did you mean: 'load_fits'?
FAILED tests/test_datavector.py::test_decrypt_sacc_file - AttributeError: type object 'Sacc' has no attribute 'from_fits'

@arthurmloureiro arthurmloureiro added data-vector blinding Issues related to data-vector blinding SACC SACC file format related issues labels Oct 22, 2024
@arthurmloureiro
Copy link
Contributor Author

Unsure if we can actually encrypt a fits file with this library. Maybe we need to encrypt the data instead. Needs further investigation.

@arthurmloureiro arthurmloureiro linked an issue Oct 22, 2024 that may be closed by this pull request
7 tasks
@arthurmloureiro arthurmloureiro deleted the arthurmloureiro/add-encryption branch November 12, 2024 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data-vector blinding Issues related to data-vector blinding SACC SACC file format related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant