A secure IPC system demonstrating encryption, integrity checking, and key derivation using shared memory and semaphores.
- Single master key for both sender and receiver
- Automatic key derivation for encryption and hashing
- Message encryption with integrity verification
- Detects message tampering
make all # Compile both programs
make clean # Remove executablesImportant: Always start the receiver first!
-
Open two terminal windows
-
Terminal 1 - Start Receiver:
cd /path/to/ICS_Project ./receiver- Enter the master key when prompted (e.g.,
mysecretkey123) - Wait for the message
- Enter the master key when prompted (e.g.,
-
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
- Enter the same master key as receiver (e.g.,
-
Check Terminal 1 - You should see the decrypted message!
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 ===
- Both programs enter the same master key
- System derives encryption and hash keys automatically
- Sender encrypts message and computes integrity hash
- Message sent via shared memory
- Receiver verifies integrity and decrypts
- Success: displays message | Failure: shows tamper warning
- 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!"
| 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 |
ipcs # View IPC resources
ipcrm -a # Remove all IPC resourcesNote: Educational project only - not for production use.