2023-09-13 12:33:51 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
[ "$1" = python3-cryptography ] || exit 0
|
|
|
|
|
2023-10-31 11:53:33 +08:00
|
|
|
python3 - << 'EOF'
|
|
|
|
|
2023-09-13 12:33:51 +08:00
|
|
|
from cryptography.fernet import Fernet
|
|
|
|
key = Fernet.generate_key()
|
|
|
|
f = Fernet(key)
|
2023-10-31 11:53:33 +08:00
|
|
|
msg = b"my deep dark secret"
|
|
|
|
token = f.encrypt(msg)
|
|
|
|
assert f.decrypt(token) == msg
|
|
|
|
|
2023-09-13 12:33:51 +08:00
|
|
|
EOF
|