Create 06_Digital_Signature_Forgery_Advanced.md

This commit is contained in:
Omar Santos 2023-08-15 09:59:54 -04:00 committed by GitHub
parent 0cd4c91d5b
commit 8613977ff3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,38 @@
# Challenge 6: Digital Signature Forgery
**Level:** Advanced
**Description:**
Provide a digital signature scheme with a weakness (e.g., using a small prime number). Forge a digital signature for a new message.
**Challenge Text:**
```
Signature scheme: RSA with n = 391, e = 3, d = 107
Signed message: ("HELLO", signature = 220)
Challenge: Forge a signature for the message "WORLD"
```
**Instructions:**
1. Understand the weakness in the provided RSA signature scheme.
2. Forge a signature for the new message.
3. Validate the forged signature.
**Answer:**
For the message "WORLD," a forged signature could be 115.
**Code:**
```python
n = 391
e = 3
message = "WORLD"
# Compute numeric representation of message
message_numeric = sum([ord(c) * (256 ** i) for i, c in enumerate(message[::-1])])
# Compute forged signature
forged_signature = message_numeric ** e % n
print("Forged signature:", forged_signature)
```