# Cryptography And Security Attacks 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.

Computers are used by millions of people for many purposes like Banking ,shopping ,tax returns, student records, etc. So, privacy is a crucial issue in many of these applications. Security is to make sure that nosy people cannot read or secretly modify messages intended for other recipients. Here comes in Cryptography .In simplest terms it is the art or science of protecting data. This paper describes the types of ciphers, the various algorithms

Key Words: alphabetically, sorted, excluding, words, used, in, title.

## 1. Introduction

Cryptography is the area of study constituting the schemes to encrypt data. Such a scheme is known as cryptographic system or a cipher and the techniques used for deciphering a data without any knowledge of the enciphering details fall into the area of cryptanalysis.

Traditionally, this is achieved via encryption. Sender A uses encryption to transform intelligible messages M (plaintext) into obscured messages C (ciphertext).Sender B uses the inverse operation (decryption) to recover M from C. The main security requirement in the process is that an eavesdropper cannot figure out message M even if it captures the ciphertext C during transmission.

Rapidly rising cyber crime and the growing prospect of the Internet being used as a medium for terrorist attacks pose a major challenge for IT security. Cryptography is central to this challenge, since it underpins privacy, confidentiality, and identity, which together provide the fundamentals for trusted e-commerce and secure communications.

Fig.1. Model of conventional cryptosystem [1]

## 2. Security Attacks

Any action that compromises the security of information owned by an organization. The two types of attacks that I have focused on are Passive and Active attacks.

## 2.1. Passive Attacks

A passive attack is one in which the attacker only evasdrops i.e he just reads the messages but does not alter them . The two types of passive attacks are the

- Release of message contents and

- Traffic analysis.

The example of release of message contents is prevent an opponent from learning the contents of the transmissions during telephone conversation or electronic mail message,etc.

In traffic analysis, suppose we have encoded the message being sent so that the opponents cannot extract the information even if they have captured the message. The opponent could determine the location and identity of the hosts and the length and frequency of the message which could help him to guess the nature of communication that was taking place.

Passive attacks are difficult to detect because the data is not altered. Thus, the emphasis in dealing with passive attacks is on prevention rather than detection.

## 2.2. Active Attacks

An active attack is one in which the data stream is modified or a false stream is created. It can be divided into four categories

- Masquerade

- Replay

- Modification of messages

- Denial of services

A masquerade takes place when one person pretends to be a different person. It includes one or the other forms of active attack. For instance, a authorized entity with few privileges can obtain extra privileges by impersonating and entity that has those privileges.

Replay involves the passive capture of a data unit and its subsequent retransmission to produce an unauthorized effect.

Modification of messages means parts of the original message are modified or messages are delayed or reordered to produce an unauthorized effect.

Denial of service prevents the normal use of communication facilities. For example, an entity may suppress all messages directed to a particular destination.

It is very difficult to prevent active attacks entirely because of the wide variety of potential physical, software and network vulnerabilities.

## 3. Security Services

X.800 defines a security service as a service provided by the protocol layer of communicating open systems which ensures adequate security of the system or of the data transfers. They are divided into five categories-

1. Authentication - Check the identity of the communicating entity.

a) Peer entity authentication- Used in association with a logical connection to provide confidence in the identity of the entities connected.

b) Data Origin Authentication- In a connectionless transfer, provides assurance that the source of received data is as claimed.

2. Access Control- The prevention of unauthorized use of resources i.e the service controls who can have access to data and under what circumstances.

3. Data Confidentiality- Protecting data from unauthorized disclosure.

a) Connection Confidentiality- The protection of all user data on a connection.

b) Connectionless Confidentiality - The protection of user data in a single block.

c) Selective-field Confidentiality - The confidentiality of selected fields within the user data on a connection or in a single datablock.

d) Traffic flow Confidentiality- The protection of the information that might be derived from the observation of traffic flows.

4. Data Integrity - The assurance that the data received is the same as the original data.

a) Connection integrity with recovery - Provides for the integrity of all user data on a connection and detects any modification, insertion, deletion or replay of any data within an entire data sequence with recovery attempted.

b) Connection integrity without recovery- It provides only detection without recovery.

c) Selective field Connection Integrity- Provides for the integrity of selected fields within the user data

