e-mail address: omnetmanual@gmail.com

Phone number: +91 9444856435

Tel 7639361621

DEFENDER
  • Phd Omnet++ Projects
    • RESEARCH PROJECTS IN OMNET++
  • Network Simulator Research Papers
    • Omnet++ Thesis
    • Phd Omnet++ Projects
    • MS Omnet++ Projects
    • M.Tech Omnet++ Projects
    • Latest Omnet++ Projects
    • 2016 Omnet++ Projects
    • 2015 Omnet++ Projects
  • OMNET INSTALLATION
    • 4G LTE INSTALLATION
    • CASTALIA INSTALLATION
    • INET FRAMEWORK INSTALLATION
    • INETMANET INSTALLATION
    • JDK INSTALLATION
    • LTE INSTALLATION
    • MIXIM INSTALLATION
    • Os3 INSTALLATION
    • SUMO INSTALLATION
    • VEINS INSTALLATION
  • Latest Omnet++ Projects
    • AODV OMNET++ SOURCE CODE
    • VEINS OMNETPP
    • Network Attacks in OMNeT++
    • NETWORK SECURITY OMNET++ PROJECTS
    • Omnet++ Framework Tutorial
      • Network Simulator Research Papers
      • OMNET++ AD-HOC SIMULATION
      • OmneT++ Bandwidth
      • OMNET++ BLUETOOTH PROJECTS
      • OMNET++ CODE WSN
      • OMNET++ LTE MODULE
      • OMNET++ MESH NETWORK PROJECTS
      • OMNET++ MIXIM MANUAL
  • OMNeT++ Projects
    • OMNeT++ OS3 Manual
    • OMNET++ NETWORK PROJECTS
    • OMNET++ ROUTING EXAMPLES
    • OMNeT++ Routing Protocol Projects
    • OMNET++ SAMPLE PROJECT
    • OMNeT++ SDN PROJECTS
    • OMNET++ SMART GRID
    • OMNeT++ SUMO Tutorial
  • OMNET++ SIMULATION THESIS
    • OMNET++ TUTORIAL FOR WIRELESS SENSOR NETWORK
    • OMNET++ VANET PROJECTS
    • OMNET++ WIRELESS BODY AREA NETWORK PROJECTS
    • OMNET++ WIRELESS NETWORK SIMULATION
      • OMNeT++ Zigbee Module
    • QOS OMNET++
    • OPENFLOW OMNETPP
  • Contact

How to Implement Secure Email Communications in OMNeT++

To implement secure email communications in OMNeT++ has needs to follow numerous steps that includes to generate the simulation scenarios that encompasses the email clients and servers then state the network models, and execute secure email communication protocols. Now we are going to see how to implement the simple secure email communication simulation in OMNeT++ using the INET framework.

Step-by-Step Implementation:

Step 1: Install OMNeT++ and INET Framework

  1. Download OMNeT++:
    • Download the latest version of OMNeT++.
  2. Install OMNeT++:
    • Based on the operating system download the OMNet++.
  3. Download and Install INET Framework:
    • The INET framework offers models for internet protocols and is commonly used with OMNeT++.
    • We need to download it from the INET website.

Step 2: Set Up Your Project

  1. Create a New OMNeT++ Project:
    • Open the OMNeT++ IDE.
    • Go to File -> New -> OMNeT++ Project.
    • Enter a project name and select the appropriate options.
  2. Set Up Directory Structure:
    • Make sure the project has the essential folders, like src for source files and simulations for NED files and configuration.
  3. Add INET to Your Project:
    • Right-click on your project in the Project Explorer.
    • Select Properties -> Project References.
    • Check the box for INET.

Step 3: Define Network Models Using NED

  1. Create NED Files:
    • In the src directory, create a new NED file (e.g., SecureEmailNetwork.ned).
    • Describe the network topology in the NED file. Here’s a simple example:

package secureemail;

import inet.node.inet.StandardHost;

import inet.node.inet.Router;

import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;

import inet.physicallayer.common.packetlevel.RadioMedium;

import inet.mobility.single.RandomWaypointMobility;

network SecureEmailNetwork

