| 444 | @pytest.mark.parametrize("enc", filter(lambda x: x in ALGORITHMS.SUPPORTED, ALGORITHMS.AES_ENC)) |
| 445 | @pytest.mark.parametrize("zip", ZIPS.SUPPORTED) |
| 446 | def test_encrypt_decrypt_dir_kw(self, enc, zip): |
| 447 | if enc == ALGORITHMS.A128GCM: |
| 448 | key = OCT_128_BIT_KEY |
| 449 | elif enc == ALGORITHMS.A192GCM: |
| 450 | key = OCT_192_BIT_KEY |
| 451 | elif enc in (ALGORITHMS.A128CBC_HS256, ALGORITHMS.A256GCM): |
| 452 | key = OCT_256_BIT_KEY |
| 453 | elif enc == ALGORITHMS.A192CBC_HS384: |
| 454 | key = OCT_384_BIT_KEY |
| 455 | elif enc == ALGORITHMS.A256CBC_HS512: |
| 456 | key = OCT_512_BIT_KEY |
| 457 | else: |
| 458 | pytest.fail(f"I don't know how to handle enc {enc}") |
| 459 | expected = b"Live long and prosper." |
| 460 | jwe_value = jwe.encrypt(expected[:], key, enc, ALGORITHMS.DIR, zip) |
| 461 | actual = jwe.decrypt(jwe_value, key) |
| 462 | assert actual == expected |
| 463 | |
| 464 | @pytest.mark.skipif(AESKey is None, reason="No AES backend") |
| 465 | def test_alg_enc_headers(self): |