# Path: jose/constants.py
# ALGORITHMS = Algorithms()
# 
# Path: jose/exceptions.py
# class JWEError(JOSEError):
#     """Base error for all JWE errors"""
# 
#     pass
# 
# Path: tests/algorithms/test_RSA.py
# PRIVATE_KEYS = (
#     pytest.param(private_key_2048_pkcs1, id="RSA_2048_PKCS1"),
#     pytest.param(private_key_4096_pkcs1, id="RSA_4096_PKCS1"),
# )


import pytest
        import base64
    from jose.backends.cryptography_backend import CryptographyRSAKey
    from jose.backends.rsa_backend import RSAKey as PurePythonRSAKey
from jose.constants import ALGORITHMS
from jose.exceptions import JWEError
from .test_RSA import PRIVATE_KEYS
        key_sign = BackendSign(private_key, ALGORITHMS.RS256)
        key_verify = BackendVerify(private_key, ALGORITHMS.RS256).public_key()

        msg = b"test"
        sig = key_sign.sign(msg)

        # valid signature
        assert key_verify.verify(msg, sig)

        # invalid signature
        assert not key_verify.verify(msg, b"n" * 64)

    @pytest.mark.parametrize("encoding", ENCODINGS)
    @pytest.mark.parametrize("BackendFrom", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("BackendTo", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("private_key", PRIVATE_KEYS)
    def test_public_key_to_pem(self, BackendFrom, BackendTo, encoding, private_key):
        key = BackendFrom(private_key, ALGORITHMS.RS256)
        key2 = BackendTo(private_key, ALGORITHMS.RS256)

        key1_pem = key.public_key().to_pem(pem_format=encoding).strip()
        key2_pem = key2.public_key().to_pem(pem_format=encoding).strip()
        assert key1_pem == key2_pem

    @pytest.mark.parametrize("encoding", ENCODINGS)
    @pytest.mark.parametrize("BackendFrom", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("BackendTo", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("private_key", PRIVATE_KEYS)
    def test_private_key_to_pem(self, BackendFrom, BackendTo, encoding, private_key):
        key = BackendFrom(private_key, ALGORITHMS.RS256)

# Path: jose/constants.py
# ALGORITHMS = Algorithms()
# 
# Path: jose/exceptions.py
# class JWEError(JOSEError):
#     """Base error for all JWE errors"""
# 
#     pass
# 
# Path: tests/algorithms/test_RSA.py
# PRIVATE_KEYS = (
#     pytest.param(private_key_2048_pkcs1, id="RSA_2048_PKCS1"),
#     pytest.param(private_key_4096_pkcs1, id="RSA_4096_PKCS1"),
# )


# Path: tests/algorithms/test_RSA_compat.py
import pytest
        import base64
    from jose.backends.cryptography_backend import CryptographyRSAKey
    from jose.backends.rsa_backend import RSAKey as PurePythonRSAKey
from jose.constants import ALGORITHMS
from jose.exceptions import JWEError
from .test_RSA import PRIVATE_KEYS

        key_sign = BackendSign(private_key, ALGORITHMS.RS256)
        key_verify = BackendVerify(private_key, ALGORITHMS.RS256).public_key()

        msg = b"test"
        sig = key_sign.sign(msg)

        # valid signature
        assert key_verify.verify(msg, sig)

        # invalid signature
        assert not key_verify.verify(msg, b"n" * 64)

    @pytest.mark.parametrize("encoding", ENCODINGS)
    @pytest.mark.parametrize("BackendFrom", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("BackendTo", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("private_key", PRIVATE_KEYS)
    def test_public_key_to_pem(self, BackendFrom, BackendTo, encoding, private_key):
        key = BackendFrom(private_key, ALGORITHMS.RS256)
        key2 = BackendTo(private_key, ALGORITHMS.RS256)

        key1_pem = key.public_key().to_pem(pem_format=encoding).strip()
        key2_pem = key2.public_key().to_pem(pem_format=encoding).strip()
        assert key1_pem == key2_pem

    @pytest.mark.parametrize("encoding", ENCODINGS)
    @pytest.mark.parametrize("BackendFrom", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("BackendTo", CRYPTO_BACKENDS)
    @pytest.mark.parametrize("private_key", PRIVATE_KEYS)
    def test_private_key_to_pem(self, BackendFrom, BackendTo, encoding, private_key):
        key = BackendFrom(private_key, ALGORITHMS.RS256)

        key2 = BackendTo(private_key, ALGORITHMS.RS256)