MCPcopy
hub / github.com/pyca/cryptography / test_xts_too_short

Method test_xts_too_short

tests/hazmat/primitives/test_aes.py:54–68  ·  view source on GitHub ↗
(self, backend, subtests)

Source from the content-addressed store, hash-verified

52 assert computed_pt == pt
53
54 def test_xts_too_short(self, backend, subtests):
55 for key in [
56 b"thirty_two_byte_keys_are_great!!",
57 b"\x00" * 32 + b"\x01" * 32,
58 ]:
59 with subtests.test():
60 key = b"\x00" * 32 + b"\x01" * 32
61 mode = modes.XTS(b"\x00" * 16)
62 alg = algorithms.AES(key)
63 if not backend.cipher_supported(alg, mode):
64 pytest.skip(f"AES-{alg.key_size}-XTS not supported")
65 cipher = base.Cipher(alg, mode)
66 enc = cipher.encryptor()
67 with pytest.raises(ValueError):
68 enc.update(b"0" * 15)
69
70 @pytest.mark.supported(
71 only_if=lambda backend: not rust_openssl.CRYPTOGRAPHY_IS_LIBRESSL,

Callers

nothing calls this directly

Calls 4

encryptorMethod · 0.95
testMethod · 0.80
cipher_supportedMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected