()
| 9 | |
| 10 | |
| 11 | def 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 | |
| 27 | def test_dir_alg_xc20p(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…