# Cryptographic Techniques For Network Security Cryptography Computer Science Essay

**Published:** **Last Edited:**

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

The rapid growth of electronic communication means that issues in information security are of increasing practical importance. Message exchanged over worldwide publicly accessible computer networks must be kept confidential and protected against manipulation. Cryptography provides solutions to all these problems. Cryptography, a word with Greek origins means "secret writing". We use the term to refer to the science and art of transforming messages to make them secure and immune to attacks. Cryptography is the practice and study of hiding information. In modern times, cryptography is considered to be a branch of both mathematics and computer science, and is affiliated closely with information theory, computer security, and engineering. Cryptography is used in applications present in technologically advanced societies; examples include the security of ATM cards, computer passwords, electronic commerce, which all depend on cryptography.

## SECURITY GOALS

Availability

Integrity

Confidentiality

Security goals

## CONFIDENTIALITY

Confidentiality is probably the most common aspect of information security. We need to protect our confidential information. An organization need to guard those malicious actions that endanger the confidentiality of its information. In the military, concealment of sensitive information is the major concern. In industry, hiding some information from competitors is crucial to the operation of the organization. In banking, customers account need to be kept secret. Confidentiality not only applies to the storage of the information, it also applies to the transmission of information. When we send a piece of information to be stored in a remote computer or when we retrieve a piece of information from a computer, we need to conceal it during transmission.

## INTEGRITY

Information needs to be changed constantly. In a blank, when a customer deposits or with draws money, the balance of her account needs to be changed. Integrity means that changes need to be done only by authorized entities and through authorised mechanisms. Integrity violation is not necessary the result of a malicious act; an interruption in the system, such as a power surge, may also create unwanted changes in some information.

## AVAILABILITY

The third component of information security is availability. The information created and stored by an organization needs to be available to authorized entities. Information is useless if it is not available. Information needs to be constantly changed. Which means it must be accessible to authorised entities. The unavailability of information is just as harmful for an organization as the lack of confidentiality or integrity. Imagine what would happen to a bank if the customers could not access their accounts for transactions.

## SECURITY SERVICES

It is easy to relate one or more of these services to one or more of the security goals. It is easy to see that these services have been designed to prevent the security attacks that we have mentioned.

## Data confidentiality

It is designed to protect data from disclosure attack. The service as defined by X.800 is very broad and encompasses confidentiality of the whole message or part of a message and also protection against traffic analysis. That is, it is designed to prevent snooping and traffic analysis attack.

## Data integrity

It is designed to protect data from the modification, insertion, deletion, and replaying by an adversary. It may protect the whole message or part of the message.

## Authentication

This service provides the authentication of the party at the other end of the line. In connection oriented communication, it provides authentication of the sender or receiver during the connection establishment. In connectionless communication, it authenticates the source of the data.

## Non repudiation

Non repudiation services protects against repudiation by either the sender or the receiver of the data. In non repudiation with proof of the origin, the receiver of the data can later prove the identity of the sender if denied. In non repudiation with proof of delivery, the sender of data can later prove that data were delivered to the intended to the intended recipient.

## Access control

It provides protection against unauthorised access to data. The term access in this definition is very broad and can involve reading, writing, modifying, executing programs, and so on.

## CRYPTOGRAPHIC TECHNIQUES

## SYMMETRIC KEY ENCRYPTION

It is also called as secret key cryptography is a cryptographic technique where the two parties share a secret key. Data are encrypted and decrypted using the same key. The sender encrypts data using the key. Once transmitted, the receiver should use the same key to interpret the message.

C:\Users\madhu\Desktop\syymm.PNG

Figure 1. Symmetric encryption algorithm

Symmetric encryption is computationally fast, meaning that it can occur in real time on content that is unknown previously. All securely transmitted live traffic today is encrypted using symmetric encryption algorithms for example such as live telephone conversation, streaming video transmission, high speed data link.

## Asymmetric Key Encryption

In asymmetric key encryption, different keys are used for encrypting and decrypting a message. The asymmetric key algorithms that are most useful are those in which neither key can be made public while the other is kept secure. There are some distinct advantages to this public-key-private-key arrangement, often referred to as public key cryptography; the necessity of distributing secret keys to a large numbers of users is eliminated. And the algorithm can be used for authentications as well as for cryptography. Asymmetric cipher algorithms are based on heavy mathematical operations, thus they are not efficient at processing large blocks of data. They are often used to safely exchange small session keys.

C:\Users\madhu\Desktop\asymm.PNG

Figure 2: Asymmetric Encryption Algorithm

## Cryptanalysis

As cryptography is the science and art of creating secret codes, cryptanalysis is the science and art of breaking those codes. In addition to studying cryptography techniques, we also need to study cryptanalysis techniques. This is needed, not to break other people's codes, but to learn how vulnerable our cryptosystem is. The study of cryptanalysis helps us create better secret codes. There are four common types of cryptanalysis attacks

Cryptanalysis attack

Chosen ciphertext

Chosen plaintext

Known plaintext

Ciphertext only

Figure 4: cryptanalysis attacks

## Ciphertext Only Attack

In ciphertext only attack, Eve has access to only some cipher text. She tries to find out the corresponding key and the plain text. The assumption is that Eve knows the algorithm and can intercept the cipher text. The cipher text only attack is the most probable one because Eve needs only the cipher text for this attack. To thwart the decryption of a message by an adversary, a cipher must be very resisting to this type of attack. Various methods can be used in ciphertext only attack.

## Brute force attack

In the brute force method or exhaustive key search method, Eve tries to use all possible keys. We assume that Eve knows the algorithm and knows the key domain. Using the intercepted cipher, Eve decrypts the cipher text with every possible key until the plain text makes sense. Using brute force attack was a difficult task in the past; it is easier today using a computer. To prevent this type of attack, the number of possible keys must be very large.

## Statistical attack

The cryptanalyst can benefit from some inherent characteristics of the plain text language to launch a statistical attack. For example we know that the letter E is the most frequently used letter in English text. The cryptanalyst finds the mostly used character in the cipher text and assumes that the corresponding plain text character is E. After finding a few pairs, the analyst can find the key and use it to decrypt the message. To prevent this type of attack, the cipher should hide the characteristics of the language.

## Pattern attack

Some ciphers may hide the characteristics of the language, but may create some patterns in the ciphertext. A cryptanalyst may use a pattern attack to break the cipher. Therefore, it is important to use the ciphers that make the ciphertext look as random as possible.

## Known Plaintext Attack

In a known plaintext attack, Eve has access to some plain or ciphertext pairs in addition to the intercepted ciphertext that Eve wants to break. The plain or ciphertext pairs have been collected earlier. Alice has sent a secret message to bob, but Alice later made the contents of the message public. Eve has kept both the cipher and the plaintext to use them to break the next secret message from Alice to Bob, assuming that Alice has not changed her key. Eve uses the relationship between the previous pair to analyze the current ciphertext. The same methods used in the ciphertext-only attack can be applied here. This attack is easier to implement because Eve has more information to us for analysis. However, it is less likely to happen because Alice may have changed her key or may have not disclosed the contents of any previous messages.

## Chosen Plaintext Attack

The chosen plaintext attack is similar to the known plaintext attack, but the plaintext or ciphertext pairs have been chosen by the attacker. This can happen, for example, if Eve has access to Alice computer. She can choose some plaintext and intercept the created ciphertext. Of course, she does not have the key because the key is normally embedded in the software used by the sender. This type of attack is much easier to implement, but it is much less likely to happen.

## Chosen Ciphertext Attack

The chosen ciphertext attack is similar to the chosen plaintext attack, except that the Eve chooses some ciphertext and decrypts it to form a ciphertext or plaintext pair. This can happen if Eve has access to Bob's computer.

## TRADITIONAL CIPHERS

We can divide traditional symmetric key ciphers into two broad categories substitution ciphers and transposition ciphers. In a substitution cipher, we replace one symbol in the cipher text with another symbol; in a transposition cipher, we reorder the position of symbols in the plaintext.

## Substitution ciphers

A substitution cipher replaces one symbol with another. If the symbols in the plaintext are alphabetic characters, we replace one character with another. For example, we can replace letter A with letter D, and letter T with letter Z. If the symbols are digits (0 to 9), we can replace 3 with 7, and 2 with 6. Substitution ciphers can be categorized as either monoalphabetic ciphers or polyalphabetic ciphers.

## Monoalphabetic ciphers

We first discuss a group of substitution ciphers called the monoalphabetic ciphers. In monoalphabetic substitution, a character in the plaintext is always changed to the same character in the ciphertext regardless of its position in the text. For example, if the algorithm says that letter A in the plaintext is changed to letter D. In other words, the relationship between letters in the plaintext and the ciphertext is one to one.

Example: we use lowercase character to show the plaintext; we use the uppercase characters to show the ciphertext. The cipher is probably the monoalphabetic because both 1's are encrypted as 0's.

Plaintext: hello ciphertext: khoor

## Caesar cipher

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. Caesar cipher is susceptible to a statistical ciphertext only attack. Julius Caesar used this additive cipher to communicate with his officers. For this reason additive ciphers are referred as Caesar cipher. Caesar cipher used a key of 3 for his communications.

P

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

q

r

s

t

u

C

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

v

w

x

y

z

V

W

X

Y

Z

21

22

23

24

25

For example: let the message "hello" is encrypted with the key of 15. Then all the characters in the ciphertext will be shifted from 15. Then the answer is

hello= WTAAD

## Mathematically

C (ciphertext) = (P+K) mod 26 (K= key)

P (plaintext) = (C-K) mod 26

To encrypt message "hello"

Plaintext 'h'= 7 encryption (7+15)mod 26 C= 22=> W

Plaintext 'e'= 4 encryption (4+15)mod 26 C= 19=> T

To decrypt "WTAAD"

Ciphertext W=22 decryption (22-15)mod 26 P= 7=>h

Ciphertext T=19 decryption (19-15)mod 26 p= 4=>e

## Cryptanalysis

Caesar ciphers are vulnerable to ciphertext only attacks using exhaustive key searches (brute force attack). The key domain of the Caesar cipher is very small; there are only 26 keys. However, one of the keys, zero, is useless (the ciphertext is same as the plaintext). This leaves only 25 possible keys. Eve can easily launch a brute force attack on the ciphertext.

## Caesar cipher using cryptool

Working the same example using cryptool, first of all, to acquaint ourselves with the Caesar encryption algorithm we will open a document, encrypt it and then decrypt it again. We will then try to get the computer to work out the key with which a plaintext is encrypted.

This plaintext document is encrypted using the Caesar encryption algorithm by selecting the menu crypt/decrypt.

C:\Users\madhu\Desktop\caseaer 5.PNG

Then the following dialog box appears. The key we enter is the number 15. Additionally, we change the options how to interpret the alphabet characters. The first alphabet character is set to 1 (if we set the character to 0 and use A as key, then the resulting ciphertext is the same as the plaintext).

C:\Users\madhu\Desktop\caesar 3.PNG

Clicking on the Encrypt button opens a new window that contains the encrypted text. It becomes apparent that the letters have been shifted by 15 positions. So the word 'hello', is now 'wtaad'

C:\Users\madhu\Desktop\caeser 6.PNG

The plaintext version of this encrypted document can now be obtained by selecting crypt/decrypt again. In this dialog box which appears we now enter the key with which the document was encrypted (15). This time it has to be decrypted so decrypt button must be selected. Now the next step is to find the key using cryptanalysis. The plaintext window is made active by clicking on it. Now the entropy is selected via the menu selection Analysis/General/Entropy)

C:\Users\madhu\Desktop\entropy.PNG

Now the frequency distribution of the letters is calculated.

The histogram of the encrypted document letter frequencies have been shifted by 15 positions. That means the encryption algorithm is not secure. Moreover Z shifts the text by 26 positions so that the "encrypted" text is actually identical with the unencrypted text. Hence there are really only 25 keys.

The Caesar encryption algorithm can be broken easily by a ciphertext only attack. To perform such an attack, restore the window containing the encrypted text to the window and select Analysis/ciphertext only/ Caesar. The text will automatically be analyzed.

By analyzing the superposition it is possible to discover the key which was used to encrypt this document. In this case it was the letter P.

When the decrypt button is clicked the plaintext appears, i.e. the text that has been decrypted with the key 'p' that was discovered. So the cryptool successfully found the key with which the document has been encrypted.

C:\Users\madhu\Desktop\caesar 8.PNG

## Analysis of Caesar Cipher

Advantages

Very easy to use

The encryption and decryption can be done very quickly

Disadvantages

The encryption and decryption algorithms are known

There are only 25 keys to try

The language of the plaintext is known and easily recognizable.

Applications

It was used biblical times can be found on the back of 'Mezuzah' where it encrypts the name of the god.

During the First World War the Russian army used this method to relay messages to troops.

It is used as an application in the Android version 1.4.0

## Polyalphabetic Cipher

In polyalphabetic substitution, each occurrence of a character may have a different substitute. The relationship between characters in the plaintext to a character in the ciphertext is one-to-many. For example, "a" could be enciphered as "D" in the beginning of the text, but as "N" at the middle. Polyalphabetic ciphers have the advantage of hiding the letter frequency of the underlying language. Eve cannot use single letter frequency statistic to break the ciphertext.

To create a polyalphabetic cipher, we need to make each ciphertext character dependent on both the corresponding plaintext character and the position of the plaintext character in the message. This implies that our key should be stream of subkeys, in which each subkey depends somehow on the position of the plaintext character that uses that subkey for encipherment. In other words, we need to have a key stream k= (k1,k2,k3.......) in which ki is used to encipher the ith character in the plaintext to create the ith character in the ciphertext.

## Playfair Cipher

Playfair cipher is the example of polyalphabetic cipher. The secret key in this cipher is made of 25 alphabet letters arranged in a 5x5 matrix (letters I and J are considered the same when encrypting). Different arrangements of the letters in the matrix can create many different secret keys. One of the possible arrangements is shown below

L

G

D

B

A

Q

M

H

E

C

U

R

N

I/J

F

X

V

S

O

K

Z

Y

W

T

P

Before encryption, if the two letters in a pair are the same, a bogus letter is inserted to separate them. After inserting bogus letters, if the number of characters in the plaintext is odd, one extra bogus character is added at the end to make the number of characters even.

The cipher uses three rules for encryption

If the two letters in a pair are located in the same row of the secret key, the corresponding encrypted character for each letter is the next letter to the right in the same row (with wrapping to the beginning of the row if the plaintext letter is the last character in the row).

If the two letters in a pair are located in the same row of the secret key, the corresponding encrypted character for each letter is the letter beneath it in the same column (with wrapping to the beginning of the column if the plaintext letter is the last character in the column).

If the two letters in a pair are not in the same row or column of the secret, the corresponding encrypted for each letter is a letter that is in its own row but in the same column as the other letter.

The playfair cipher meets the criteria for a polyalphabetic cipher. The key is a stream of subkeys in which the subkeys are created two at a time. In playfair cipher, the key stream and the cipher stream are the same. This means that the above mentioned rules can be thought of as the rules for creating the key stream. The encryption algorithm takes a pair of characters from plaintext and creates a pair of subkeys by following the above mentioned rules. We can say that the key stream depends on the position of the character in the plaintext. Position dependency has a different interpretation here the subkey for each plaintext character depends on the next previously neighbour.

If P= P1, P2, P3.........

C= C1, C2, C3.......

K= [(k1, k2), (k3, k4) ...]

Encryption: Ci = ki

Decryption: Pi = ki

Example: keyword is PLAYFAIR

P

L

A

Y

F

I

R

E

X

M

B

C

D

G

H

J

K

N

O

S

T

U

V

W

Z

ENCRYPT: "hide the gold underground"

plaintext

HI

DE

TH

EG

OL

DU

ND

ER

GR

OU

ND

ciphertext

BM

ND

ZB

XD

KY

CV

VN

XE

CX

KW

VN

DECRYPT: DMYRYKEVGHWGNGPXM

ciphertext

DM

YR

YK

EV

GH

WG

NG

GP

XM

plaintext

HE

LX

LO

AN

DG

OX

OD

BY

EX

Message: Hello and Goodbye.

## Cryptanalysis of a Playfair Cipher

Brute force attack on a playfair cipher is very difficult. The size of the key domain is 25! (Factorial 25). In addition, the encipherment hides the single letter frequency of the characters. However, the frequencies of diagrams are preserved. So a cryptanalyst can use a ciphertext-only attack based on the diagram frequency test to find a key.

## Analysis of playfair

## Advantages

The main advantage of the system is it robs a cryptanalyst as they are no longer looking for recurring encoding as in an letter 'e' can be encrypted as different letter each time.

Playfair was long time considerably unbreakable.

There are 26 letters so it is 26*26=676 diagrams which are quiet difficult to break.

## Disadvantages

Still leaves much of the language structure

Frequency distribution of letters

Few 100's of ciphertext letters are enough for cryptanalysis.

## Applications

Playfair cipher was used by British army during World War 1.

When John F. Kennedy's PT-109 was sunk by a Japanese controlled plum pudding island and was able to send an emergency message in playfair from an allied coast watcher's hut to arrange the rescue of the survivors from his crew.

Playfair crossword by Beetlejuice is an example puzzle using playfair as a gimmick.

## Vigenere Cipher

Vigenere cipher made an immediate success as a field cipher. This type of polyalphabetic cipher was designed by Blaise de Vigenere, a sixteenth century French mathematician. A vigenere cipher uses a different strategy to create the key stream. The key stream is a repetition of an initial secret key stream of length m, where we have 1<m<26.

P= p1p2p3.....

C= c1c2c3......

K= [(k1,k2,k3......km),(k1,k2,k3.........km),...]

Encryption: Ci= Pi+Ki Decryption: Pi= Ci-Ki

One important difference between the vigenere cipher and the other polyalphabetic ciphers is that the vigenere cipher key stream does not depend on the plaintext characters; it depends only on the position of the character in the plaintext. In other words the key stream can be created without knowing what the plaintext is.

Example mathematically

"She is listening" this message should be encrypted using the keyword "PASCAL".

plaintext

s

h

e

i

s

l

i

s

t

e

n

i

n

g

P values

18

7

4

8

18

11

8

18

19

4

13

8

13

6

key

15

0

18

2

0

11

15

0

18

2

0

11

15

0

C values

7

7

22

10

18

22

23

18

11

6

13

19

2

6

Ciphertext

H

H

W

K

S

W

X

S

L

G

N

T

C

G

Another way to look at viginere ciphers is through what is called a Vigenere Tableau. The first row shows the plaintext character to be encrypted. The first column contains the characters to be used by the key. The rest of the tableau shows the ciphertext characters. To find the ciphertext for the plaintext "she is listening" using the word 'pascal' as the key, we can find "s" in the first row, "p" in the first column, the cross section is the ciphertext character "H". We can find "h" in the first row and "A" in the second column, the cross section is the ciphertext character "H". The same method should be followed until all the ciphertext characters are found.

C:\Users\madhu\Desktop\table.PNG

## Vigenere Tableau

## Cryptanalysis of Vigenere Cipher

Vigenere ciphers do not preserve the frequency of characters. The cryptanalysis here consists of two parts for finding out the length of the key and finding the key itself.

