This project implements an RSA cryptographic system with a strong focus on security validation, fault detection, and fraud-relevant anomaly monitoring.
Rather than treating cryptography as a black box, this project explores:
- What RSA can detect
- What RSA cannot detect
- How cryptographic failures translate into fraud signals in real systems
The project combines cryptography theory, secure implementation, and fraud detection thinking.
- Implement RSA encryption, decryption, and signing using large integers
- Ensure cryptographic correctness and realistic behavior
- Detect and log anomalies caused by:
- Wrong key usage
- Fault injection
- Integrity mismatches
- Demonstrate why ciphertext tampering cannot be detected by RSA alone
RSA key generation (n, φ(n), e, d)
- Encryption / Decryption
- Digital signatures and verification
- Use of Python’s built-in pow() for correctness and reliability
- Integrity verification during decryption
- Fault injection simulation
- Detection of incorrect key usage
- Awareness of side-channel and fault-based risks
- Logging suspicious events as anomalies
- Pattern accumulation from repeated faults
- Understanding detection limits (no false security claims)
- Translating cryptographic failures into fraud signals
| Scenario | Detected | Explanation |
|---|---|---|
| Ciphertext tampering | ❌ No | RSA consistency holds without authentication |
| Repeated tampering | ❌ No | Requires signatures / MACs |
| Wrong private key | ✅ Yes | Decryption integrity fails |
| Fault injection | ✅ Yes | Re-encryption mismatch detected |
This reflects real-world fraud systems, where not all attacks are detectable.
The test suite (test_rsa.py) is structured into:
-
Basic correctness tests
- Fraud simulation tests
- Anomaly logging and inspection
-
Fraud simulation tests
- Wrong key usage
- Fault injection scenarios
-
Anomaly logging and inspection
- Repeated abnormal behavior
- Pattern accumulation
This mirrors how security and fraud teams validate systems in production.
- Python 3
- Large integer arithmetic
- Cryptographic modular exponentiation
- Defensive programming and anomaly logging
src/
├── rsa.py # Abstract RSA interface
├── rsa_impl.py # Secure RSA implementation with anomaly detection
└── test_rsa.py # Correctness + fraud simulation tests
This project originated as a university cryptography lab and was extended to reflect real-world security and fraud-detection scenarios.
Mainuddin Monsur Robin