cryptography/tests
Quentin Retourne d6cac753c2
Add support for decrypting S/MIME messages (#11555)
* first python API proposition

first round-trip tests

feat: made asn1 structures readable

refacto: adapted existing functions accordingly

feat/pkcs12: added symmetric_decrypt

feat: deserialize 3 possible encodings

feat: handling AES-128

feat: raise error when no recipient is found

feat/pkcs7: added decanonicalize function

feat/asn1: added decode_der_data

feat/pkcs7: added smime_enveloped_decode

tests are the round-trip (encrypt & decrypt)

more tests for 100% python coverage

test support pkcs7_encrypt with openssl

added algorithm to pkcs7_encrypt signature

refacto: decrypt function is clearer

flow is more natural

refacto: added all rust error tests

refacto: added another CA chain for checking

fix: const handling

Refactor PKCS7Decryptor to pkcs7_decrypt

refacto: removed SMIME_ENVELOPED_DECODE from rust code

refacto: removed decode_der_data

adapted tests accordingly

removed the PEM tag check

added tests for smime_decnonicalize

one more test case

Update src/rust/src/pkcs7.rs

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>

took comments into account

pem to der is now outside of decrypt

fix: removed test_support pkcs7_encrypt

added vector for aes_256_cbc encrypted pkcs7

feat: not using test_support decrypt anymore

added new vectors for PKCS7 tests

feat: using pkcs7 vectors

removed previous ones

fix: changed wrong function

feat: added certificate issuer check

test: generating the RSA chain

removed the vectors accordingly

moved symmetric_decrypt to pkcs7.rs

* Update src/cryptography/hazmat/primitives/serialization/pkcs7.py

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>

* fix: removed use of deprecated new_bound for PyBytes

* corrected some error types

* updated tests accordingly

* fix: handling other key encryption algorithms

added vectors & tests accordingly

* first attempts raising error when no header to remove

* one more test to handle text data without header

* fix: went back to the previous implementation

* refacto: removed the return part

* feat: Binary option does not seem useful for decryption

removed decanonicalization function

adapted tests accordingly

* moved logic into rust

only left some checks (for now?)

* removed pyfunction for the inner decrypt one

* added checks in rust now :)

changed name for clarity

* removed unused function

* some checks not needed anymore

* removed a parameter

* took comments into account

* removed unused import

removed excess get_type

* added first unwrap corrections

cleaned tests, added some others

added more vectors

* no more unwrap for parameter checks

* removing headers is Python now

added tests accordingly

will compare with OpenSSL

* final corrections?

* first version of documentation

some minor refactoring

* corrected doctests

* better indentation

* doctest: added RSA private key

* oops

---------

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2024-11-26 08:39:53 -05:00
..
bench Added a benchmark for fernet (#11088) 2024-06-08 07:52:13 -07:00
hazmat Add support for decrypting S/MIME messages (#11555) 2024-11-26 08:39:53 -05:00
wycheproof Updates for ruff 0.3.1 (#10548) 2024-03-07 10:57:37 -08:00
x509 fixes #11944 -- don't panic on attributes with no values (#11947) 2024-11-14 14:16:43 -08:00
__init__.py
conftest.py tests, ci: plumb x509-limbo-root (#9871) 2023-11-13 19:48:28 +00:00
deprecated_module.py
doubles.py
test_cryptography_utils.py Update CI for py3.11 release (#7743) 2022-10-26 14:44:03 +09:00
test_fernet.py Add support for extract_timestamp in MultiFernet (#11427) 2024-08-13 15:42:35 +00:00
test_meta.py
test_utils.py utils.int_to_bytes: guard against zero-length (#11173) 2024-06-29 15:23:57 +00:00
test_warnings.py
utils.py Ensure curves are supported in determinisic ECDSA tests (#10917) 2024-05-01 21:55:41 -07:00