mirror of
https://github.com/openwrt/packages.git
synced 2026-06-13 17:11:32 +08:00
python-rsa: bump to 4.9.1
Changelog: https://github.com/sybrenstuvel/python-rsa/blob/main/CHANGELOG.md Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
This commit is contained in:
committed by
Alexandru Ardelean
parent
1b53e6c07f
commit
349bf45ee1
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$1" = python3-rsa ] || exit 0
|
||||
|
||||
python3 - << 'EOF'
|
||||
|
||||
import rsa
|
||||
|
||||
# Generate keys
|
||||
(pub, priv) = rsa.newkeys(512)
|
||||
|
||||
# Sign and verify
|
||||
message = b"Hello OpenWrt"
|
||||
signature = rsa.sign(message, priv, "SHA-256")
|
||||
verified = rsa.verify(message, signature, pub)
|
||||
assert verified == "SHA-256", f"expected SHA-256, got {verified}"
|
||||
|
||||
# Encrypt and decrypt
|
||||
encrypted = rsa.encrypt(message, pub)
|
||||
decrypted = rsa.decrypt(encrypted, priv)
|
||||
assert decrypted == message, f"decryption failed"
|
||||
|
||||
EOF
|
||||
Reference in New Issue
Block a user