mirror of https://github.com/OpenKMIP/PyKMIP.git
Fix test_mac_with_cryptographic_failure unit test.
This test is meant to intentionally trigger an exception in the cryptography library by creating a CMAC with a non-block cipher algorithm, IDEA. That doesn't work any more because IDEA is now treated as a block cipher algorithm. To fix this, we now use the ARC4 algorithm instead, which does trigger the expected exception.
This commit is contained in:
parent
f0a44b26ce
commit
0b63de97ee
|
@ -269,8 +269,7 @@ class CryptographyEngine(api.CryptographicEngine):
|
||||||
)
|
)
|
||||||
cipher_algorithm = self._symmetric_key_algorithms.get(algorithm)
|
cipher_algorithm = self._symmetric_key_algorithms.get(algorithm)
|
||||||
try:
|
try:
|
||||||
# ARC4 and IDEA algorithms will raise exception as CMAC
|
# ARC4 and other non-block cipher algorithms will raise TypeError exceptions
|
||||||
# requires block ciphers
|
|
||||||
c = cmac.CMAC(cipher_algorithm(key), backend=default_backend())
|
c = cmac.CMAC(cipher_algorithm(key), backend=default_backend())
|
||||||
c.update(data)
|
c.update(data)
|
||||||
mac_data = c.finalize()
|
mac_data = c.finalize()
|
||||||
|
|
|
@ -247,8 +247,8 @@ class TestCryptographyEngine(testtools.TestCase):
|
||||||
|
|
||||||
engine = crypto.CryptographyEngine()
|
engine = crypto.CryptographyEngine()
|
||||||
|
|
||||||
# IDEA is not block cipher so cmac should raise exception
|
# RC4 is not block cipher so cmac should raise exception
|
||||||
args = [enums.CryptographicAlgorithm.IDEA, key, data]
|
args = [enums.CryptographicAlgorithm.RC4, key, data]
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
exceptions.CryptographicFailure,
|
exceptions.CryptographicFailure,
|
||||||
engine.mac,
|
engine.mac,
|
||||||
|
|
Loading…
Reference in New Issue