{

parameters:

int numClients = default(5);

types:

channel radioChannel extends RadioMedium {}

submodules:

configurator: Ipv4NetworkConfigurator {

@display(“p=100,100”);

}

mailServer: StandardHost {

@display(“p=200,100”);

}

client[numClients]: StandardHost {

@display(“p=300+100*i,200”);

mobility.typename = “RandomWaypointMobility”;

}

radioMedium: radioChannel {

@display(“p=400,100”);

}

connections allowunconnected:

for i=0..numClients-1 {

client[i].wlan[0] <–> radioMedium <–> mailServer.wlan[0];

}

}

Step 4: Implement Secure Email Communication Logic

  1. Create C++ Modules for Email Communication:
    • In the src directory, generate new C++ classes like EmailClient.cc and EmailServer.cc.
    • Contain necessary OMNeT++ headers and describe the email communication logic.
  2. Email Client Implementation:

#include <omnetpp.h>

#include “inet/applications/base/ApplicationBase.h”

#include “inet/applications/udpapp/UdpBasicApp.h”

#include “inet/networklayer/common/L3AddressResolver.h”

#include “inet/networklayer/contract/ipv4/Ipv4Address.h”

#include “inet/networklayer/contract/IL3AddressType.h”

using namespace omnetpp;

using namespace inet;

class EmailClient : public ApplicationBase

{

protected:

virtual void initialize(int stage) override;

virtual void handleMessageWhenUp(cMessage *msg) override;

void sendEmail();

void handleEmail(cPacket *pkt);

cMessage *sendEvent = nullptr;

};

Define_Module(EmailClient);

void EmailClient::initialize(int stage)

{

ApplicationBase::initialize(stage);

if (stage == INITSTAGE_LOCAL) {

sendEvent = new cMessage(“sendEmail”);

scheduleAt(simTime() + par(“startTime”), sendEvent);

}

}

void EmailClient::handleMessageWhenUp(cMessage *msg)

{

if (msg == sendEvent) {

sendEmail();

scheduleAt(simTime() + par(“sendInterval”), sendEvent);

} else {

cPacket *pkt = check_and_cast<cPacket *>(msg);

handleEmail(pkt);

}

}

void EmailClient::sendEmail()

{

// Create and send an email packet

EV << “Sending email” << endl;

cPacket *pkt = new cPacket(“Email”);

pkt->setByteLength(par(“emailSize”));

send(pkt, “lowerLayerOut”);

}

void EmailClient::handleEmail(cPacket *pkt)

{

// Handle received email packet

EV << “Received email: ” << pkt->getName() << endl;

delete pkt;

}

  1. Email Server Implementation:

#include <omnetpp.h>

#include “inet/applications/base/ApplicationBase.h”

#include “inet/applications/udpapp/UdpBasicApp.h”

#include “inet/networklayer/common/L3AddressResolver.h”

#include “inet/networklayer/contract/ipv4/Ipv4Address.h”

#include “inet/networklayer/contract/IL3AddressType.h”

using namespace omnetpp;

using namespace inet;

class EmailServer : public ApplicationBase

{

protected:

virtual void initialize(int stage) override;

virtual void handleMessageWhenUp(cMessage *msg) override;

void handleEmail(cPacket *pkt);

};

Define_Module(EmailServer);

void EmailServer::initialize(int stage)

{

ApplicationBase::initialize(stage);

}

void EmailServer::handleMessageWhenUp(cMessage *msg)

{

if (msg->isSelfMessage()) {

delete msg;

} else {

cPacket *pkt = check_and_cast<cPacket *>(msg);

handleEmail(pkt);

}

}

void EmailServer::handleEmail(cPacket *pkt)

{

// Handle received email packet

EV << “Received email: ” << pkt->getName() << endl;

delete pkt;

}

Step 5: Implement Security Mechanisms

  1. Secure Email Communication:
    • Execute security mechanisms like encryption and decryption for email messages. We need use libraries like OpenSSL for encryption.
    • Update the sendEmail and handleEmail approaches to contain encryption and decryption.
  2. Example: Encryption and Decryption:

#include <openssl/rsa.h>

#include <openssl/pem.h>

#include <openssl/err.h>

void encryptEmail(cPacket *pkt)

