| 42 | @pytest.mark.cryptography |
| 43 | @pytest.mark.skipif(CryptographyAESKey is None, reason="Cryptography backend not available") |
| 44 | class TestCryptographyAesKeywrap: |
| 45 | @pytest.mark.parametrize("alg,hex_key,hex_kek,expected", VECTORS) |
| 46 | def test_wrap(self, alg, hex_key, hex_kek, expected): |
| 47 | bin_key = unhexlify(hex_key) |
| 48 | bin_kek = unhexlify(hex_kek) |
| 49 | aes_key = CryptographyAESKey(bin_kek, alg) |
| 50 | actual = hexlify(aes_key.wrap_key(bin_key)).upper() |
| 51 | assert actual == expected |
| 52 | |
| 53 | @pytest.mark.parametrize("alg,expected,hex_kek,hex_wrapped", VECTORS) |
| 54 | def test_unwrap(self, alg, expected, hex_kek, hex_wrapped): |
| 55 | bin_kek = unhexlify(hex_kek) |
| 56 | bin_wrapped = unhexlify(hex_wrapped) |
| 57 | aes_key = CryptographyAESKey(bin_kek, alg) |
| 58 | actual = hexlify(aes_key.unwrap_key(bin_wrapped)).upper() |
| 59 | assert actual == expected |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…