MCPcopy Create free account
hub / github.com/authlib/authlib / test_dir_alg

Function test_dir_alg

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

Source from the content-addressed store, hash-verified

1166
1167
1168def test_dir_alg():
1169 jwe = JsonWebEncryption()
1170 key = OctKey.generate_key(128, is_private=True)
1171 protected = {"alg": "dir", "enc": "A128GCM"}
1172 data = jwe.serialize_compact(protected, b"hello", key)
1173 rv = jwe.deserialize_compact(data, key)
1174 assert rv["payload"] == b"hello"
1175
1176 key2 = OctKey.generate_key(256, is_private=True)
1177 with pytest.raises(InvalidTag):
1178 jwe.deserialize_compact(data, key2)
1179
1180 with pytest.raises(ValueError):
1181 jwe.serialize_compact(protected, b"hello", key2)
1182
1183
1184def test_decryption_of_message_to_multiple_recipients_by_matching_key():

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