## 2. Classical Encryption Techniques

The two basic building blocks of all encryption techniques are Substitution and Transposition. We examine these in the next two sections and then we will discuss a system to combine both.

## 2.1. Substitution techniques

A substitution technique is one in which the letters of plaintext are replaced by other letters or by numbers or symbols., with one blank line before, and one after.

2.1.1. Caesar Cipher. Caesar's cipher or Caesar's code is one of the most widely known as encryption techniques. In this technique each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 3, A would be replaced by D, B would become E, and so on. The method is named after Julius Caesar, who used it to communicate with his generals. As with all single alphabet substitution ciphers, the Caesar cipher is easily broken and in practice offers essentially no communication security. For example -

Plain : meet me after the party.

Cipher : PHHW PH DIWHU WKH SDUWB.

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 xyz

Cipher : DE FGH I J KLMNOP QR S TUVWXYZABC

Then the algorithm for each plaintext letter p, the ciphertext C is given as -

(1)

where k takes any value in the range 1 to 25.

The decryption algorithm is given as-

(2)

2.1.2. Homophonic Cipher. The Homophonic Substitution Cipher involves replacing each letter with a variety of substitutes, the number of potential substitutes being proportional to the frequency of the letter. For example, the letter 'a' accounts for roughly 8% of all letters in English, so we assign 8 symbols to represent it. Each time an 'a' appears in the plaintext it is replaced by one of the 8 symbols chosen at random, and so by the end of the encipherment each symbol constitutes roughly 1% of the ciphertext. The letter 'b' accounts for 2% of all letters and so we assign 2 symbols to represent it. Each time 'b' appears in the plaintext either of the two symbols can be chosen, so each symbol will also constitute roughly 1% of the ciphertext. This process continues throughout the alphabet, until we get to 'z', which is so the letter's relative abundance.

2.1.3. Polyalphabetic Cipher. It is a multiple-substitution cipher involving the use of different keys. Most polyalphabetic ciphers are periodic substitution ciphers based on a period p. For instance, if a message plaintext is â€¦ then the ciphertext by encryption becomes

(3)

where denotes plaintext letters. For p=1, the cipher is monoalphabetic and equivalent to simple substitution.

## 2.2. Transposition technique

Transposition ciphers are block ciphers that change the position of characters or bits of message plaintext.

The oldest known transposition cipher is the Scytale cipher. A transposition cipher belonging to this category is the depth-k cipher whose plaintext pattern is rearranged in k-row decomposition to conceal the message.Citing an example, if the message plaintext is "WE ARE DISCOVERED FLEE AT ONCE", it is enciphered into the cryptogram by using depth-3 row disposition as-

W . . . . E . . . . C . . . R . . . L . . . T . . . . E

. E . . R . D . S . O. E . E. F. E. A . O. . C..

. . . A . . . . . I . . . . V . . . . . D. . . E. . . . N . .

and is read off as-

WECRL TEERD SOEEF EAOCA IVDEN

Thus, transposition ciphers consists of rearrangement

Of the position of plain text letters rather than those of

the alphabet. The key used for transforming the

plaintext can be recovered from the cryptogram alone.

## 2.3. Classical Product Ciphers

A product cipher is a composition of two or more ciphers such that the ciphertext space of one cipher becomes the message plaintext space of the next. A product cipher involves the steps of both substitution and transposition. An early product cipher is German ADFGVX cipher used in World War-I. Suppose we need to send the plaintext message, "Attack at once". First, a secret mixed alphabet is filled into a 5 Ã- 5 Polybius square, like so-

i , j have been combined to make the alphabet fit

into a 5x5 grid. Using the above square, the message is converted into fractioned form

A T T A C K A T O N C E

AF AD AD AF GF DX AF AD DF FX GF XF

Next, the fractionated message is subject to a columnar transposition. We write out the message in rows under a transposition key (here, "CARGO"):

C A R G O

## ---------------

A F A D A

D A F G F

D X A F A

D D F F X

G F X F X

Next, we sort the letters alphabetically in the transposition key (changing CARGO to ACGOR), rearranging the columns beneath the letters along with the letters themselves

A C G O R

## ---------------

F A D A A

A D G F F

X D F A A

D D F X F

F G F X X

Then it is read off in columns, in keyword order, yielding the ciphertext:

FAXDF ADDDG DGFFF AFAXX AFAFX

## 3. Modern Encryption Techniques

The central issue of cryptanalysis is to determine to what extent a secure cipher system is immune against all kinds of attacks. Modern encryption methods can be divided by two criteria: by type of key used, and by type of input data. The type of key used ciphers are divided into Symmetric key, where the same key is used for encryption and decryption and Assymetric key algorithm, where two different keys are used for encryption and decryption. The examples of symmetric key algorithm are AES and DES and that of asymmetric key algorithm is RSA and ECC. The section below describes all the modern encryption techniques in detail.

## 3.1. Data Encryption Standard (DES)

DES is a block cipher and the most widely known symmetric encryption algorithm. In block encryption, the plaintext is divided into blocks of fixed length which are them enciphered using the same key. DES is the algorithm that with which a 64 bit block of plaintext is enciphered into a 64-bit ciphertext under the control of a 56-bit internal key. The iterated process consists of 16 rounds of encipherment. The central technique governing DES implementation involves the design of DES permutation (P-Box) , substitutions (S-box) and key schedules.

Fig.2. Block diagram illustrating what happens in F-Box.[1]

The Fiestal box (F-box) does four things-

1. Expands the input half-block from 32 to 48 bits by reshuffling and copying some bits. If you number the bits from 0 to 31, the expanded 48-bit block consists of the numbered bits: [31, 0, 1, 2, 3, 4, 3, 4, 5, 6, 7, 8, 7, 8, 9, 10, 11, 12, 11, 12, 13, 14, 15, 16, 15, 16, 17, 18, 19, 20, 19, 20, 21, 22, 23, 22, 23, 24, 25, 26, 27, 28, 27, 28, 29, 30, 31, 0]. So you start with a copy of bit 31, and then do the bits roughly in order, duplicating the pairs (3,4), (7,8), (11,12), (19,20), (22,23), (27,28), and ending with bit 0.

2. XORs the expanded half-block with the subkey.

3. Breaks the resulting 48 bits into 8 six-bit micro-blocks.

4. Runs each six-bit micro-block through a substitution box (or S-box), generating a 4 bit result.

The result of the S-boxes are concatenated together, resulting in a 32 bit result, which is then put through a permutation, giving the final output of the F-box.

The modes of operation of DES is as cited below-

3.1.1. Electronic Code Book (ECB). This is the regular DES algorithm. Data is divided into 64-bit blocks and each block is encrypted one at a time. Separate encryptions with different blocks are totally independent of each other. This means that if data is transmitted over a network or phone line, transmission errors will only affect the block containing the error. It also means, however, that the blocks can be rearranged, thus scrambling a file beyond recognition, and this action

would go undetected. ECB is the weakest of the various modes because no additional security measures are implemented besides the basic DES algorithm. However, ECB is the fastest and easiest to implement, making it the most common mode of DES.

3.1.2. Cipher Block Chaining (CBC). In this mode of operation, each block of ECB encrypted ciphertext is XORed with the next plaintext block to be encrypted, thus making all the blocks dependent on all the previous blocks. This means that in order to find the plaintext of a particular block, you need to know the ciphertext, the key, and the ciphertext for the previous block. The

first block to be encrypted has no previous ciphertext, so the plaintext is XORed with a 64-bit number called the Initialization Vector. So, if data is transmitted over a network or phone line and there is a transmission error, the error will be carried forward to all subsequent blocks since each block is dependent upon the last. This mode of operation is more secure than ECB because the extra XOR step adds one more layer to the encryption process.

## 3.1.3. Cipher Feedback (CFB).

In this mode, blocks of plaintext that are less than 64 bits long can be encrypted. Normally, special processing has to be used to handle files whose size is not a perfect

multiple of 8 bytes, but this mode removes that necessity (Stealth handles this case by adding several dummy bytes to the end of a file before encrypting it). The plaintext itself is not actually passed through the DES algorithm, but merely XORed with an output block from it, in the

following manner: A 64-bit block called the Shift Register is used as the input plaintext to DES. This is initially set to some arbitrary value, and encrypted with the DES algorithm. The ciphertext is then passed through an extra component called the M-box, which simply selects the left-most M bits of the ciphertext, where M is the number of bits in the block we wish to encrypt. This value is XORed with the real plaintext, and the output of that is the final ciphertext. Finally, the ciphertext is fed back into the Shift Register, and used as the plaintext seed for the next block to be encrypted. As with CBC mode, an error in one block affects all subsequent blocks during data transmission. This mode of operation is similar to CBC and is very secure, but it is slower than ECB due to the added complexity.

3.1.4 Output Feedback (OFB). This is similar to CFB mode, except that the ciphertext output of DES is fed back into the Shift Register, rather than the actual final ciphertext. The Shift Register is set to an arbitrary initial value, and passed through the DES algorithm. The output from DES is passed through the M-box and then fed back into the Shift Register to prepare for the next block. This value is then XORed with the real plaintext (which may be less than 64 bits in length, like CFB mode), and the result is the final ciphertext. Unlike CFB and CBC, a transmission error in one block will not affect subsequent blocks because once the recipient has the initial Shift Register value, it will continue to generate new Shift Register plaintext inputs without any further data input. However, this mode of operation is less secure than CFB mode because only the real ciphertext and DES ciphertext output is needed to find the plaintext of the most recent block. Knowledge of the key is not required.

## 3.2. AES Algorithm

AES is a symmetric block cipher with a block length of 128 bits and support for key length of 128, 192 and 256 bits. It was designed to have the following characteristics-

1. Resistance against all known attacks.

2. Speed and code compactness on a wide range of platform.

3. Design simplicity

## 3.3. RSA Algorithm

The RSA algorithm was developed by Ron Rivest, Adi Shamir, and Len Adleman and first published in 1977. RSA is a public-key algorithm used ubiquitously in Internet and electronic communication security, as an important part of document authentication and user identity verification. It is present as a key component of many e-commerce and email security systems, VPNs, security suites, as well as in most popular security protocols. These include SSL/TLS (to secure web traffic between servers and clients), as well as SSH, SET, MIME, PGP, and DNSSEC. The RSA algorithm employs the discrete logarithm and factorization of the product of two large primes. Two large primes P and Q are generated and the sender calculates their product N=PQ. Then the sender finds integers E and D such that[2]

E . D = 1 mod Î¦(N) (3)

where Î¦(N) = (P-1) (Q-1) is called Euler's totient function, and gcd (Î¦(N), E) = 1. Thus, the public key (N,E) can be placed in a public key directory whereas the secret key D must be kept privately.

## 3.3. Elliptic Curve Algorithm

Elliptic curve cryptography is an approach to public-key cryptography based on the algebraic structure of elliptic curves over finite fields. For elliptic-curve-based protocols, it is assumed that finding the discrete logarithm of a random elliptic curve element with respect to a publicly-known base point is infeasible. For current cryptographic purposes, an elliptic curve is a plane curve which consists of the points satisfying the equation-

(4)

Fig.3. Elliptic curve for y2 = x3 + ax + b [5]

## 4. Symmetric Vs. Assymetric cryptography

There are two types of cryptosystem used in today's world. To understand which one is better in terms of performance let us focus on how they differ in their characteristics-

1. Use of Keys - In a symmetric cryptosytem, the sender and receiver use the same key to encrypt and decrypt the message. This is easily understood and is a great way to transfer information among very small groups of people. The problem is that it is not scalable if you wish to keep secrets within the group. Whereas in an asymmetric cryptosystem, this problem is solved by providing each user with two pair of keys: one public and one private. Any message encrypted with one key from the pair can only be decrypted with the other key from the pair.

For symmetric cryptography-

(5)

For asymmetric cryptography-

(6)

where K is the number of keys and N is the number of participants in the conversation.

## TABLE 1

## Symmetric vs. Assymetric scalability based on eqn (5) and (6)

## Number of participants

## Number of Symmetric Keys

## Number of Assymetric keys

## 2

## 1

## 4

## 4

## 6

## 8

## 10

## 45

## 20

## 100

## 4950

## 200

## 1000

## 499,500

## 2,000

## 10000

## 4,999,500

## 20,000

(b)

Fig.3(a) Symmetric cryptography in a meshed network and 3(b) Assymetric cryptography in a meshed network[7]

2. Speed comparision - Software encryption using DES (symmetric key algorithm) is about 100 times faster than using RSA (assymetric key algorithm) - estimate provided by RSA data securities. Hardware encryption using DES is about 1000 - 10000 times faster than hardware encryption using RSA.

## 5. Cryptanalysis Attacks On DES

The prime concern with DES has been its vulnerability to Brute force Attack because of its relatively short key length. But with triple DES, Brute Force techniques had become impractical. The two most powerful approaches of cryptanalysis are Differential and Linear cryptanalysis.

## 5.1. Differential Cryptanalysis

It is the first published that is capable of breaking DES in less than 2^55 complexity. For example, you know that we're using DES with a 56 bit key. So you take your initial plaintext, T0, and you encrypt it, giving you a ciphertext, C0. Then you change one bit of T0, giving you T1, and you encrypt that, giving you C1. C1 differs from C0 in some number of bits. The problem is reduced from a blind search of a search-space of 264 possible keys to utter triviality by a set of 8 chosen plaintexts

Fig.4. Steps involved in Differential Cryptanalysis[]

## 5.2. Linear Cryptanalysis

Linear cryptanalysis is based on finding linear approximations to describe the transformations performed in DES. Given 2^43 known plaintexts, as compared to 2^47 chosen plaintexts for differential cryptanalysis, we can find the DES key. It is a improved version of the differential method because it may be easier to acquire known plaintext rather than chosen plaintext. For a cipher with n-bit plaintext and ciphertext blocks and an m-bit key, let the plaintext block be labeled as P[1], P[2]â€¦.P(n)

The cipher-text block C[1], C[2],â€¦..C(n) and the key K[1], K[2]â€¦..K[m]. Then define A[i,j,â€¦.k] = A[i] XOR A[j] XORâ€¦.A[k]. The objective of the linear cryptanalysis is to find an effective linear equation of the form [book]

P (4)

(where x= 0 or 1; 1 <=a, b <= n, 1 <= c <= m, and where Î±, Î² and Î³ terms represent fixed,unique bit locations) that holds with probability p not= 0.5. The further p is from 0.5, the more effective the equation.

## 5.3. Brute Force Attack

A brute force attack is a strategy used to break the encryption of data. It involves traversing the search space of possible keys until the correct key is found. Symmetric ciphers with keys 64 bits or fewer are vulnerable to brute force attacks. The term "Brute Force Attacks" is really an umbrella term for all attacks that exhaustively search through all possible (or likely) combinations, or any derivative thereof.

5.3.1 Dictionary Attack. A Dictionary-Attack is a common password cracking technique, relying largely on the weak passwords selected by average computer users. For instance, if an attacker had somehow accessed the hashed password files through various malicious database manipulations and educated searching on an online store, he would then write a program to hash one at a time all words in a dictionary (of, for example any or all languages and common derivative passwords), and compare these hashes to the real password hashes he had obtained. If the hashes match, he has obtained a password

5.3.2 Pre-Dictionary Attack. The dictionary attack was very time consuming due to large number of password hashes. So, pre-dictionary attack was developed. In this attack, the attacker has already hashed his entire suite of dictionaries, and all he need do is compare the hashes. Additionally, his task is made easier by the fact that many users will select the same passwords. To prevent this attack, a database administrator must attach unique 32-bit salts to the users passwords before hashing, thus rendering precompution useless..

## 6. Diffie Hellman Key Exchange

The purpose of the Diffie Hellman algorithm is to enable two users to securely exchange a key that can be used for subsequent encryption of messages. It depends for its effectiveness on the difficulty of computing discrete algorithms in the following way. For this scheme, first we define the primitive root of the prime number q as one whose power modulo q generate all the integers from 1 to q-1. Suppose users A and B wish to exchange a key. User A selects a random integer and mod q. Similarly user B independently selects a random integer and computes mod q. User A computes the key as-

(5)

The security of the Diffie-Hellman key exchange lies in the fact that, while it is relatively easy to calculate exponentials modulo a prime, it is very difficult to calculate discrete logarithms.