MCPcopy
hub / github.com/authlib/authlib / test_not_supported_alg

Function test_not_supported_alg

tests/jose/test_jwe.py:64–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62
63
64def test_not_supported_alg():
65 public_key = read_file_path("rsa_public.pem")
66 private_key = read_file_path("rsa_private.pem")
67
68 jwe = JsonWebEncryption()
69 s = jwe.serialize_compact(
70 {"alg": "RSA-OAEP", "enc": "A256GCM"}, "hello", public_key
71 )
72
73 jwe = JsonWebEncryption(algorithms=["RSA1_5", "A256GCM"])
74 with pytest.raises(errors.UnsupportedAlgorithmError):
75 jwe.serialize_compact(
76 {"alg": "RSA-OAEP", "enc": "A256GCM"},
77 "hello",
78 public_key,
79 )
80 with pytest.raises(errors.UnsupportedCompressionAlgorithmError):
81 jwe.serialize_compact(
82 {"alg": "RSA1_5", "enc": "A256GCM", "zip": "DEF"},
83 "hello",
84 public_key,
85 )
86 with pytest.raises(errors.UnsupportedAlgorithmError):
87 jwe.deserialize_compact(
88 s,
89 private_key,
90 )
91
92 jwe = JsonWebEncryption(algorithms=["RSA-OAEP", "A192GCM"])
93 with pytest.raises(errors.UnsupportedEncryptionAlgorithmError):
94 jwe.serialize_compact(
95 {"alg": "RSA-OAEP", "enc": "A256GCM"},
96 "hello",
97 public_key,
98 )
99 with pytest.raises(errors.UnsupportedCompressionAlgorithmError):
100 jwe.serialize_compact(
101 {"alg": "RSA-OAEP", "enc": "A192GCM", "zip": "DEF"},
102 "hello",
103 public_key,
104 )
105 with pytest.raises(errors.UnsupportedEncryptionAlgorithmError):
106 jwe.deserialize_compact(
107 s,
108 private_key,
109 )
110
111
112def test_inappropriate_sender_key_for_serialize_compact():

Callers

nothing calls this directly

Calls 4

serialize_compactMethod · 0.95
deserialize_compactMethod · 0.95
read_file_pathFunction · 0.90
JsonWebEncryptionClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…