Skip to content

maahi271005/ICS_Project

Repository files navigation

Secure Message Transmission System

A secure IPC system demonstrating encryption, integrity checking, and key derivation using shared memory and semaphores.

Features

  • Single master key for both sender and receiver
  • Automatic key derivation for encryption and hashing
  • Message encryption with integrity verification
  • Detects message tampering

Building

make all        # Compile both programs
make clean      # Remove executables

Running

Important: Always start the receiver first!

Step-by-Step Instructions

  1. Open two terminal windows

  2. Terminal 1 - Start Receiver:

    cd /path/to/ICS_Project
    ./receiver
    • Enter the master key when prompted (e.g., mysecretkey123)
    • Wait for the message
  3. Terminal 2 - Start Sender:

    cd /path/to/ICS_Project
    ./sender
    • Enter the same master key as receiver (e.g., mysecretkey123)
    • Enter your message when prompted (e.g., Hello World)
    • Press Enter to send
  4. Check Terminal 1 - You should see the decrypted message!

Usage Example

Receiver:

=== RECEIVER: Secure Message Reception ===

Enter master key: mysecretkey123
Key received! Listening for incoming messages...

Waiting for message...

Wow! You got your text:
>>> Hello World <<<

=== RECEIVER: Reception Complete ===

Sender:

=== SENDER: Secure Message Transmission ===

Enter master key: mysecretkey123
Key received! Preparing secure channel...

Enter message to send: Hello World
Encrypting and sending message...
Waiting for receiver...

Message delivered successfully!

=== SENDER: Transmission Complete ===

How It Works

  1. Both programs enter the same master key
  2. System derives encryption and hash keys automatically
  3. Sender encrypts message and computes integrity hash
  4. Message sent via shared memory
  5. Receiver verifies integrity and decrypts
  6. Success: displays message | Failure: shows tamper warning

Key Points

  • Master Key: Any text (auto-padded to 32 chars)
  • Both must use identical keys for successful communication
  • Message limit: 256 bytes
  • Output on success: "Wow! You got your text: >>> message <<<"
  • Output on failure: "Oops! Sorry, the text was tampered!"

Troubleshooting

Issue Solution
"Text was tampered!" Use the same master key in both programs
Receiver hangs Start sender in second terminal
Shared memory error Run ipcrm -a to clean IPC resources

Cleanup

ipcs            # View IPC resources
ipcrm -a        # Remove all IPC resources

Note: Educational project only - not for production use.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors