# Path: jose/constants.py
# ALGORITHMS = Algorithms()
# 
# Path: jose/exceptions.py
# class JWEError(JOSEError):
#     """Base error for all JWE errors"""
# 
#     pass


import pytest
    from jose.backends.cryptography_backend import CryptographyAESKey
from jose.constants import ALGORITHMS
from jose.exceptions import JWEError
    CryptographyAESKey is None, reason="Multiple crypto backends not available for backend compatibility tests"
)
class TestBackendAesCompatibility:
    @pytest.mark.parametrize("backend_decrypt", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("backend_encrypt", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("algorithm", ALGORITHMS.AES_PSEUDO)
    def test_encryption_parity(self, backend_encrypt, backend_decrypt, algorithm):
        if "128" in algorithm:
            key = b"8slRzzty6dKMaFCP"
        elif "192" in algorithm:
            key = b"8slRzzty6dKMaFCP8slRzzty"
        else:
            key = b"8slRzzty6dKMaFCP8slRzzty6dKMaFCP"

        key_encrypt = backend_encrypt(key, algorithm)
        key_decrypt = backend_decrypt(key, algorithm)
        plain_text = b"test"
        aad = b"extra data" if "GCM" in algorithm else None

        iv, cipher_text, tag = key_encrypt.encrypt(plain_text, aad)

        # verify decrypt to original plain text
        actual = key_decrypt.decrypt(cipher_text, iv, aad, tag)
        assert actual == plain_text

        with pytest.raises(JWEError):
            key_decrypt.decrypt(b"n" * 64)

    @pytest.mark.parametrize("backend_key_wrap", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("backend_key_unwrap", CRYPTO_BACKENDS)

# Path: jose/constants.py
# ALGORITHMS = Algorithms()
# 
# Path: jose/exceptions.py
# class JWEError(JOSEError):
#     """Base error for all JWE errors"""
# 
#     pass


# Path: tests/algorithms/test_AES_compat.py
import pytest
    from jose.backends.cryptography_backend import CryptographyAESKey
from jose.constants import ALGORITHMS
from jose.exceptions import JWEError

    CryptographyAESKey is None, reason="Multiple crypto backends not available for backend compatibility tests"
)
class TestBackendAesCompatibility:
    @pytest.mark.parametrize("backend_decrypt", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("backend_encrypt", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("algorithm", ALGORITHMS.AES_PSEUDO)
    def test_encryption_parity(self, backend_encrypt, backend_decrypt, algorithm):
        if "128" in algorithm:
            key = b"8slRzzty6dKMaFCP"
        elif "192" in algorithm:
            key = b"8slRzzty6dKMaFCP8slRzzty"
        else:
            key = b"8slRzzty6dKMaFCP8slRzzty6dKMaFCP"

        key_encrypt = backend_encrypt(key, algorithm)
        key_decrypt = backend_decrypt(key, algorithm)
        plain_text = b"test"
        aad = b"extra data" if "GCM" in algorithm else None

        iv, cipher_text, tag = key_encrypt.encrypt(plain_text, aad)

        # verify decrypt to original plain text
        actual = key_decrypt.decrypt(cipher_text, iv, aad, tag)
        assert actual == plain_text

        with pytest.raises(JWEError):
            key_decrypt.decrypt(b"n" * 64)

    @pytest.mark.parametrize("backend_key_wrap", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("backend_key_unwrap", CRYPTO_BACKENDS)

    @pytest.mark.parametrize("algorithm", ALGORITHMS.AES_KW)