summaryrefslogtreecommitdiff
path: root/lang/python/python-cryptography/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lang/python/python-cryptography/test.sh')
-rw-r--r--lang/python/python-cryptography/test.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/lang/python/python-cryptography/test.sh b/lang/python/python-cryptography/test.sh
new file mode 100644
index 000000000..b706d561a
--- /dev/null
+++ b/lang/python/python-cryptography/test.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+[ "$1" = python3-cryptography ] || exit 0
+
+python3 - << EOF
+import sys
+from cryptography.fernet import Fernet
+key = Fernet.generate_key()
+f = Fernet(key)
+token = f.encrypt(b"my deep dark secret")
+sys.exit(0 if f.decrypt(token) == b"my deep dark secret" else 1)
+EOF