cyber-security-resources/crypto/challenges/06_Digital_Signature_Forgery_Advanced.md

39 lines
923 B
Markdown
Raw Normal View History

# 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)
```