Skip to content

IbrahimS11/Cryptography

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔐 Hima Chat – Cryptography-Focused Secure Messaging System

Hima Chat is a secure chat application built specifically to demonstrate and apply cryptography concepts in real-world communication systems.
The project focuses on encryption, key sharing, and secure message storage, rather than UI design or clean-code practices.


📌 Project Purpose

The main goal of this project is to:

  • Apply cryptographic algorithms in a real chat scenario
  • Protect sensitive data from attackers by storing encrypted messages only
  • Simulate secure key agreement between sender and receiver
  • Design the system to be extensible for adding new encryption algorithms

⚠️ This project is cryptography-oriented.
Topics such as clean code, advanced architecture patterns, or UI optimization are out of scope.


🧠 Core Cryptography Concepts Used

  • Symmetric Key Encryption
  • Shared Secret Keys
  • Plain Text → Cipher Text Transformation
  • Secure Data Storage (Encrypted at Rest)
  • Decryption Only with Matching Key & Algorithm

🛠️ Technologies Used

Backend

  • C#
  • ASP.NET Core MVC

Frontend

  • Razor Pages
  • HTML / CSS

Database

  • SQL Server

Development Tools

  • Visual Studio

🧩 System Overview

The system is divided into two main cryptography-related modules:

1️⃣ Secure Chat Creation

  • Sender and Receiver must:
    • Choose the same encryption algorithm
    • Use the same secret key
  • This shared configuration represents the cryptographic agreement

2️⃣ Encrypted Messaging

  • Messages are encrypted before being stored
  • Only encrypted data (Cipher Text) is saved in the database
  • Decryption is possible only if:
    • The correct key is used
    • The correct encryption algorithm is selected

🗄️ Database Design (Security-Oriented)

🧑 Users Table

Column Description
Email User identifier
FName First Name
LName Last Name
Password Stored securely

🔑 SymmetricKeys (Chats) Table

Column Description
EmailFrom Sender
EmailTo Receiver
Key Shared secret key
EncryptionType Selected algorithm
Time Chat creation time

💬 Messages Table

Column Description
Id Message ID
EmailFrom Sender
EmailTo Receiver
CipherText Encrypted message
TimeMessage Timestamp

⚠️ No plain text messages are stored in the database.


🔄 Application Flow (Cryptography Lifecycle)

1️⃣ User logs in

home


2️⃣ Sender creates a new chat

image image


3️⃣ Sender & Receiver agree on:

  • Encryption Algorithm
  • Secret Key
    4️⃣ Sender writes a message (Plain Text)
    5️⃣ System encrypts the message → Cipher Text
    6️⃣ Cipher Text is stored in the database
    7️⃣ Receiver:
  • Uses the same key & algorithm
  • Decrypts Cipher Text → Plain Text

✔️ Without the correct key and algorithm, messages are unreadable


🔌 Encryption API Design (Extensibility)

The system is designed to make adding new encryption algorithms simple and scalable.

To Add a New Encryption Type:

1️⃣ Create a new class with the same name as the encryption type

2️⃣ Implement the following static methods:

public static string Encrypt(string plainText, string key);
public static string Decrypt(string cipherText, string key);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors