Skip to content

MM-Robin/rsa_security_analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RSA Security & Fraud Detection Analysis

Project Overview

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.


Objectives

  • 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

Key Concepts Demonstrated

✔ Cryptographic Correctness

RSA key generation (n, φ(n), e, d)

  • Encryption / Decryption
  • Digital signatures and verification
  • Use of Python’s built-in pow() for correctness and reliability

✔ Security Engineering

  • Integrity verification during decryption
  • Fault injection simulation
  • Detection of incorrect key usage
  • Awareness of side-channel and fault-based risks

✔ Fraud Detection Perspective

  • Logging suspicious events as anomalies
  • Pattern accumulation from repeated faults
  • Understanding detection limits (no false security claims)
  • Translating cryptographic failures into fraud signals

Fraud & Anomaly Scenarios Tested

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.


Test Strategy

The test suite (test_rsa.py) is structured into:

  1. Basic correctness tests

    • Fraud simulation tests
    • Anomaly logging and inspection
  2. Fraud simulation tests

    • Wrong key usage
    • Fault injection scenarios
  3. Anomaly logging and inspection

    • Repeated abnormal behavior
    • Pattern accumulation

This mirrors how security and fraud teams validate systems in production.


Technologies Used

  • Python 3
  • Large integer arithmetic
  • Cryptographic modular exponentiation
  • Defensive programming and anomaly logging

Project Structure

src/
├── rsa.py # Abstract RSA interface
├── rsa_impl.py # Secure RSA implementation with anomaly detection
└── test_rsa.py # Correctness + fraud simulation tests

Background

This project originated as a university cryptography lab and was extended to reflect real-world security and fraud-detection scenarios.

Author

Mainuddin Monsur Robin

About

This project implements an RSA cryptographic system with a strong focus on security validation, fault detection, and fraud-relevant anomaly monitoring.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages