0% found this document useful (0 votes)
40 views23 pages

Mobile App Client Server-Caeser Encryption

theory of DC motor control by mobile application (MIT app inventor)

Uploaded by

Safaa Saadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views23 pages

Mobile App Client Server-Caeser Encryption

theory of DC motor control by mobile application (MIT app inventor)

Uploaded by

Safaa Saadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Chapter One

Introduction

1.1. Introduction

Network security address questions such as how to efficiently control access


to computer networks and distributed systems, and how to securely transmit data
between them.

The amount and variety of data that require to be secret today is immense,
but the problems of data security were recognized centuries ago. The records that
show that early Romans encrypted messages carried by couriers to distant
battlefields. Kings and queens kept secret the details of family madness and
peccadilloes. Nobles sent tokens (a ring, a seal) with their messages to prove their
source. Ancient religious stories complain of tax collectors and recount arguments
over the validity of their records. Like our ancestors, we design data security with
the tools that we have, and like them we still require data security to follow several
basic principles:

• Confidentiality Information must be kept secret

• Privacy Personal information must not be made generally available

• Integrity Data must not be changed unless the change is authorized

• Availability The information must be there when it is needed

• Non-repudiation

1
The sender must not be able to deny sending the information, and the
receiver must not be able to deny it was received

The difference today is the sophisticated manner in which we enable data


security, the array of approaches we use, and the multitude of places where
security is applied.

1.2 Computing Systems:

The term of computing system is referring to a single main processor, its


peripheral devices, its data, and its software. Such a system has a single operating
system and one set of users. All blocks of the computing system are located within
a small distance of rest of the system.

1.3 Goals and objectives

Implementing a network security by encryption/decryption of test in mobile


application is considered an important issue. Therefore, the main goal of this work
is based on design client/server mobile application to encrypt/decrypt text during
chat form. The encryption algorithm applied in work is Caesar.

The proposed model is designed to fulfill the following objectives:

1. Encrypt words content of the text using a Caesar algorithm.

2. Send encrypted text from client to server with secret key.

3. Decrypt the text in server side with same secret key.

2
3
1.4. Chapters Outlines

Chapter Two

Principles and fundamentals of network and data security, besides a proposal


algorithm in this work described in details.

Chapter Three

Design and implementation steps of proposal work described in details in


this chapter.

Chapter Four

This chapter contains the conclusion of proposed work and recommended


applies for future work.

4
Chapter Two

Principles and fundamentals

2.1. Cryptography Techniques

This chapter introduces the basic concepts in cryptography. Although this word
sounds fearful, we shall realize that it is very simple to understand. In fact, most
terms in computer security have very straightforward meaning terms. for no
reason. sound complicated.

In the early days. cryptography used to be performed by using manual


techniques. The basic framework of performing cryptography has remained more
or less the same. of course, with a lot of improvements in the actual
implementation. Therefore importantly, computers now perform these
cryptographic function algorithms. thus 1n,1king the process faster and secure.
This chapter, however; discusses the basic methods of achieving cryptography
without referring to con1puters.
The basic concepts in cryptography are introduced first. We then proceed to
discuss how we can make messages reliable, and thus. Secure [1].

Any communication in the language that you and I speak that is the human
language, takes the form of plain text or clear text. That is the message in plain text
can be understood by anybody knowing the language as long as the message is not
codified in any manner, For instance, when we speak with our family members.
Friends or colleagues. we use plain text because we do not want to hide anything
from them. Suppose I say “Hi Anita”, it is plain text because both Anita and I

5
know its meaning and intention. More significantly, anybody in the same room
would also get to hear these words. and would know that I am greeting Anita.
Notably. we also use plain text during electronic conversations. For instance.
When we send an email to someone, we compose the email message using English
(or these days another) language. For instance, I can compose the email message as
shown in Fig 2.1.

Figure (2.1) Example of a plain text message

Now. not only Amit, but also any other person who reads this email would know
what I have written. As before. This is simply because I am not using any codified
language here.
I have composed my email message using plain English This is another example of
plain text, albeit in written form.

In normal life, we do not bother much about the fact that someone could be
overhearing us. In most cases. that makes little difference lo us because the person
overhearing us can do little dan1age by using the overheard information after all,
we do not reveal n1an)" secrets in our day-to-day lives.
However, there are situations where we are concerned about the secrecy of our
conversations. For instance, suppose that I am interested in knowing my bank
account's balance and hence I call up my phone banker from my office. The phone

6
banker would generally ask a secret question (e.g. what is your mother’s maiden
name?) whose answer only I know.
This is to ascertain that someone else is not posing as me. Now, when I give
the answer to the secret question (e.g. Meena). I generally speak in low voice, or
better yet. initially call up from a phone that is isolated. This ensures that only the
intended receipt (the phone banker) gets to know the correct answer.

On the same lines, suppose that my email to any friend Anut earlier shown in Fig.
2.1 is confidential for some reason. Therefore. I do not want anyone else to
understand what I have written.

2.1.1 Caesar Cipher