Several methods has been devised to find the length of the key but one method called kaisiski test, the cryptanalysis searches for repeated text segments, of atleast three characters, in the ciphertext. Suppose that two of the segments are found and the distance between them is d. The cryptanalyst assumes that d/m where m is the key length. If more repeated segments with distances d1,d2,d3....dn then gcd (d1,d2,d3,.....dn)/m. This assumption is logical because if two characters are the same are k*m (k= 1,2,......) characters part in the ciphertext. Cryptanalyst uses segment of at least three characters to avoid the cases where the character in the key are not distinct.

After the length of the key is found, the cryptanalyst uses the idea of dividing the ciphertext into m different pieces and applies the method used to crypt analyze the additive cipher, including the frequency attack. Each ciphertext piece can be decrypted and put together to create the whole plaintext.

## Vigenere Cipher Using Cryptool

To perform vigenere cipher encryption a new document is opened and then the encryption and decryption is performed.

C:\Users\madhu\Desktop\vin1.PNG

This plaintext document is encrypted using the vigenere encryption algorithm by selecting the keys crypt/decrypt/vigenere following which another dialog box appears.

C:\Users\madhu\Desktop\vin3.PNG

By clicking on the Encrypt button opens a new window that contains the encrypted text.

C:\Users\madhu\Desktop\vin2.PNG

The plaintext of this document can now be obtained by selecting crypt/decrypt/vigenere. In the dialog box which appears then where the key with which the document was encrypted. This time the document is to be decrypted. Therefore the decrypt button must be selected.

C:\Users\madhu\Desktop\vin3.PNG

By clicking on the decrypt button the plaintext document appears immediately.

C:\Users\madhu\Desktop\vin4.PNG

To find the key with which the document was encrypted. Restore the encrypted document window and then select analysis/ciphertext only/vigenere, following with which the text will automatically be analyzed.

C:\Users\madhu\Desktop\vin5.PNG

It is possible to work out the key length from the regular peaks in the autocorrelation. It is correctly calculated at 6 characters.

C:\Users\madhu\Desktop\vin6.PNG

When the continue button is clicked, another dialog box opens to display the key that has been computed.

C:\Users\madhu\Desktop\vin7.PNG

By clicking on the decrypt button the dialog box disappears and another window opens which contains the plaintext.

C:\Users\madhu\Desktop\vin8.PNG

## Hill Cipher

Hill cipher is invented by Lester S. Hill. This polyalphabetic cipher divides the plaintext into equal size blocks. The encrypted one at a time in such a way that each character in the block contributes to the encryption of other characters in the block. Hill cipher belongs to the category of ciphers called block ciphers.

C1= (+ + ) mod 26

C2= (+ + ) mod 26

C3= (+ + ) mod 26

The encryption algorithm takes m successive plaintext letters and substitute for them m ciphertext letter. The substitution is determined by m linear equations in which each character is assigned a numerical value (a=0, b=1,c=2, ........z=25). This can be expressed in terms of column vectors and matrices

= mod 26

C = KP mod 26 where C and P are column vectors representing the plaintext and ciphertext. K is the encrypting key.

Example for Hill Cipher:

Plaintext: pay more money

Key (K) =

C = KP mod 26

= mod 26

## =

= LNS

For plaintext pay, ciphertext is LNS.

The entire ciphertext is LNSHDLEWMTRW. For the decryption of the hill cipher is done using the inverse of the matrix K.

## Cryptanalysis of Hill Cipher

Ciphertext-only attack on hill cipher is difficult. Even brute force attack on a hill cipher is extremely difficult because the key is an m*m matrix. Each entry in the matrix can have one of the 26 values. At first glance, this means that the size of the key domain is.

Secondly the hill ciphers do not preserve the statistics of the plaintext. Frequency analysis cannot be run on single letters, diagrams and trigrams. A frequency analysis of words of size m might work, but this is very rare that a plaintext has many strings of size m that are the same.