MCPcopy Create free account
hub / github.com/mpdavis/python-jose / test_jwe_with_excessive_data

Method test_jwe_with_excessive_data

tests/test_jwe.py:530–539  ·  view source on GitHub ↗
(self, monkeypatch)

Source from the content-addressed store, hash-verified

528
529 @pytest.mark.skipif(AESKey is None, reason="No AES backend")
530 def test_jwe_with_excessive_data(self, monkeypatch):
531 enc = ALGORITHMS.A256CBC_HS512
532 alg = ALGORITHMS.RSA_OAEP_256
533 monkeypatch.setattr("jose.constants.JWE_SIZE_LIMIT", 1024)
534 encrypted = jwe.encrypt(b"Text" * 64 * 1024, PUBLIC_KEY_PEM, enc, alg)
535 header = json.loads(base64url_decode(encrypted.split(b".")[0]))
536 with pytest.raises(JWEError) as excinfo:
537 actual = jwe.decrypt(encrypted, PRIVATE_KEY_PEM)
538 assert "JWE string" in str(excinfo.value)
539 assert "bytes exceeds" in str(excinfo.value)
540
541 @pytest.mark.skipif(AESKey is None, reason="No AES backend")
542 def test_jwe_zip_with_excessive_data(self, monkeypatch):

Callers

nothing calls this directly

Calls 3

base64url_decodeFunction · 0.90
encryptMethod · 0.45
decryptMethod · 0.45

Tested by

no test coverage detected