MCPcopy
hub / github.com/authlib/authlib / test_dir_alg_c20p

Function test_dir_alg_c20p

tests/jose/test_chacha20.py:11–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9
10
11def test_dir_alg_c20p():
12 jwe = JsonWebEncryption()
13 key = OctKey.generate_key(256, is_private=True)
14 protected = {"alg": "dir", "enc": "C20P"}
15 data = jwe.serialize_compact(protected, b"hello", key)
16 rv = jwe.deserialize_compact(data, key)
17 assert rv["payload"] == b"hello"
18
19 key2 = OctKey.generate_key(128, is_private=True)
20 with pytest.raises(InvalidTag):
21 jwe.deserialize_compact(data, key2)
22
23 with pytest.raises(ValueError):
24 jwe.serialize_compact(protected, b"hello", key2)
25
26
27def test_dir_alg_xc20p():

Callers

nothing calls this directly

Calls 4

serialize_compactMethod · 0.95
deserialize_compactMethod · 0.95
JsonWebEncryptionClass · 0.90
generate_keyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…