The scheme illustrated m Fig. 2.2 was first proposed by Julius Caesar, and is
termed as Caesar Cipher. It was the first example of substitution cipher. In the
substitution cipher technique, the characters of a plain text message are replaced by
other characters, numbers or symbols.
Caesar Cipher is a special case of substitution techniques wherein each alphabet in
a message is replaced by an alphabet three places down the line. For instance,
using the Caesar Cipher, the plain text ATUL will become cipher text DWXO.

Clearly, the Caesar Cipher is a very weak scheme of hiding plain text
message. All that is required to break the Caesar Cipher is to do the reverse of the
Caesar Cipher process replace each alphabet is a cipher text message produced by
Caesar Cipher with the alphabet that is three places up the line. Thus, to work
backwards, take a cipher text produced by Caesar Cipher. and replace each A with

7
X, B with Y. C with Z. D with A. E with B and so on. The simple algorithm
required to break Caesar Cipher can be summarized as shown in Fig. 2.6 [3].

Figure 2.2. Algorithm to break Caesar cipher

The earliest known, and the simplest, use of a substitution cipher was by
Julius Caesar. The Caesar cipher involves replacing each letter of the alphabet with
the letter standing three places further down the alphabet. For example, plain: meet
me after the toga party

cipher: PHHW PH DIWHU WKH WRJD SDUWB

Note that the alphabet is wrapped around, so that the letter following Z is A. We
can define the transformation by listing all possibilities, as follows:

plain: a b c d e f g h i j k l m n o p q r s t u v w x y z

cipher: d e f g h i j k l m n o p q r s T u v w x y z a b c

Let us assign a numerical equivalent to each letter as figure 2.3:

8
Figure 2.3. numerical equivalent to example letter

2.2. ASCII code table


ASCII stands for American Standard Code for Information Interchange.
Historically, the ASCII format precedes the hex format. For this reason, it was
constructed on the minimum number of bits concept and has onlly 7 bits. When
used in modern computers and microcontrollers, the ASCII format is zero filled to
the left with an extra bit to achieve the 8bit format of the hex representation.[2]

Figure 2.4 ASCII Code Table

9
2.3. MIT APP Inventor

 Designing the Components

The first tool you’ll use is the Component Designer (or just Designer).
Components are the elements you combine to create apps, like ingredients in a
recipe. Some components are very simple, like a Label component, which shows
text on the screen, or a Button component, which you tap to initiate an action.
Other components are more elaborate: a drawing Canvas that can hold still images
or animations; an accelerometer, a motion sensor that works like a Wii controller
and detects when you move or shake the phone; or components that make or send
text messages, play music and video, get information from websites, and so on as
shown in figure 2.5.

Figure 2.5. the app inventor component designer

The Designer is divided into several areas:

10
• Toward the center is a white area called the Viewer. This is where you
place components and arrange them to map out what you want your app to look
like. The Viewer shows only a rough indication of how the app will look, so, for
example, a line of text might break at a different place in your app than what you
see in the Viewer. To see how your app will really appear, you’ll need to either
download the app to your phone (we’ll go through how to do this a bit later, in the
section “Packaging the App for Downloading”) or view it in the emulator that
comes with App Inventor.

• To the left of the Viewer is the Palette, which is a list of components you
can select from. The Palette is divided into sections; at this point, only the Basic
components are visible, but you can see components in other sections of the Palette
by clicking the headers labeled Media, Animation, and so on.

• To the right of the Viewer is the Components list, which lists the
components in your project. Any component that you drag into the Viewer will
show up in this list. Currently, the project has only one component listed: Screen1,
which represents the phone screen itself.

• Under the Components list is an area that shows the Media (pictures and
sound) in the project. This project doesn’t have any media yet, but you’ll be adding
some soon.

At the far right is a section that shows the Properties of components; when
you click a component in the Viewer, you’ll see its Properties listed here.

Properties are details about each component that you can change. (For
example, when clicking on a Label component, you might see properties related to
color, text, font, and so on.) [4].

11
 Adding Components to Your New Project

To add components to your application, click the component you want and
drag it onto the Viewer window in Design view. Th e representation of your phone
is labeled Screen1. Every project starts with a default component called Screen1,
and its Title property or label is set to Screen1. The ink of this default screen
component as the blank sheet of paper on which you will design your application.
All App Inventor components have settings called properties. Properties are set in
the Properties column when a component is selected in the Viewer. The

Block Editor can also be used to change component properties on the fl y


when events occur in your application. (More on that later, in the section called
“Introducing the Block Editor.”) I show you how to replace the default Screen1
title with the title of your application when you get to the Properties column in this
chapter. Your application name shows up where you see the text Screen1 in the
Viewer. As you add components to the screen, the components fi ll in from top to
bottom of the Viewer, not left to right. In Chapter 3, I show you how to arrange
your components across the screen or vertically and how to simulate multiple
screens for your application. For now, open the Basic palette grouping by clicking
on it.

 Adding a Button component

As a demonstration, open the Basic palette and drag and drop a Button
component on to the Viewer. A button shows up not only on the Viewer but also
on your connected Android phone. A button allows you to interact with the users

