aboutsummaryrefslogtreecommitdiffstats
path: root/doc/python
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-02 14:43:56 +0000
committerlloyd <[email protected]>2010-03-02 14:43:56 +0000
commit64d264518a7c9c0cfa64e70e9f146d1e92e42523 (patch)
tree35ece6f7f1fc788f79ad6d38d4a929e04a57f4b0 /doc/python
parent6148e7cccc50023955ef7c3d86709c5197ae78e7 (diff)
Corrupt signature instead of key in RSA example
Diffstat (limited to 'doc/python')
-rwxr-xr-xdoc/python/rsa.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/doc/python/rsa.py b/doc/python/rsa.py
index 15ffcffa3..09ca22314 100755
--- a/doc/python/rsa.py
+++ b/doc/python/rsa.py
@@ -26,6 +26,9 @@ print plaintext == key
signature = rsa_priv.sign(key, 'EMSA4(SHA-256)', rng)
-key = key.replace('a', 'b')
+print rsa_pub.verify(key, signature, 'EMSA4(SHA-256)')
+
+# Corrupt the signature, make sure it doesn't verify
+signature = signature.replace(signature[0], '0')
print rsa_pub.verify(key, signature, 'EMSA4(SHA-256)')