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

Function test_alternate_aes_classes

tests/hazmat/primitives/test_aes.py:309–319  ·  view source on GitHub ↗
(mode, alg_cls, backend)

Source from the content-addressed store, hash-verified

307)
308@pytest.mark.parametrize("alg_cls", [algorithms.AES128, algorithms.AES256])
309def test_alternate_aes_classes(mode, alg_cls, backend):
310 alg = alg_cls(b"0" * (alg_cls.key_size // 8))
311 if not backend.cipher_supported(alg, mode):
312 pytest.skip(f"AES in {mode.name} mode not supported")
313 data = bytearray(b"sixteen_byte_msg")
314 cipher = base.Cipher(alg, mode, backend)
315 enc = cipher.encryptor()
316 ct = enc.update(data) + enc.finalize()
317 dec = cipher.decryptor()
318 pt = dec.update(ct) + dec.finalize()
319 assert pt == data
320
321
322def test_reset_nonce(backend):

Callers

nothing calls this directly

Calls 5

encryptorMethod · 0.95
decryptorMethod · 0.95
cipher_supportedMethod · 0.80
updateMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected