Cryptography

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 48

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

Jnana Sangama, Belagavi – 590 014

MINI PROJECT ON
”Cryptography”
Submitted in partial fulfillment of the requirements for

“COMPUTER NETWORKS AND SECURITY [18CS52]”


Submiited By:
MANJUNATHA G B 1GG20CS410
MONISH C T 1GG20CS413

UNDER THE GUIDANCE OF


DR. CHETHAN K C
Assistant Professor
Dept. of CS&E GEC
Ramanagara

DEPARTMENT OF COMPUTER SCIENCE ENGINEERING


GOVERNMENT ENGINEERING COLLEGE
B.M. ROAD, RAMANAGARA-562 159
CRYPTOGRAPHY

Abstract:

The present century has been one of many scientific discoveries and technological
advancements. With the advent of technology came the issue of security. As computing
systems became more complicated, there was an increasing need for security. Network
Security is becoming more and more crucial as the volume of data being exchanged on the
Internet increases. Security is a broad topic and covers a multitude of sins. Malicious people
trying to gain some benefit, get attention or to harm someone intentionally cause most
security problems. A cryptographic algorithm, or cipher, is a mathematical function used in
the encryption and decryption process. A cryptographic algorithm works in Combination with
a key—a word, number, or phrase—to encrypt the plaintext. The same plaintext encrypts to
different cipher text with different keys. The security of encrypted data is entirely dependent
on two things: the strength of the cryptographic algorithm and the secrecy of the key.

DEPT OF CSE(GECR) 2
CRYPTOGRAPHY

Chapter-1

INTRODUCTION

For the few decades of their existence, computer networks were used for simple
tasks. Under these conditions, security did not get much attention. But now due to the wide
spread application of computers in various fields, network security is a looming horizon as a
potentially massive problem. Security is a broad topic and covers a multitude of sins. In its
simplest form it is concerned with making sure that nosy people cannot read or the worse yet,
modify messages intended for other recepients.it is concerned with people trying to access
remote services that they are not authorized to use. Most security problems are intentionally
caused by malicious people trying to gain some benefit or harm someone.
Historically three people have contributed to the art of cryptography:
Military, the diplomatic corps, diarists .Of these due to the strategic importance of their work
military has the most important role .Until the advent of computers one of the main
constraints on cryptography is the ability of the code clerk to perform the necessary
transformations, often on a battle field with little equipment An additional constraint has been
the difficulty in switching from one cryptographic method to another, since the entails
retaining a large number of people. However the danger of acodeclerk being captured by the
enemy has made it essential to be able to change the cryptographic methods instantly.

The messages to be encrypted, known as the plain text, are transformed by a function that is
parameterized by a key. The o/p of the encryption process, known as the cipher text, is then
transmitted, often by messenger or radio. We assume that the enemy, or intruder, hears and
accurately copies down the complete cipher text. However, unlike the intended recipient, he
does not know what the decryption key is and so
Cannot decrypt the cipher text easily. Sometimes the intruder can, not only listen to the
communication channel (Passive intruder) but can also record messages and play them back
later, inject his own messages, or modify legitimate messages before they get them to the
receiver (Active intruder).

DEPT OF CSE(GECR) 3
CRYPTOGRAPHY

Cryptography has a long and fascinating history. Centuries ago, cryptography was used as a
tool to protect national secrets and strategies. Today, network engineers focus on
cryptography methods for computer communication networks. Cryptography is the process of
transforming a piece of information or message shared by two parties into some sort of code.
The message is scrambled before transmission so that it is undetectable by outside watchers.
This kind of message needs to be decoded at the receiving end before any further processing.

The main tool that network security experts are using to encrypt a message M is a secret key
K; the fundamental operation often used to encrypt a message is the Exclusive-OR ( ).
Suppose that we have one bit, M, and a secret bit, K. A simple encryption is carried out using
M K. To decrypt this message, the second party if he/she has the key, K can easily detect M.

The two types of encryption techniques are secret-key encryption and public-key encryption.
In a secret-key model, both sender and receiver conventionally use the same key for an
encryption process. In a public-key model, a sender and a receiver each use a different key.
The public-key system is more powerful than the secret-key system and provides better
security and message privacy. But the biggest drawback of public-key encryption is speed.
The public-key system is significantly more complex computationally and may not be
practical in many cases. Hence, the public-key system is used only to establish a session to
exchange a session key. Then, this session key is used in a secret-key system for encrypting
messages for the duration of the session.

DEPT OF CSE(GECR) 4
CRYPTOGRAPHY

Chapter 2
Literature survey:

i. Nade F Mir Computer and Communication Networks, 2nd Edition, Pearson,2014

ii. http://www.geeksforgeeks.org

iii. Andrew S Tanenbaum, Computer Networks, fifth edition Pearson

iv. http://ptgmedia.pearsoncmg.com

v. http://jcryptool.software.informer.com

vi. A Method for obtaining Digital Signatures and Public Key Cryptographic Systems.
---Rivesp.R, Shamir. A and Adleman.L

DEPT OF CSE(GECR) 5
CRYPTOGRAPHY

Chapter 3

REQUIREMENTS SPECIFICATIONS:

Functional requirements:

Cryptographic function: Encryption


 User select check box that type of cipher he want. He can select more than one
algorithm to increase the security.
 Select the file using browse option that he wants to encrypt.
 Click the convert button after select the file.
 Before press the Covert button you must enter the key that help to encrypt your File.
 After converting your file successfully it’s give the key.
 After encryption file in create in destination folder.

Cryptographic function: Decryption


 Select file using browse option that you want to decrypt.
 Enter the key value in key filed without entering the key value you cannot proceed
further.
 Press the covert button, it’s give you decrypted file.
Software Requirements:
 Implementation will be in Java programming language that will execute in any system for
which will required only java interpreter that is depend on operating system to system.

DEPT OF CSE(GECR) 6
CRYPTOGRAPHY

User Interface:
 In this software, have three main button (Encrypt, decrypt, send)
 First tab i.e. encrypt tab will allow a user to select the algorithm in which they wish to
encrypt the file and browse the file from hard disk and provide the public key to help in
encryption.
 Second tab i.e. decrypts option, will allow a user to decrypt the encrypted file in other end
providing private key.
 Third tab i.e. send option, will allow user to send a file to another user.

Hardware Requirements:

Cryptography is made in Java so it is Hardware Independent software. There is no nee of any


hardware. It’s run on any operating system and it’s not a heavy software so no
Need to extra ram. It’s required 16 MB ram to executed software and run on any os.

DEPT OF CSE(GECR) 7
CRYPTOGRAPHY

Chapter 4
DESIGN
Cryptography Technique
Cryptography has a long and fascinating history. Centuries ago, cryptography was used as a
tool to protect national secrets and strategies. Today, network engineers focus on
cryptography methods for computer communication networks. Cryptography is the process of
transforming a piece of information or message shared by two parties into some sort of code.
The message is scrambled before transmission so that it is undetectable by outside watchers.
This kind of message needs to be decoded at the receiving end before any further processing.
The main tool that network security experts are using to encrypt a message M is a secret key
K; the fundamental operation often used to encrypt a message is the Exclusive-OR ( ).
Suppose that we have one bit, M, and a secret bit, K. A simple encryption is carried out using
MK. To decrypt this message, the second partyif he/she has the key, Kcan easily detect M
by performing the following:
Equation 10.1

(MK)K=M
In computer communication networks, data can travel between two users while it is encrypted
two servers are exchanging data while two types of encryption devices are installed in their
communication network. The first encryption device is end-to-end encryption, whereby secret
coding is carried out at both end systems

Data Encryption Standard (DES)


With the Data Encryption Standard (DES), plaintext messages are converted into 64-bit
blocks, each encrypted using a key. The key length is 64 bits but contains only 56 usable bits;
thus, the last bit of each 8 byte in the key is a parity bit for the corresponding byte. DES
consists of 16 identical rounds of an operation, as shown in Figure the details of the algorithm
on each 64-bit block of message at each round i of operation are as follows.
Begin DES Algorithm
1. .Initialize. Before round 1 begins, all 64 bits of an incoming message and all 56 bits of
the secret key are separately permuted (shuffled).

DEPT OF CSE(GECR) 8
CRYPTOGRAPHY

2. Each incoming 64-bit message is broken into two 32-bit halves denoted by Li and Ri,
respectively.
3. The 56 bits of the key are also broken into two 28-bit halves, and each half is rotated
one or two bit positions, depending on the round.
4. All 56 bits of the key are permuted, producing version ki of the key on round i.
5. In this step, is a logic Exclusive-OR, and the description of function F() appears next.
Then, Li and Ri are determined by
Equation 10.2

Li=Ri-1
and
Equation 10.3

Ri = Li-1  F (Ri-, ki).

6. All 64 bits of a message are permuted.

The operation of function F() at any round i of DES is as follows.


1. Out of 52 bits of ki, function F() chooses 48 bits.
2. The 32-bit Ri-1 is expanded from 32 bits to 48 bits so that it can be combined with 48-bit
ki . The expansion of Ri-1 is carried out by first breaking Ri-1 into eight 4-bit chunks and
then expanding each chunk by copying the leftmost bit and the rightmost bit from left and
right adjacent chunks, respectively.
3. Function F() also partitions the 48 bits of ki 3. into eight 6-bit chunks.

DEPT OF CSE(GECR) 9
CRYPTOGRAPHY

4. The corresponding eight chunks of Ri-1 and eight chunks of ki 4. are combined as
follows:

Equation 10.4
Ri-1= Ri-1 ki.
At the receiver, the same steps and the same key are used to reverse the encryption. It is now
apparent that the 56-bit key length may not be sufficient to provide full security.
This argument is still controversial. Triple DES provides a solution for this controversy: three
keys are used, for a total of 168 bits. It should also be mentioned that DES can be
implemented more efficiently in hardware than in software.

Advanced Encryption Standard (AES)


The Advanced Encryption Standard (AES) protocol has a better security strength than DES.
AES supports 128-bit symmetric block messages and uses 128-, 192-, or 256-bit keys. The
number of rounds in AES is variable from 10 to 14 rounds, depending on the key and block
sizes. Figure 10.4 illustrates the encryption overview of this protocol, using a 128-bit key.
There are ten rounds of encryptions for the key size of 128 bits. All rounds are identical
except for the last round, which has no mix-column stage.

A single block of 128-bit plaintext (16 bytes) as an input arrives from the left. The plaintext is
formed as 16 bytes m0 through m15 and is fed into round 1 after an initialization stage. In
this round, substitute units indicated by S in the figure perform a byte-by-byte substitution of
blocks. The ciphers, in the form of rows and columns, move through a permutation stage to
shift rows to mix columns. At the end of this round, all 16 blocks of ciphers are Exclusive-

DEPT OF CSE(GECR) 10
CRYPTOGRAPHY

ORed with the 16 bytes of round 1 key k0 (1) through k15(1). The 128-bit key is expanded
for ten rounds. The AES decryption algorithm is fairly simple and is basically the reverse of
the encryption algorithm at each stage of a round. All stages of each round are reversible.
RSA Algorithm:
Rivert, Shamir, and Aldeman developed the RSA public-key encryption and signature
scheme. This was the first practical public-key encryption algorithm. RSA is based on the
intractability of factoring large integers.
Assume that a plaintext m must be encrypted to a ciphertext c. The RSA algorithm has three
phases for this: key generation, encryption, and decryption.
Authentication:
Authentication techniques are used to verify identity. Message authentication verifies the
authenticity of both the message content and the message sender. Message content is
authenticated through implementation of a hash function and encryption of the resulting
message digest. The sender's authenticity can be implemented by use of a digital signature.
Authentication and Digital Signature:
The technical method of providing a sender's authentication is performed through
cryptography. Many cryptographic mechanisms have been developed. Among them, the RSA
algorithm implements both encryption and digital signature. When RSA is applied, the
message is encrypted with the sender's private key. Thus, the entire encrypted message serves
as a digital signature. This means that at the receiving end, the receiver can decrypt it, using
the public key. This authenticates that the packet comes from the right user.

DEPT OF CSE(GECR) 11
CRYPTOGRAPHY

Chapter 5
IMPLEATION

COVERTING PLAIN TEXT TO CIPHER TEXT USING SYMMETRIC ALGORITHM

Select File  New  Empty File in Text Editor  Text Editor Will Be Opened  Write
The Message (Plain Text) In Text Editor.

DEPT OF CSE(GECR) 12
CRYPTOGRAPHY

Sender:-
Click on Algorithms Menu  Symmetric  Select AES (Advance Encryption Standard) 
Click On It.

DEPT OF CSE(GECR) 13
CRYPTOGRAPHY

Encryption:
Select Encrypt  Click on Create a new key in the key store  Create the key  Enter the
password  Confirm the password.

DEPT OF CSE(GECR) 14
CRYPTOGRAPHY

Key Generation:
Rename the Contact name  Enter the Password  Confirm the Password  Click on
Finish Click on Finish Again.

DEPT OF CSE(GECR) 15
CRYPTOGRAPHY

Enter the password to do encryption  Enter the Password  Click on Ok.

DEPT OF CSE(GECR) 16
CRYPTOGRAPHY

We Can See the Encrypted Data In above Image,

After Entering the Password  and See the Result in Output bin File with Hexadecimal
Values and Cipher Text.

DEPT OF CSE(GECR) 17
CRYPTOGRAPHY

Decryption:
Select Algorithms Symmetric  AES (Advance Encryption Standard) Decrypt  Select
the Key which you have created and Click on Finish.

DEPT OF CSE(GECR) 18
CRYPTOGRAPHY

We Can See the Decrypted Data In above Image,

Enter The Password  and See the Result in Output bin File with Hexadecimal Values and
Plain Text.

DEPT OF CSE(GECR) 19
CRYPTOGRAPHY

COVERTING PLAIN TEXT TO CIPHER TEXT USING ASYMMETRIC ALGORITHM

Select File  New  Empty File in Text Editor  Text Editor Will Be Opened  Write
The Message (Plain Text) In Text Editor.

DEPT OF CSE(GECR) 20
CRYPTOGRAPHY

Sender:-
Click on Algorithms Menu  Asymmetric  Select RAS (Rivest,Shamir,Adleman)  Click
On It.

DEPT OF CSE(GECR) 21
CRYPTOGRAPHY

Encryption:
Select Encrypt  Click on Create a new key pair and type in the contact name  Create the
key pair  enter the password  Confirm the password  Click on finish again.

DEPT OF CSE(GECR) 22
CRYPTOGRAPHY

We Can See the Encrypted Data In above Image,

After Entering the Password  and See the Result in Output bin File with Hexadecimal
Values and Cipher Text.

DEPT OF CSE(GECR) 23
CRYPTOGRAPHY

Decryption:
Click on Algorithms Menu  Asymmetric  Select RAS (Rivest,Shamir,Adleman) 
Decrypt  Select Key name you have declared earlier and click finish.

DEPT OF CSE(GECR) 24
CRYPTOGRAPHY

We Can See the Decrypted Data In above Image,

Enter The Password to Decrypt  and See the Result in Output bin File with Hexadecimal
Values and Plain Text.

DEPT OF CSE(GECR) 25
CRYPTOGRAPHY

DIGITAL SIGNATURE ALGORITHM

Select File  New  Empty File in Text Editor  Text Editor Will Be Opened  Write
The Message (Plain Text) In Text Editor.

DEPT OF CSE(GECR) 26
CRYPTOGRAPHY

Click on Algorithms Menu  Click on Signature  Select DSA and click on it.

DEPT OF CSE(GECR) 27
CRYPTOGRAPHY

Select  Sign  Click on Create a new key in the key store

DEPT OF CSE(GECR) 28
CRYPTOGRAPHY

Rename contact name  Create the key pair  enter the password  Confirm the password
 Click on finish again.

DEPT OF CSE(GECR) 29
CRYPTOGRAPHY

After Creating the Key pair  Click on Choose File

DEPT OF CSE(GECR) 30
CRYPTOGRAPHY

Save The File Name  Give Some Name to Filename and save it.

DEPT OF CSE(GECR) 31
CRYPTOGRAPHY

After Saving the File  Click on Finish.

DEPT OF CSE(GECR) 32
CRYPTOGRAPHY

Enter the password to Sign the File.

DEPT OF CSE(GECR) 33
CRYPTOGRAPHY

After signing the file  Verify it File is modified or what  Select Verify  choose the file
where we saved the file.

DEPT OF CSE(GECR) 34
CRYPTOGRAPHY

Select The File Where we saved the program  Select Open.

DEPT OF CSE(GECR) 35
CRYPTOGRAPHY

After Opening the file  click on finish.

DEPT OF CSE(GECR) 36
CRYPTOGRAPHY

The Signature Is Valid Means That The Data Sended By The Sender Is Not Modified By
Unauthorized Person (Hackers)  It Verified.

DEPT OF CSE(GECR) 37
CRYPTOGRAPHY

If The Data Sended By the Sender Is Modified By the Hackers While Transmitting Into
Receiver While Receiver Received the Message Then He Should verified its valid or not 
The Signature Is Not Valid Because The Data Is Modified  So The Signature Is Not Valid

