Secure Wireless Data Transmission A PROJECT REPORT Submitted in partial fulfillment for award of the degree of BACHELOR OF TECHNOLOGY (2008 – 2012) In Electronics & Communication Engineering Guided By: Submitted By: Mr. Ronak Shrimal Patel Kunjan Lecturer (09EGIEC206) Zala Bhagirath (09EGIEC213) Soni Bhavin
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Secure Wireless Data Transmission
A PROJECT REPORT
Submitted in partial fulfillment for award of the degree of
BACHELOR OF TECHNOLOGY
(2008 – 2012)
In
Electronics & Communication Engineering
Guided By: Submitted By:
Mr. Ronak Shrimal Patel KunjanLecturer (09EGIEC206)
Zala Bhagirath (09EGIEC213)
Soni Bhavin(09EGIEC211)
Panday Viral (09EGIEC205)
D e p a r t m e n t o f E l e c t r o n i c s & C o m m u n i c a t i o n E n g i n e e r i n g
GEETANJALI INSTITUTE OF TECHNICAL STUDIES
(Affiliated to Rajasthan Technical University, Kota, Rajasthan)
UDAIPUR, RAJASTHAN April 2012
SYNOPSIS
In today’s ever changing world, data security and secured transmission of confidential
information is of paramount importance. Secured transmission of data can be achieved by
means of encryption. Encryption is the process of transforming information (referred to as
plaintext) to make it unreadable to anyone except those possessing special knowledge,
usually referred to as a key. The result of the process is encrypted information (in
cryptography, referred to as cipher text). In many contexts, the word encryption also
implicitly refers to the reverse process, decryption (e.g. "software for encryption" can
typically also perform decryption), to make the encrypted information readable again (i.e. to
make it unencrypted).
The original information is known as plaintext, and the encrypted form as cipher text.
The cipher text message contains all the information of the plaintext message, but is not in a
format readable by a human or computer without the proper mechanism to decrypt it; it
should resemble random gibberish to those not intended to read it.
PRESENT PRACTICES AND THEORY
Presently the practice involved for acquiring the information regarding to do encryption and
decryption of data includes
1. RSA Algorithm
RSA is a public key algorithm invented by Rivest, Shamir and Adleman. In our project
we are going to use the RSA algorithm which is we used for encryption and decryption
purpose. Here we used the transmitter to encrypt the data using the public key. Similarly
on receiver side the data received is decrypted using private key.
2. KEIL software.
We are going to use ‘KIEL’ software to write the programs.
3. PROTEUS software:
We are going to use ‘CorelDraw’ software to make hardware design.
Generic PKC employs two keys that are mathematically related although knowledge of one
key does not allow someone to easily determine the other key. One key is used to encrypt the
plaintext and the other key is used to decrypt the cipher text. The important point here is that
it does not matter which key is applied first, but that both keys are required for the process to
work. Because a pair of keys is required, this approach is also called asymmetric
cryptography.
In PKC, one of the keys is designated the public key and may be advertised as widely as the
owner wants. The other key is designated the private key and is never revealed to another
party. It is straight forward to send messages under this scheme. Public-key cryptography
algorithms that are in use today for key exchange or digital signatures include:
RSA: The first, and still most common, PKC implementation, named for the three MIT
mathematicians who developed it — Ronald Rivest, Adi Shamir, and Leonard Adleman.
RSA today is used in hundreds of software products and can be used for key exchange,
digital signatures, or encryption of small blocks of data. RSA uses a variable size
encryption block and a variable size key. The key-pair is derived from a very large
number, n, that is the product of two prime numbers chosen according to special rules;
these primes may be 100 or more digits in length each, yielding an n with roughly twice
as many digits as the prime factors. The public key information includes n and a
derivative of one of the factors of n; an attacker cannot determine the prime factors of n
(and, therefore, the private key) from this information alone and that is what makes the
RSA algorithm so secure. (Some descriptions of PKC erroneously state that RSA's safety
is due to the difficulty in factoring large prime numbers. In fact, large prime numbers,
like small prime numbers, only have two factors!) The ability for computers to factor
large numbers, and therefore attack schemes such as RSA, is rapidly improving and
systems today can find the prime factors of numbers with more than 200 digits.
Nevertheless, if a large number is created from two prime factors that are roughly the
same size, there is no known factorization algorithm that will solve the problem in a
reasonable amount of time; a 2005 test to factor a 200-digit number took 1.5 years and
over 50 years of compute time
1.3.3 Hash Functions
Hash functions, also called message digests and one-way encryption, and are algorithms that,
in some sense, use no key (Figure 1C). Instead, a fixed-length hash value is computed based
upon the plaintext that makes it impossible for either the contents or length of the plaintext to
be recovered. Hash algorithms are typically used to provide a digital fingerprint of a file's
contents often used to ensure that the file has not been altered by an intruder or virus. Hash
functions are also commonly employed by many operating systems to encrypt passwords.
Hash functions, then, provide a measure of the integrity of a file.
Hash algorithms that are in common use today include:
Message Digest (MD) algorithms: A series of byte-oriented algorithms that produce a
128-bit hash value from an arbitrary-length message.
CHAPTER-2
ORGANIZATION OF PROJECT WORK
2.1 Organization of Project Work
The project work was organized in four steps.
PCB making
As per the block diagram we designed the circuit diagram and prepared two separate PCB’S. One PCB working as transmitter and other as receiver. The two PCB’s are of glass epoxy material. They are double sided PCB’s.
PCB Mounting
The transmitter PCB consists of microcontroller 89S52, buffer 74LS145, LCD 16X2, LED, keypad 16X16, transmitter module HT12-E and antenna. The receiver consists of microcontroller 89S52, buffer 74LS145, LCD 16X2, receiver module HT12-D and antenna. All these components are mounted on PCB.
RSA algorithm software
This is the RSA algorithm which we are using for encryption and decryption. We have written the programs in KIEL software. Here the transmitter encrypts the data using the public key. Similarly on receiver side the data received is decrypted using private key.
Synchronization of transmitter and receiver
The microcontroller was programmed using RSA algorithm software. The data was entered from the transmitter using the keypad by pressing any of the keys and then encrypted. The encrypted data is transmitted by transmitter module. The receiver receives the data from transmitter and performs the decryption of that. The synchronization of transmitter and receiver was done to transmit and receive data at the same time without any delay. Thus both simultaneously get ready to transmit new data and receive.
CHAPTER-3
SYSTEM DESIGN
3.1 METHODOLOGY
3.1.1 BLOCK DIAGRAM
Figure 2 Block Diagram of Project
3.1.2 DESCRIPTION
There two blocks transmitter and receiver. Each of these blocks includes a processing unit
and unit to encrypt and decrypt the data. The transmitter section includes a processor which
gets the data from the 4X4 keypad interfaced to it. The controller stores this data and displays
it on LCD. Then it performs the encryption of that data and displays it on LCD. Encrypted
data is given to the transmitter module which passes the data towards the antenna for
transmission. Thus encrypted data is then transmitted through channel towards receiver.
The receiver section includes a processor where the data is decoded. The data is received by
the receiver antenna. It is given to receiver module HT12-D and then to microcontroller.
Here the decryption of data takes place. Now the original data is available which is displayed
on LCD.
3.2 ENCRYPTION
The basic idea of cryptography is to hide information from prying eyes. On the Internet this
can be your credit card numbers, bank account information, health/social security
information, or personal correspondence with someone else. In today’s ever changing world,
data security and secured transmission of confidential information is of paramount
importance. Secured transmission of data can be achieved by means of encryption.
Encryption renders the data useless, if by any means it falls into the hands of a person, who
should not know anything about the data.
The various applications of encryption include certain military and commercial applications.
The scope of application includes point to point and device to device communication. This
can be implemented using simple, inexpensive and common hardware.
Encryption is the science of changing data so that it is unrecognizable and useless to an
unauthorized person. The most secure techniques use a mathematical algorithm and a
variable value known as a 'key'. The selected key (often any random character string) is input
on encryption and is integral to the changing of the data. The EXACT same key MUST be
input to enable decryption of the data. This is the basis of the protection.... if the key
(sometimes called a password) is only known by authorized individual(s), the data cannot be
exposed to other parties. Only those who know the key can decrypt it. This is known as
'private key' cryptography, which is the most well known form.
The process of encryption begins by converting the text to a pre hash code. This code is
generated using a mathematical formula.
This pre hash code is encrypted by the software using the sender’s private key. The
private key would be generated using the algorithm used by the software.
The encrypted pre hash code and the message are encrypted again using the sender's
private key.
The next step is for the sender of the message to retrieve the public key of the person this
information is intended for.
The sender encrypts the secret key with the recipient's public key, so only the recipient
can decrypt it with his/her private key, thus concluding the encryption process.
Figure 3 Block Diagram of Encryption
A few decades ago, only governments and diplomats used encryption to secure sensitive
information. Today, secure encryption on the Internet is the key to confidence for people
wanting to protect their privacy, or doing business online. E-Commerce, secure messaging,
and virtual private networks are just some of the applications that rely on encryption to
ensure the safety of data. In many companies that have proprietary or sensitive information,
field personnel are required to encrypt their entire laptops fearing that in the wrong hands this
information could cause millions of dollars in damage
Depending upon the application importance, the cost of hardware and encryption software
may vary. For day to day applications we can have a simple and cheap encryption system and
for more important purposes the complexity and cost may rise. The transmission of encrypted
data can be achieved by using wireless or wired channel. Again having a wireless based
encryption system makes the system more complex and at the same time raising the cost. The
wide range of applications and the need of secured data transmission make the technology
indispensable in this modern world.
3.3 DECRYPTION
Figure 4 Block Diagram of Decryption
After the data is encrypted it should be decrypted at the receiver. Hence decryption algorithm
is introduced at receiver. The receiver holds a private key which is very secret key and is
known to a particular receiver for which the data is sent by dedicated transmitter. Firstly the
private key is taken if it correct then the next decryption is done. The original data is obtained
which is sent by transmitter.
3.4 RSA ALGORITHM
RSA is a public key algorithm invented by Rivest, Shamir and Adleman. The key used
for encryption is different from (but related to) the key used for decryption. The
algorithm is based on modular exponentiation. Numbers e, d and N are chosen with the
property that if A is a number less than N, then (A^e mod N) d mod N = A.
This means that you can encrypt A with e and decrypt using d. Conversely you can
encrypt using d and decrypt using e (though doing it this way round is usually referred to
as signing and verification).
The pair of numbers (e, N) is known as the public key and can be published.
The pair of numbers (d, N) is known as the private key and must be kept secret.
The number e is known as the public exponent, the number d is known as the private
exponent, and N is known as the modulus. When talking of key lengths in connection with
RSA, what is meant is the modulus length. An algorithm that uses different keys for
encryption and decryption is said to be asymmetric. Anybody knowing the public key can
use it to create encrypted messages, but only the owner of the secret key can decrypt them.
Conversely the owner of the secret key can encrypt messages that can be decrypted by
anybody with the public key. Anybody successfully decrypting such messages can be sure
that only the owner of the secret key could have encrypted them. This fact is the basis of the
digital signature technique. Without going into detail about how e, d and N are related, d can
be deduced from e and N if the factors of N can be determined. Therefore the security of
RSA depends on the difficulty of factorizing N. Because factorization is believed to be a hard
problem, the longer N is, the more secure the cryptosystem. Given the power of modern
computers, a length of 768 bits is considered reasonably safe, but for serious commercial use
1024 bits is recommended.
KEY LENGTH
The key length for a secure RSA transmission is typically 1024 bits. 512 bits is now no
longer considered secure. For more security or if you are paranoid, use 2048 or even 4096
bits. With the faster computers available today, the time taken to encrypt and decrypt even
with a 4096-bit modulus really isn't an issue anymore. In practice, it is still effectively
impossible for you or I to crack a message encrypted with a 512-bit key. An organization like
the NSA who has the latest supercomputers can probably crack it by brute force in a
reasonable time, if they choose to put their resources to work on it. The longer your
information is needed to be kept secure, the longer the key you should use. Keep up to date
with the latest recommendations in the security journals.
No one is going to criticizes you for using a key that is too long provided your software still
performs adequately. However, in our opinion, the biggest danger in using a key that is too
large is the false sense of security it provides to the implementers and users. "Oh, we have
4096-bit security in our system" may sound impressive in a marketing blurb, but the fact that
your private key is not adequately protected or your random number generator is not random
may mean that the total security is next to useless.
If we are encrypting the plaintext with a conventional symmetrical algorithm like DES, our
session key is going to be 64 bits long. Triple DES will need 192 bits, and AES will need up
to 256 bits. That gives us lots of security. Unlike our simple examples above where we had to
deal with a series of integers, to encrypt a 256-bit key with a 1024-bit RSA modulus means
we only need a single representative message integer. In fact, you need to pad the 256 bits to
ensure that we have a large enough integer before we encrypt it with RSA. 1024 bits is 128
bytes long, so we have quite a handful of data to deal with.
Key Generation Algorithm
Generate two large random primes, P and Q, of approximately equal size such that their
product n = pq is of the required bit length, e.g. 1024 bits. [See note 1].
Compute N = PQ and (φ) phi = (P-1) (Q-1).
Choose an integer E, 1 < E < phi, such that gcd (E, phi) = 1. [See note 2].
Compute the secret exponent d, 1 < D < phi, such that
ED ≡ 1 (mod phi). [See note 3].
The public key is (N, E) and the private key is (N, D). The values of P, Q, and phi should
also be kept secret.
N is known as the modulus.
E is known as the public exponent or encryption exponent.
D is known as the secret exponent or decryption exponent.
Encryption
Sender A does the following:-
Obtains the recipient B's public key (N, E).
Represents the plaintext message as a positive integer T [see note 4].
Computes the cipher text C = T^E mod N.
Sends the cipher text c to B.
Decryption
Recipient B does the following:-
Uses his private key (N, D) to compute T = T^E mod N.
Extracts the plaintext from the integer representative T
An example of RSA algorithm:
P = 61 <- first prime number (destroy this after computing E and D)
Q = 53 <- second prime number (destroy this after computing E and D)
PQ = N=3233 <- modulus (give this to others)
E = 17 <- public exponent (give this to others)
D = 2753 <- private exponent (keep this secret!)
Your public key is (E, PQ).
Your private key is D.
The encryption function is:
Encrypt (T) = (T^E) mod PQ
= (T^17) mod 3233
The decryption function is:
Decrypt(C) = (C^D) mod PQ
= (C^2753) mod 3233
To encrypt the plaintext value 123, do this:
Encrypt (123) = (123^17) mod 3233
= 337587917446653715596592958817679803 mod 3233
= 855
To decrypt the cipher text value 855, do this:
Decrypt (855) = (855^2753) mod 3233
= 123
CHAPTER-4
HARDWARE DESIGN
4.1 CIRCUIT DIAGRAM
Figure 5 circuit Diagram
4.2 LAYOUT OF CIRCUIT DIAGRAM
Figure 6 Layout of Transmitter circuit Diagram
Figure 7 Layout of Receiver circuit Diagram
RC
0123
4567
89AB
CDEF
Figure 8 Layout of Keyboard circuit Diagram
4.3 LIST OF COMPONENTS
POWER SUPPLY
We have designed a power supply of 5V for both transmitter and receiver section.
LCD DISPLAY
Figure 9 diagram of LCD display
Here we used LCD to display the message transmitted and received. We are using 16 x 2 bit
type of LCD. The display module reset itself to an initial state when the power is applied,
which continuously the display has blanked off, so that even if character are entered, they
cannot be seen. It is therefore necessary to issue a command at this point, to switch the
display on.
KEYPAD
Figure 10 diagram of keypad
We have used 4x4 keypad for entering the message which is interfaced with microcontroller.
Each key contains a specific message which will be transmitted. for each key particular
message is given.
TRANSMITTER MODULE
The idea is to use off-the-shelf RF TX/RX modules. These modules, once a rare commodity,
are now widely and cheaply available. In this particular discussion, we shall be using ASK
(Amplitude Shift Keying) based TX/RX pair operating at 433 MHz. The transmitter module
accepts serial data at a maximum of XX baud rate. They can be directly interfaced to a
microcontroller or can be used in remote control applications with the help of
encoder/decoder ICs. The encoder IC takes in parallel data at the TX side, packages it into
serial format and then transmits it with the help of a RF transmitter module. At the RX end,
the decoder IC receives the signal via the RF receiver module, decodes the serial data and
reproduces the original data in the parallel format.
Figure 11 diagram of transmitter module
HT12E
Figure 12 flow chart of HT12E
General Description
The 212 encoders are a series of CMOS LSI for remote control system applications. They are
capable of encoding information which consists of N address bits and 12_N data bits. Each
address/ data input can be set to one of the two logic states. The programmed addresses/data
are transmitted together with the header bits via an RF or an infrared transmission medium
upon receipt of a trigger signal. The capability to select a TE trigger on the HT12E or a
DATA trigger on the HT12A further enhances the application flexibility of the 212 series of
encoders. The HT12A additionally provides a 38 kHz carrier for infrared systems.
Figure 13 circuit diagram of transmitter
RECEIVER MODULE
Figure 14 diagram of receiver module
Figure 15 circuit diagram of receiver
They can be directly interfaced to a microcontroller or can be used in remote control
applications with the help of encoder/decoder ICs. The encoder IC takes in parallel data at
the TX side packages it into serial format and then transmits it with the help of a RF
transmitter module. At the RX end, the decoder IC receives the signal via the RF receiver
module, decodes the serial data and reproduces the original data in the parallel format.
HT12D
Figure 16 flow chart of HT12D
89S52 MICROCONTROLLER
The main part of our project is microcontroller, here we used Atmel 89S52 chip. It is
used to connect between RFID Reader and Library server. This is 40 pin microcontroller
used to interface LCD for display purpose and to receive the data coming from RFID reader
on its serial input pins.
PIN OUT OF 89S52
Figure17 pin out diagram of 89S52
INTERRUPTS
The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1),
three timers interrupts (Timers 0, 1, and 2), and the serial port interrupt. These interrupts are
all shown in Figure 10.
Each of these interrupt sources can be individually enabled or disabled by setting or clearing
a bit in Special Function Register IE. IE also contains a global disable bit, EA, which
disables all interrupts at once. Note that Table 5 shows that bit position IE.6 is
unimplemented. In the AT89S52, bit position IE.5 is also unimplemented. User software
should not write 1s to these bit positions, since they may be used in future AT89 products.
Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register T2CON.
Neither of these flags is cleared by hardware when the service routine is vectored to. In fact,
the service routine may have to determine whether it was TF2 or EXF2 that generated the
interrupt, and that bit will have to be cleared in software. The Timer 0 and Timer 1 flags, TF0
and TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then
polled by the circuitry in the next cycle. However, the Timer 2 flag, TF2, is set at S2P2 and is
polled in the same cycle in which the timer overflows.
Table: Table of Interrupts in 89S52
START
RECEIVE DATA ON KEY PRESS & STORE AS ’2’
CALL ENCRYPTION ALGORITHM
CACULATE: N=3*11
TRANSMIT ENCRYPTED DATA BY ANTENNA
DISPLAY ENCRYPTED DATA ‘8’ON LCD
GET 2 PRIME NOS:3, 11
GET THE PUBLIC KEY-‘3’
CALCULATE: ENCRYPT= (2^3) MOD 33
CHAPTER-5
SOFTWARE DESIGN
5.1 ENCRYPTION ALGORITHM
Figure 18 Flow Chart of Encryption Algorithm
STOP
START
RECEIVE ENCRYPTED DATA ‘8’& STORE AS ‘B’
STOP
CALL DECRYPTION ALGORITHM
CACULATE: N=3*11
DISPLAY DECRYPTED DATA ‘2’ON LCD
GET 2 PRIME NOS:3, 11
GET THE PRIVATE KEY-‘7’
CALCULATE: DECRYPT= (8^7) MOD 33 333333
5.2 DECRYPTION ALGORITHM
Figure 19 Flow Chart of Decryption Algorithm
CHAPTER-6
SYSTEM IMPLEMENTATION AND SYSTEM OPERATION
6.1 SYSTEM IMPLEMENTATION
Figure 20 Picture of Transmitter Kit
Figure 21 Picture of Receiver Kit
6.2 SYSTEM OPERATION
The system works on the principle of encryption and decryption. We have used two separate
circuits for transmission of encrypted data and receiver for decryption of data. The system
communicates on wireless basis. The two circuits work as following.
Transmitter
The power supply of 5V is made ON which supplies power to all subunits.
LCD is interfaced at port0, keypad is interfaced at port1 and transmitter module at port2
(higher nibble).
The microcontroller 89S52 begins functioning by initializing the LCD and keypad.
The microcontroller waits for an interrupt from keypad by scanning the lines where every
key is assigned with separate data.
When the key is pressed interrupt is generated at port3 (pin 3.2).
On occurrence of interrupt the address of pressed key is detected and the data on that key
is taken in and displayed on LCD.
The encryption of the data takes place here as explained below:
P = first prime number
Q = second prime number
PQ = N
E = public key
D =private key
Public Key is (E, PQ).
Private Key is D.
The encryption function is:
Encrypt (T) = (T^E) mod PQ
The encrypted data is displayed on LCD. This data is divided into lower and higher
nibble since only 4 lines are available for transmission.
This is done by masking and shifting the data.
First the lower nibble is sent on 4 lines which then forward the data to antenna and then
towards the receiver. Similarly the higher nibble is sent.
The controller now again goes to initial condition and checks for new key to be pressed.
Receiver
The receiver is made on by switching the power supply.
The microcontroller initiates itself and the LCD at port0.
Here the receiver antenna receives lower nibble first an then the higher nibble as
transmitted by the transmitter.
These two received data bits are combined together by adding the two nibbles. This is the
encrypted data.
Now the decryption algorithm takes place as follows:
Private Key is D.
The decryption function is:
Decrypt(C) = (C^D) mod PQ
This decrypted data is our original data which is displayed on the LCD.
The receiver now waits to receive the next data from transmitter.
6.3 SYSTEM FLOWCHARTS
HARDWARE FLOWCHART
START
INITIALIZE LCD
STOP
IS KEY PRESSED?
INITIALIZE KEYPAD
STORE THE DATA AND DISPLAY ON IT LCD
TRANSMIT ENCRYPTED DATA BY ANTENNA
ENCRYPT THE DATA AND DISPLAY ON LCD
WAIT TILL DATA IS TRANSMITED
Figure 22 flow chart of transmitter
Figure 23 flow chart of receiver
START
RECEIVE DATA ON KEY PRESS & STORE AS ’A’
STOP
CALL ENCRYPTION ALGORITHM
CACULATE: N=P*Q
TRANSMIT ENCRYPTED DATA BY ANTENNA
DISPLAY ENCRYPTED DATA ON LCD
GET 2 PRIME NOS:P, Q
GET THE PUBLIC KEY-‘E’
CALCULATE: ENCRYPT= (A^E) MOD N
SOFTWARE FLOWCHART
Figure 24 Flow Chart of Encryption
START
RECEIVE ENCRYPTED DATA & STORE AS ‘B’
STOP
CALL DECRYPTION ALGORITHM
CACULATE: N=P*Q
DISPLAY DECRYPTED DATA ON LCD
GET 2 PRIME NOS:P, Q
GET THE PRIVATE KEY-‘D’
CALCULATE: DECRYPT= (B^D) MOD N
Figure 25 Flow Chart of Decryption
RESULT
Figure 26 Circuit Diagram of Secured Data Transmission
KEY NO. ORIGINAL DATA ENCRYPTED DATA DECRYPTED DATA
1. Blue #8p% Blue
2. Pink +z=2 Pink
3. Gray 5?m@ Gray
4. Cyan w$6x Cyan
ADVANTAGES
Secured data transmission can be used for military purposes. Even if the enemy intercepts
the information, he will be unable to extract the required data as he will be unable to
extract the required data as he will not be having the required decoding logic.
It flexibly uses a wide array of enciphering and deciphering algorithms within the signal
processing circuit.
Also provides at low cost flexible features such as compression and decompression of
communication signals and forward error correction of these signals.
.As encryption technique is used the bandwidth is reduced.
The circuitry is simple and effective
APPLICATION
Encryption has long been used by militaries and governments to facilitate secret
communication.
Encryption is now used in protecting information within many kinds of civilian systems,
such as computers, networks (e.g. Internet e-commerce),mobile telephones and bank
automatic teller machines.
Encryption is also used in digital rights management to restrict the use of copyrighted
material and in software copy protection to protect against reverse engineering and
software piracy.
Ciphers have been the choice for several communication standards, like IEEE and