summaryrefslogtreecommitdiffstatshomepage
path: root/tests/extmod/ucryptolib_aes128_cbc.py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2018-01-07 15:14:36 +0200
committerDamien George <damien.p.george@gmail.com>2018-06-27 14:56:31 +1000
commitbf77f348196c5f34e48093e5e6db9bee0e8cd42c (patch)
tree00463668d170e1498f44763c8faa9f5ca5d16e84 /tests/extmod/ucryptolib_aes128_cbc.py
parent567bc2d6ce18f55e7a1d2c8e023ead44f5c2cc45 (diff)
downloadmicropython-bf77f348196c5f34e48093e5e6db9bee0e8cd42c.tar.gz
micropython-bf77f348196c5f34e48093e5e6db9bee0e8cd42c.zip
tests/extmod/ucryptolib*: Add tests for ucryptolib module.
Diffstat (limited to 'tests/extmod/ucryptolib_aes128_cbc.py')
-rw-r--r--tests/extmod/ucryptolib_aes128_cbc.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/extmod/ucryptolib_aes128_cbc.py b/tests/extmod/ucryptolib_aes128_cbc.py
new file mode 100644
index 0000000000..4c5ea6acb2
--- /dev/null
+++ b/tests/extmod/ucryptolib_aes128_cbc.py
@@ -0,0 +1,15 @@
+try:
+ from Crypto.Cipher import AES
+ aes = AES.new
+except ImportError:
+ try:
+ from ucryptolib import aes
+ except ImportError:
+ print("SKIP")
+ raise SystemExit
+
+crypto = aes(b"1234" * 4, 2, b"5678" * 4)
+enc = crypto.encrypt(bytes(range(32)))
+print(enc)
+crypto = aes(b"1234" * 4, 2, b"5678" * 4)
+print(crypto.decrypt(enc))