MCPcopy Create free account
hub / github.com/mpdavis/python-jose / TestCryptographyAesKeywrap

Class TestCryptographyAesKeywrap

tests/algorithms/test_AES.py:44–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42@pytest.mark.cryptography
43@pytest.mark.skipif(CryptographyAESKey is None, reason="Cryptography backend not available")
44class 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…