aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/test_python.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripts/test_python.py')
-rw-r--r--src/scripts/test_python.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/scripts/test_python.py b/src/scripts/test_python.py
index 32e57bc0a..34233f6f9 100644
--- a/src/scripts/test_python.py
+++ b/src/scripts/test_python.py
@@ -70,6 +70,7 @@ class BotanPythonTests(unittest.TestCase):
def test_hmac(self):
hmac = botan2.message_authentication_code('HMAC(SHA-256)')
+ self.assertEqual(hmac.algo_name(), 'HMAC(SHA-256)')
hmac.set_key(hex_decode('0102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20'))
hmac.update(hex_decode('616263'))
@@ -93,6 +94,7 @@ class BotanPythonTests(unittest.TestCase):
def test_hash(self):
h = botan2.hash_function('SHA-256')
+ self.assertEqual(h.algo_name(), 'SHA-256')
assert h.output_length() == 32
h.update('ignore this please')
h.clear()
@@ -109,6 +111,13 @@ class BotanPythonTests(unittest.TestCase):
for mode in ['AES-128/CTR-BE', 'Serpent/GCM', 'ChaCha20Poly1305']:
enc = botan2.cipher(mode, encrypt=True)
+ if mode == 'AES-128/CTR-BE':
+ self.assertEqual(enc.algo_name(), 'CTR-BE(AES-128)')
+ elif mode == 'Serpent/GCM':
+ self.assertEqual(enc.algo_name(), 'Serpent/GCM(16)')
+ else:
+ self.assertEqual(enc.algo_name(), mode)
+
(kmin, kmax) = enc.key_length()
self.assertTrue(kmin <= kmax)
@@ -151,10 +160,11 @@ class BotanPythonTests(unittest.TestCase):
def test_rsa(self):
rng = botan2.rng()
rsapriv = botan2.private_key('RSA', '1024', rng)
- rsapub = rsapriv.get_public_key()
+ self.assertEqual(rsapriv.algo_name(), 'RSA')
- self.assertEqual(rsapub.estimated_strength(), 80)
+ rsapub = rsapriv.get_public_key()
self.assertEqual(rsapub.algo_name(), 'RSA')
+ self.assertEqual(rsapub.estimated_strength(), 80)
enc = botan2.pk_op_encrypt(rsapub, "OAEP(SHA-256)")
dec = botan2.pk_op_decrypt(rsapriv, "OAEP(SHA-256)")