{

// Encrypt the email packet using RSA encryption

std::string plainText = pkt->getName();

std::string encryptedText;

RSA *rsa = RSA_new();

// Load RSA public key

FILE *pubKeyFile = fopen(“public.pem”, “r”);

PEM_read_RSA_PUBKEY(pubKeyFile, &rsa, NULL, NULL);

fclose(pubKeyFile);

unsigned char encrypted[256];

int result = RSA_public_encrypt(plainText.length(), (unsigned char*)plainText.c_str(), encrypted, rsa, RSA_PKCS1_OAEP_PADDING);

if(result == -1) {

char err[130];

ERR_load_crypto_strings();

ERR_error_string(ERR_get_error(), err);

EV << “Encryption failed: ” << err << endl;

} else {

encryptedText = std::string((char*)encrypted, result);

pkt->setName(encryptedText.c_str());

}

RSA_free(rsa);

}

 

void decryptEmail(cPacket *pkt)

{

// Decrypt the email packet using RSA decryption

std::string encryptedText = pkt->getName();

std::string decryptedText;

RSA *rsa = RSA_new();

// Load RSA private key

FILE *privKeyFile = fopen(“private.pem”, “r”);

PEM_read_RSAPrivateKey(privKeyFile, &rsa, NULL, NULL);

fclose(privKeyFile);

unsigned char decrypted[256];

int result = RSA_private_decrypt(encryptedText.length(), (unsigned char*)encryptedText.c_str(), decrypted, rsa, RSA_PKCS1_OAEP_PADDING);

if(result == -1) {

char err[130];

ERR_load_crypto_strings();

ERR_error_string(ERR_get_error(), err);

EV << “Decryption failed: ” << err << endl;

} else {

decryptedText = std::string((char*)decrypted, result);

pkt->setName(decryptedText.c_str());

}

RSA_free(rsa);

}

  1. Integrate Encryption/Decryption in Email Client and Server:

void EmailClient::sendEmail()

{

// Create and send an email packet

EV << “Sending email” << endl;

cPacket *pkt = new cPacket(“Email”);

pkt->setByteLength(par(“emailSize”));

encryptEmail(pkt);

send(pkt, “lowerLayerOut”);

}

void EmailServer::handleEmail(cPacket *pkt)

{

// Handle received email packet

EV << “Received email: ” << pkt->getName() << endl;

decryptEmail(pkt);

EV << “Decrypted email: ” << pkt->getName() << endl;

delete pkt;

}

Step 6: Configure Simulation Parameters

  1. Create omnetpp.ini:
    • In the simulations directory, create an omnetpp.ini file.
    • Define simulation parameters, such as the duration and network parameters:

network = SecureEmailNetwork

sim-time-limit = 100s

# Mobility

**.client[*].mobility.bounds = “0,0,1000,1000”

**.client[*].mobility.speed = uniform(1mps, 10mps)

# Email client parameters

**.client[*].udpApp.startTime = uniform(0s, 10s)

**.client[*].udpApp.sendInterval = exponential(1s)

**.client[*].udpApp.emailSize = 1024B

**.client[*].udpApp.localPort = 1000

**.client[*].udpApp.destPort = 2000

# Email server parameters

**.mailServer.udpApp.localPort = 2000

Step 7: Build and Run the Simulation

  1. Build the Project:
    • In the OMNeT++ IDE, right-click on project and choose Build Project.
  2. Run the Simulation:
    • Go to Run -> Run Configurations.
    • Set up a new run configuration for your project and run the simulation.

Step 8: Analyse Results

  1. View Simulation Results:
    • After the simulation completes, use OMNeT++’s tools to evaluate the outcomes.
    • Open the ANF (Analysis Framework) to visualize and understand the data.

As we discussed earlier about how the secure email communications will perform in OMNeT++ tool and we help to provide further information about how the OMNeT++ will adapt in different circumstance. For the implementation of secure email communications within OMNeT++, you may contact us to obtain optimal simulation and project performance outcomes from our expert developers. Our team specializes in network modeling and the execution of secure email communication protocols.

Related Topics

  • Network Intrusion Detection Projects
  • Computer Science Phd Topics
  • Iot Thesis Ideas
  • Cyber Security Thesis Topics
  • Network Security Research Topics

designed by OMNeT++ Projects .