12
of your application. The users tap it and things happen. Buttons, as you might well
expect, play a big part in almost all applications. They provide events that you can
tie actions to. Every time you drop any component onto the Viewer, a new
component drawer and new blocks are added to the My Blocks tab in the Block
Editor. The blocks are stored in drawers. The drawers are accessed by clicking the
corresponding button on the left side of the Blocks Editor. Click over to the Blocks
Editor to see the new component drawer and blocks: If you have minimized the
Blocks Editor, it will be in your system taskbar. Click the icon to maximize it. If
the Blocks Editor is closed, you need to open it by clicking the Open the Blocks
Editor button. When you have the Blocks Editor open, you see two tabs labeled
Built-In and My Blocks in the far left column of the Blocks Editor. Click on the
My Blocks tab. All of the components you add to the Design view create a new
component drawer. Click on the Button1 rectangle to open the component drawer
for your new button. All of the blocks for the button you placed on the Design
view are in this drawer as shown in figure 2.6.

13
Figure 2.6. The drawer for your new Button component and all of its programming blocks

 Adding a Label component

Click on and drag a Label component from the Basic palette onto the Viewer
screen. Once again, you see your new label show up on your connected Android
phone. A label allows you to place text and display information on your screen. It
also places blocks into the Block Editor that allow you change and manipulate the
label properties and text. Just like with the button you placed, you can use blocks
that change the label properties such as size, visibility, or text. Labels can be used
to display information that your application generates.

14
By default, the label drops below the button you placed on Screen1. You can
drag components around to reorder them on Screen1. Click on the label and drag it
above the button. As you drag the label, you see a blue place indicator line, like the
one you see in Figure 2.7, indicating where the label will drop when you release it
[5].

Figure 2.7. The blue line indicates where component will be placed when it is dropped

15
Chapter Three

Design and Implementation

3.1. Overview

In this project, both the bluetooth client and server modules are used to
create a chat session. Both components are in the same app. The client component
will be used for the device which starts the connection, the server component will
be used for the device accepting the connection. The devices must have been
paired first. There is no searching for available chat clients.

3.2. Client / Server Design Description

 Select the server side name to be connect to as shown in figure 3.1.


The name may contents MAC address of the server side.

Figure 3.1. Connect client to server

 An initialization parameters such as message and Caesar shifting key are set
as shown in figure 3.2.

16
Figure 3.2. initialization parameters for both client and server

 After select server side, message send to server “client connect” as shown in
figure 3.3.

Figure 3.3. Connection approved

17
 The encryption button will encrypt the text by using Caesar algorithm as
described
- Read each character of text and put it in list as shown in figure 3.3.

Figure (3.3) read character by character from input textbox


 An example of encryption process in mobile window is described as
following:
o text : hello
o Caesar shifting key: 3
o ASCII of text: 104, 101, 108, 108, 111
o ASCII after adding shifting key: 107, 104, 111, 111,114
o Encrypted text: khoor

This process is shown in mobile window as in figure 3.4.

18
Figure 3.4. encryption process

- Convert current character to ASCII, as shown in figure 3.5.

Figure 3.5. convert each character to ASCII code

19
- Add to current ASCII number what a Caesar shifting number as shown in
figure 3.6.

Figure 3.6. Add Caesar shifting number to ASCII number

- Decryption step, take each character of message and convert to ASCII


code, then abstract the Caesar value from ASCII code, after that convert
the result of ASCII code to character, this process is shown in figure 3.7.

Figure 3.7. Decryption step of encrypted message

 Same example of encryption process, the decryption process in mobile


window is described as following:
o text : khoor
o Caesar shifting key: 3
o ASCII of text: 107, 104, 111, 111,114
o ASCII after subtract shifting key: 104, 101, 108, 108, 111
o Encrypted text: hello

20
This process is shown in mobile window as in figure 3.8.

Figure 3.8 decryption process

21
Chapter Four

Conclusion and Future Work

4.1. Conclusion

In this project, a client and server chat applications has been designed for
Android mobile application. The message transmitted and received between them
is encrypted by using Caesar algorithm, and the value of shifting key can be
entered as needed. Also, the design of application can decrypt the message in both
client and server if need.

4.2. Future Work

There some recommended thoughts may be applied to develop and enhance


this project as described in below:

- Apply other cryptography algorithm such AES and DES.


- Make a room chat for group of persons.
- Apply attach function to upload multimedia files (picture, voice,
plaintext, or video)

22
References

1. William Stallings; "Cryptography and Network Security Principles and


Practice", Sixth Edition, 2014
2. Gideon Langholz; "Foundations of Digital Logic Design";2000
3. Eric Maiwald; Network Security A Beginner’s Guide, Third Edition;2012.
4. David Wolber, Hal Abelson,llen Spertus & Liz Looney "App Inventor,
Create Your Own Android Apps"; 2011.
5. Janson Tyler; "App Inventor for Android: Build Your Own Apps"; 2011.

23

You might also like