DEPT OF CSE(GECR) 38
CRYPTOGRAPHY

HASH FUNCTION

Select File  New  Empty File in Text Editor  Text Editor Will Be Opened  Write
The Message (Plain Text) In Text Editor.

DEPT OF CSE(GECR) 39
CRYPTOGRAPHY

Click on Algorithms Menu  Select Hash  Select MD5 (Message Digest)  Click On
Finish.

DEPT OF CSE(GECR) 40
CRYPTOGRAPHY

Hash Algorithm is the one way Function  This Function Does Not Need Any Further Input
 Click the Finish Button.

DEPT OF CSE(GECR) 41
CRYPTOGRAPHY

Now View the Output bin File Hash Generated.


We Can Add The Encrypted Data With The Original Message And Send To Destination.

DEPT OF CSE(GECR) 42
CRYPTOGRAPHY

SHA-1 RANDOM PASSWORD GENERATOR

Select File  New  Empty File in Text Editor  Text Editor Will Be Opened  Write
The Message (Plain Text) In Text Editor.

DEPT OF CSE(GECR) 43
CRYPTOGRAPHY

Click on Algorithms Menu  Click Random Number Generator  Click on SHA-1

DEPT OF CSE(GECR) 44
CRYPTOGRAPHY

Type The Output Size [Default 128 bits] or your choice  Click on Finish.
We Can Obtain Various Size And Fitter To Binary Output Or Output As Character Or Output
As Number.

DEPT OF CSE(GECR) 45
CRYPTOGRAPHY

The Output bin SHA-1 file is generated and displayed on Above Screen.

DEPT OF CSE(GECR) 46
CRYPTOGRAPHY

Chapter 6
RESULT AND DISCUSSION
This project is mainly intended to enhance security of a system. So our main motive is
maximizing the security by making cipher text in a confusing way. Each time we encrypt a
same word, we are supposed to get a different cipher text. This will surely confuse hacker’s
and cryptanalyst’s. Another thing we kept in mind is to minimize complexity of algorithms.
This will enhance speed of execution and in turn increase performance of our project. This
allows our XMODES to be incorporated with different kinds of other systems. Since the
speed is quite good, it can be even used in online and cloud computing systems very
effectively.
TESTING- Our project has been tested with a variety of words and images. Almost all
keyboard inputs were successfully working in this software. Even out of keyboard characters
are working as this project treats characters as ascii codes so there is nothing to be confused
about them. In case of images, this projects performance degrades as size of the image
increases. For smaller images this works out very fine. But for larger images the time taken is
too large.
SYSTEM EVALUATION BASED ON TESTING- As far as texts are concerned
this works similar in all computes in the present day. Time required for encrypting text is too
small the performance of a system is not much clear and vivid. But for images, the
performance of image encryption is based on performance of system. For lower processor it
takes more time to encrypt.
ACCURACY- Our project has high degree of accuracy. A small change in one character at
any phase of processing will bring about a big change in outcome, whether it be concerned
with encryption or decryption. There is no question about any word changing its form as this
project is carefully created keeping all the accuracy conservative measures. A small change in
any word will change the image and the image becomes in a form that cannot be viewed. The
image thus gets damaged. But since the accuracy is high this problem was Environment in
testing phase. All images were successfully viewed and the encryption and decryption
process was so successful. But when it comes to hackers a small change in any of the portion
of image string, the out become becomes weird, so intrusion and hacking is very difficult.

DEPT OF CSE(GECR) 47
CRYPTOGRAPHY

CONCLUSION
As we toward a society where automated information resources are increased and
cryptography will continue to increase in importance as a security mechanism. Electronic
networks for banking, shopping, inventory control, benefit and service delivery, information
storage and retrieval, distributed processing, and government applications will need improved
methods for access control and data security. The information security can be easily achieved
by using Cryptography technique. DES is now considered to be insecure for some
applications like banking system. There are also some analytical results which demonstrate
theoretical weaknesses in the cipher. So it becomes very important to augment this algorithm
by adding new levels of security to make it applicable. By adding additional key, modified S-
Box design, modifies function implementation and replacing the old XOR by a new operation
as proposed by this thesis to give more robustness to DES algorithm and make it stronger
against any kind of intruding. DES Encryption with two keys instead of one key already will
increase the efficiency of cryptography.

DEPT OF CSE(GECR) 48

You might also like