MCPcopy
hub / github.com/authlib/authlib / test_aes_gcm_jwe

Function test_aes_gcm_jwe

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

Source from the content-addressed store, hash-verified

223
224
225def test_aes_gcm_jwe():
226 jwe = JsonWebEncryption()
227 sizes = [128, 192, 256]
228 _enc_choices = [
229 "A128CBC-HS256",
230 "A192CBC-HS384",
231 "A256CBC-HS512",
232 "A128GCM",
233 "A192GCM",
234 "A256GCM",
235 ]
236 for s in sizes:
237 alg = f"A{s}GCMKW"
238 key = os.urandom(s // 8)
239 for enc in _enc_choices:
240 protected = {"alg": alg, "enc": enc}
241 data = jwe.serialize_compact(protected, b"hello", key)
242 rv = jwe.deserialize_compact(data, key)
243 assert rv["payload"] == b"hello"
244
245
246def test_aes_gcm_jwe_invalid_key():

Callers

nothing calls this directly

Calls 3

serialize_compactMethod · 0.95
deserialize_compactMethod · 0.95
JsonWebEncryptionClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…