unit i introduction & number theory unit-i / part-a...

33
www.studentsfocus.com UNIT I INTRODUCTION & NUMBER THEORY Services, Mechanisms and attacks-the OSI security architecture-Network security model-Classical Encryption techniques (Symmetric cipher model, substitution techniques, transposition techniques, steganography).FINITE FIELDS AND NUMBER THEORY: Groups, Rings, Fields- Modular arithmetic-Euclids algorithm-Finite fields- Polynomial Arithmetic –Prime numbers- Fermats and Eulers theorem-Testing for primality -The Chinese remainder theorem- Discrete logarithms. UNIT-I / PART-A 1. List the types of security attacks with examples.(Nov/Dec’16) ü Passive attacks have to do with eavesdropping on, or monitoring, transmissions. Electronic mail, file transfers, and client/server exchanges are examples of transmissions that can be monitored. ü Active attacks include the modification of transmitted data and attempts to gain Unauthorized access to computer systems. This can be subdivided into four Categories: masquerade, replay, modification of messages, and denial of service. 2. Find GCD (1970,1066) using Euclid’s Algorithm.(Nov/Dec’16)

Upload: others

Post on 14-Mar-2020

9 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

UNIT I INTRODUCTION & NUMBER THEORY

Services, Mechanisms and attacks-the OSI security architecture-Network security model-Classical Encryption techniques (Symmetric cipher model, substitution techniques, transposition techniques, steganography).FINITE FIELDS AND NUMBER THEORY: Groups, Rings, Fields-Modular arithmetic-Euclid‟s algorithm-Finite fields- Polynomial Arithmetic –Prime numbers-Fermat‟s and Euler‟s theorem-Testing for primality -The Chinese remainder theorem- Discrete logarithms.

UNIT-I / PART-A 1.

List the types of security attacks with examples.(Nov/Dec’16) ü Passive attacks have to do with eavesdropping on, or monitoring, transmissions.

Electronic mail, file transfers, and client/server exchanges are examples of transmissions that can be monitored.

ü Active attacks include the modification of transmitted data and attempts to gain Unauthorized access to computer systems. This can be subdivided into four Categories: masquerade, replay, modification of messages, and denial of service.

2. Find GCD (1970,1066) using Euclid’s Algorithm.(Nov/Dec’16)

Page 2: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

3. Define Fermat & Euler’s theorem.(Apr/May’17) ü Fermat’s little theorem states that if p is a prime number, then for any integer a, not

divisible by p. then ap ≡ a(mod p)

ü It is the basis for primality test. ü It plays an important role in public key cryptography

In number theory, Euler's theorem (also known as the Fermat–Euler theorem or Euler's theorem (also known as the Fermat–Euler theorem or Euler's totient theorem) states that if n and a are co prime positive integers, then a φ(n) ≡1(mod n) where φ(n) is Euler's totient function.

4. Determine the GCD (24140,16762) using Euclid’s algorithm.(Apr/May’17) Soln: We know, gcd(a,b)=gcd(b,a mod b)

gcd(24140,16762)=gcd(16762,7378) gcd(7378,2006)=gcd(2006,1360) gcd(1360,646)=gcd(646,68) gcd(68,34)=34 gcd(24140,16762) = 34.

5. What are the two basic functions used in encryption algorithms? All the encryption algorithms are based on two general principles: Substitution: In which each element in the plaintext(bit, letter, group of bits or letters) is mapped into another element. Transposition: In which elements in the plaintext are rearranged. The fundamental requirement is that no information be lost(that is ,that all operations are reversible). Most systems, referred to as product systems, involve multiple stages of substitutions and transpositions.

6. How many keys are required for two people to communicate via a cipher? If both sender and receiver use the same key, the system is referred as symmetric, single-key, secret-key or conventional encryption. If both sender and receiver uses a different key, the system is referred as asymmetric, two-key or public key encryption.

7. What is a transposition cipher? Transposition cipher, simple data encryption scheme in which plaintext characters are shifted in some regular pattern to form cipher text. For example, the “rail fence,” in which letters of the plaintext are written alternating between rows and the rows are then read sequentially to give the cipher. In a depth-two rail fence (two rows) the message WE ARE DISCOVERED SAVE YOURSELF would be written

Page 3: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

8. What is cryptography and cryptanalysis? ü Cryptanalysis: techniques used for deciphering or decrypting a message without the

knowledge of the enciphering or encrypting details. ü Cryptography is the art of achieving security by encoding messages to make them non-

readable. ü The study of cryptography and cryptanalysis together is called Cryptology.

9. What is the difference between a mono alphabetic cipher and a poly alphabetic cipher? ü A mono alphabetic cipher is a substitution cipher in which the cipher alphabet is fixed

through the encryption process. Ex: Caesar cipher ü The cipher text corresponding to a particular character in the plaintext is not fixed. A

polyalphabetic cipher is a substitution cipher in which the cipher alphabet changes during the encryption process. Ex: play fair cipher

10. What is the difference between an unconditionally secure cipher and a computationally secure cipher? ü A secure cipher is called an unconditionally secure cipher if the cipher text generated

by the cipher does not contain enough information to determine uniquely the corresponding plain text, no matter how much cipher text is available.

ü A computationally secure cipher is the one in which cost of breaking the cipher exceeds the value of the encrypted information and the time required to break the cipher exceeds the useful lifetime of the information.

11. Define replay attack? Replay attacks are the network attacks in which an attacker spies the conversation between the sender and receiver and takes the authenticated information e.g. sharing key and then contact to the receiver with that key.

12. Define the monoalphabetic cipher. The monoalphabetic substitution takes a letter of an alphabet and substitutes it with another letter, this way a cipher text is generated. The way of converting is fixed. A character of the plaintext will be replaced by the same cipher text character, during the entire cipher text. A popular example for the monoalphabetic substitution is the caesar cipher. Principle The first step is to write down the plaintext alphabet. It includes all characters needed for the message. In this example only upper case letters will be used. ABCDEFGHIJKLMNOPQRSTUVWXYZ The second step is to build an additional random alphabet. QWERTZ*LKJHGFDSAÄÖÜMNBVCX An A becomes /. B is replaced by Q. C replaced by W, etc. The word „EXAMPLE“would be encoded by: „RV/GSHR“.

13. What is the difference between a block cipher and a stream cipher? Block Ciphers:

ü Block ciphers encrypt plaintext in blocks of arbitrary size. Common block sizes are 64 and 128 bits. Examples are AES, DES.

Stream Ciphers: ü Stream ciphers encrypt plaintext one bit at a time. A stream cipher can be thought of

Page 4: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

as a block cipher with a block size = 1. Examples are RC4, One Time Pad. 14. What is integrity?

ü Data integrity refers to maintaining and assuring the accuracy and consistency of data over its entire life-cycle, and is a critical aspect to the design, implementation and usage of any system which stores, processes, or retrieves data.

15. What is non repudiation? ü Nonrepudiation is the assurance that someone cannot deny something. ü Typically, nonrepudiation refers to the ability to ensure that a party to a contract or a

communication cannot deny the authenticity of their signature on a document or the sending of a message that they originated.

16. Write about CIA triad.

ü Confidentiality and privacy are one and the same. This facet of the security triangle

focuses on keeping sensitive data away from unauthorized parties. A commitment to confidentiality means organizations in possession of vast amounts of information must adopt practices specifically built around safeguarding that information. It may very well call for a special training program that educate access-carrying employees across all departments on the best practices in password protection, social engineering, and other topics that are imperative to cyber security.

ü Integrity is all about ensuring the quality and consistency of data .Ensuring integrity can be as simple as creating policies that dictate which users have access to certain information and who has what level of file privileges.

ü Availability is the CIA facet that arguably demands the most from an organization. In a nutshell, it entails the ongoing process of doing whatever is necessary to keep all hardware and software components up and running.

17. What are the classical encryption techniques? 1. SUBSTITUTION TECHNIQUES

ü Caesar Cipher ü Monoalphabetic Ciphers ü Play fair Cipher ü Hill Cipher ü Polyalphabetic Ciphers

2. One-Time Pad 3. TRANSPOSITION TECHNIQUES

Page 5: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

4. ROTOR MACHINES 5. STEGANOGRAPHY

18. What are the types of cryptographic attacks? ü Fault analysis Attacks ü Power Analysis Attacks ü Timing Attacks ü Side Channel Attack (SCA) ü Man in Middle Attack (MIM) ü Birthday Attack ü Brute Force Attack (BFA) ü Dictionary Attack ü Chosen Plaintext Attack (CPA) ü Known Plaintext Attack (KPA) ü Cipher text Only Attacks (COA)

19. Write about asymmetric encryption.

Asymmetric cryptography or public-key cryptography is cryptography in which a pair of

keys is used to encrypt and decrypt a message so that it arrives securely. Initially, a

network user receives a public and private key pair from a certificate authority.

20. Write about polynomial arithmetic. ü Polynomial arithmetic is a branch of algebra dealing with some properties

of polynomials which share strong analogies with properties of number theory relative to integers.

ü It includes basic mathematical operations such as addition, subtraction, and multiplication, as well as more elaborate operations like Euclidean division, and properties related to roots of polynomials.

ü The latter are essentially connected to the fact that the set K[X] of univariate polynomials with coefficients in a field K is a commutative ring, such as the ring of integers .

21. Write about the Chinese remainder problem. ü The Chinese remainder theorem is a result about congruence in number theory and its

generalizations in abstract algebra. ü In its basic form, the Chinese remainder theorem will determine a number n that, when

divided by some given divisors, leaves given remainders. ü Ex: what is the smallest number n that when divided by 3 leaves a remainder of 2,

when divided by 5 leaves a remainder of 3, and when divided by 7 leaves a remainder of 2

22. What are groups, Rings, and Fields? A group is defined as a set of elements, together with an operation performed on pairs of these elements such that: 1. It is thus fully defined, and closed over the set for any operation. 2. One element of the set is an identity element. e op x = x op e = x. 3. Every element of the set has an inverse element. If we take any element of the set p,

there is another element q such that p op q = q op p = e.

Page 6: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

4. The operation is associative. For any three elements of the set, (a op b) op c always equals a op (b op c).

A ring is a set of elements with two operations, one of which is like addition, the other of which is like multiplication, which we will call add and mul. It has the following properties: 1. The elements of the ring, together with the addition operation, form a group. 2. Addition is commutative. That is, for any two elements of the set p and q, p add q = q

add p. 3. The multiplication operation is associative. 4. Multiplication distributes over addition: that is, for any three elements of the group a,

b, and c, a mul ( b add c ) = (a mul b) add (a mul c). 5. Addition and multiplication modulo 5 and modulo 6 both yield rings. Matrix

multiplication also leads to rings as well. A field is a ring in which the elements, other than the identity element for addition, and the multiplication operator, also form a group.

23. Write about Symmetric Encryption.

A shared secret key, which can be a number, a word, or just a string of random letters, is

applied to the text of a message to change the content in a particular way. For decryption

also the same key is used.

24. Explain the substitution techniques. A substitution cipher is a method of encoding by which units of plaintext are replaced with cipher text, according to a fixed system; the "units" may be single letters (the most common), pairs of letters, triplets of letters, mixtures of the above, and so forth. The receiver deciphers the text by performing the inverse substitution. Types : If the cipher operates on single letters, it is termed a simple substitution cipher If a cipher that operates on larger groups of letters is termed polygraphic A mono alphabetic cipher uses fixed substitution over the entire message polyalphabetic cipher uses a number of substitutions at different positions in the message

25. Write about Steganography. Steganography is the practice of concealing a file, message, image, or video within another file, message, image, or video. Generally, the hidden messages appear to be (or be part of) something else: images, articles, shopping lists, or some other cover text. For example, the hidden message may be in invisible ink between the visible lines of a private letter. Some of the related techniques are

1. Character marking 2. Invisible ink 3. Pin punctures 26. Decipher the following cipher text using brute force attack:

CMTMROOEOORW ( Hint : Algorithm – Rail fence) Assume the rail-fence of depth = 2 In cipher text, there are 12 characters. Since cipher text is written row wise. Fit the cipher text characters in two rows each with 6- characters as follows

1 2 3 4 5 6 7 8 9 10 11 12 C - M - T - M - R - O - - O - E - O - O - R - W

Page 7: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

Now read the characters diagonally, We get the plain text COME TOMORROW 27. Apply Miller Rabin primality testing to determine whether 221 is prime.

To check whether the given number is prime n = 221 Step : 1 Find n-1 Here n – 1 = 220 Step : 2 Choose integers k and q. such that K > 0 and q is an odd integer such that 2 k q = n-1 . Here k = 2 q = 55 ( since 2 2 * 55 = 220) Step : 3 Choose random integer a such that 1 < a < (n-1) Here a = 5 Step : 4 Compute a q mod n = 1 and check whether it is equal to 1 or (n-1) ie) 1 or 220 Here 5 55 mod 221 = 112 Step : 5 Continue the test with j = 0 to k – 1 find ( a 2 ) jq mod n ≡ n -1 Here J = 0 & 1

ü mod n = 5 2(0*55) mod 221 = 5 ≠ 1, n – 1 ü mod n = 5 2(1*55) mod 221 = 168 ≠ 1, n – 1

This shows 221 is composite. But suppose we had selected a = 21. Then we have 2155 mod 221 = 200; (2155)2 mod 221 = 220; and the test returns inconclusive. ie) May be prime. [Note : The value of - ‘a’ is between 2 to 219 . and these 4 – values 21, 47, 174, and 200 yield inconclusive. ]

28. Why modular arithmetic has been used in cryptography? Modular Arithmetic A kind of integer arithmetic that reduces all numbers to one of a fixed set [0 ... n -1] for some number n. Any integer outside this range is reduced to one in this range by taking the remainder after division by n. Purpose of modular arithmetic in cryptography ü Modular arithmetic allows us to easily create groups, rings and fields which are

fundamental building blocks of most modern public-key cryptosystems. Ex : Diffie-hellman

ü The fundamental operation of combining a key stream with a plain bit stream at the binary level is XORing them together. This is the same as addition modulo 2.

ü Modern public cryptography has lots of modular-arithmetic protocols RSA. Repeatedly calls for raising numbers to exponents modulo various other numbers.

29. What is discrete logarithm problem? Fix a prime p. Let a, b be nonzero integers (mod p). The problem of finding x such that ax ≡ b (mod p) is called the discrete logarithm problem.

30. Why random numbers are used in network security? All good crypto relies on some degree of randomness, which if not fulfilled properly can lead to a significant loss in the strength of encryption. Many uses of random numbers in cryptography

ü Nonce in authentication protocols to prevent replay ü session keys ü public key generation ü key stream for a one- time pad

31. Define primitive root. Let p be a prime. Then b is a primitive root for p if the powers of b,b^1,b^2,b^3,include all

Page 8: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

of the residue classes mod p(except 0).Since there are p-1 residue classes mod p(not counting 0) that means the first p-1 powers of b have to be a different mod p.

32. What for the miller Rabin algorithm is used? The Miller–Rabin primality test or Rabin–Miller primality test is a primality test. An algorithm which determines whether a given number is prime, similar to the Fermat primality test.

UNIT-I / PART-B 1. i) Explain OSI Security Architecture model with neat diagram.

ü The OSI Security Architecture is a framework that provides a systematic way of defining the requirements for security and characterizing the approaches to satisfy those requirements.

ü This defines security attacks, mechanisms, and services, and the relationships among these categories.

ü Security attack: Any action that compromises the security of information owned by an organization.

ü Security mechanism: A process (or a device incorporating such a process) that is designed to detect, prevent, or recover from a security attack.

ü Security service: A processing or communication service that enhances the security of the data processing systems and the information transfers of an organization. The services are intended to counter security attacks, and they make use of one or more security mechanisms to provide the service.

Network security Model :

ü The two parties, who are the principals in this transaction, must cooperate for the exchange to take place.

ü A logical information channel is established by defining a route through the internet from source to destination and by the cooperative use of communication protocols (e.g., TCP/IP) by the two principals.

Fig : Model of Network Security

All the techniques for providing security have two components:

ü A security-related transformation on the information to be sent. Examples include the encryption of the message, which scrambles the message so that it is unreadable by the opponent, and the addition of a code based on the contents of the message, which can be used to verify the identity of the sender.

ü Some secret information such as an encryption key shared by the two principals and, it is unknown to the opponent.

ü A trusted third party may be needed to achieve secure transmission. For example, a

Page 9: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

third party may be responsible for distributing the secret information to the two principals while keeping it from any opponent. Or a third party may be needed to arbitrate disputes between the two principals concerning the authenticity of a message transmission.

1. Design an algorithm for performing the security-related transformation. The algorithm should be such that an opponent cannot defeat its purpose.

2. Generate the secret information to be used with the algorithm. 3. Develop methods for the distribution and sharing of the secret (encryption key)

information. 4. Specify a protocol to be used by the two principals that makes use of the security

algorithm and the secret information to achieve a particular security service. A general model for network security access is as shown below which reflects a concern for protecting an information system from unwanted access.

Fig : Network security access Model

ü The hacker can be someone who, with no harmful intent, simply gets satisfaction

from breaking and entering a computer system. Or, the intruder can be a dissatisfied employee who wishes to do damage, or a criminal who seeks to exploit computer assets for financial gain (e.g., obtaining credit card numbers or performing illegal money transfers).

ü Information access threats intercept or modify data on behalf of users who should not have access to that data.

ü Service threats exploit service flaws in computers to inhibit use by legitimate users. ü Viruses and worms are two examples of software attacks. Such attacks can be

introduced into a system by means of a disk that contains the unwanted logic concealed in otherwise useful software.

ii) Describe the various security mechanisms. SPECIFIC SECURITY MECHANISMS

May be incorporated into the appropriate protocol layer in order to provide some of the OSI security services.

PERVASIVE SECURITY MECHANISMS

Mechanisms that are not specific to any particular OSI security service or protocol layer.

ü Encipherment The use of mathematical algorithms to transform data into a form that is not readily intelligible. The transformation and subsequent recovery of the data depend on an algorithm and zero or more encryption keys.

ü Digital Signature Data appended to, or a cryptographic transformation of, a data unit that allows a recipient of the data unit to prove the

ü Trusted Functionality

That which is perceived to be correct

with respect to some criteria (e.g., as

established by a security policy).

ü Security Label

The marking bound to a resource (which

may be a data unit) that names or

Page 10: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

source and integrity of the data unit and protect against forgery (e.g., by the recipient).

ü Access Control A variety of mechanisms that enforce access rights to resources.

ü Data Integrity A variety of mechanisms used to assure the integrity of a data unit or stream of data units.

ü Authentication Exchange A mechanism intended to ensure the identity of an entity by means of information exchange.

ü Traffic Padding The insertion of bits into gaps in a data stream to frustrate traffic analysis attempts.

ü Routing Control Enables selection of particular physically secure routes for certain data and allows routing changes, especially when a breach of security is suspected.

ü Notarization The use of a trusted third party to assure certain properties of a data exchange.

designates the security attributes of that

resource.

ü Event Detection

Detection of security-relevant events.

ü Security Audit Trail

Data collected and potentially used to

facilitate a security audit, which is an

independent review and examination of

system records and activities.

ü Security Recovery

Deals with requests from mechanisms, such as event handling and management functions, and takes recovery actions.

2. i) State the Chinese Remainder theorem and find X for the given set of congruent equations using CRT.(Nov/Dec’16)

X ≡ 2 mod 3 X ≡ 3 mod 5

X ≡ 2 mod 7 The Chinese Remainder Theorem

• The Chinese Remainder Theorem says it is possible to reconstruct integers in certain range from their residues modulo a set of pair wise relatively prime moduli.

Solution :

To find x :

where the mi are pairwise relatively prime; ie) GCD(mi,mj) = 1 for 1 ≤ i, j ≤ k and i ≠ j .

Page 11: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

-------------- ( 1 )

ai ‘s are dividends in the given equation. a1 = 2 ; a2 = 3 ; a3 = 2

mi’s are divisors in the given equation. m1 = 3 ; m2 = 5; m3 = 7

Then m = m1*m2*m3 = 3*5*7 = 105

To find Mi

M1 = m/m1 = 105 / 3 = 35 M2 = m/m2 = 105/5 = 21 M3 = m/ m3 = 105 / 7 = 15

To find Si

To find S1 To find S2 To find S3

The value s1 needs to be the

modular inverse of

M1 mod m1.

ie) s1 = M1 mod m1 =>

s1 = 35 mod 3

Reducing it

by dividing 35/3 = 2 mod 3

Find inverse of 2 mod 3

2*s1 = 1 mod 3

(for s1 – substitute values < 3

ie) 0,1,2)

2 * 0 = 0 mod 3

2* 1 = 2 mod 3

2*2 =1mod3(since remainder

= 1 s1 = 2)

S2 = M2 mod m2

=> 21 mod 5

By reducing

(21/5) = 1 mod 5

Find the inverse of

1 mod 5

1 * s2 = 1 mod 5

( for s2 - substitute values <

5 )

1 * 0 = 0 mod 5

1* 1 = 1 mod 5 ( since

remainder = 1 s2 = 1)

1 * 2 = 2 mod 5

1 * 3 and 1 * 4 will yield

remainders 3 & 4)

S3 = M3 mod m3 =>

15 mod 7

By reducing

(15/7) = 1 mod 7

Find the inverse of 1 mod 7

1 * s3 = 1 mod 7

(for s3 - substitute values < 7 )

1 * 0 = 0 mod 7

1* 1 = 1 mod 7 ( since

remainder = 1 s3 = 1)

1 * 2 = 2 mod 7

1 * 3 , 1 * 4 , 1* 5, 1*6 will

yield remainders 3, 4,5,6)

Now substitute the values ai, Mi and Si in eqn ( 1)

Here n = 3

x = 2 * 35 * 2 + 3 * 21 * 1 + 2 * 15* 1 = 140 + 63 + 30 = 233

x = 233

S3 = 1

S2 = 1 S1 = 2

Page 12: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

x ≡ 233 mod m ( here m = 105)

x ≡ 233 mod 105

By reducing 233 / 105 . X ≡ 23 mod 105 is the solution of the given congruencies.

ii) State and prove Fermat’s Theorem and Euler’s Theorem. Fermat’s theorem

Fermat's theorem states the following: If p is prime and a is a positive integer not divisible

by p, then

Proof :

ü Consider the set of positive integers less than p:{1,2,..., p - 1} and multiply each element by a, modulo p, to get the set X = {a mod p, 2a mod p, . . . (p- 1)a mod p}.

ü None of the elements of X is equal to zero because p does not divide a. Furthermore no two of the integers in X are equal.

ü To see this, assume that ja ≡ ka(mod p) where 1 ≤ j < k ≤ p -1. ü Because a is relatively prime to p, we can eliminate a from both sides of the

equation resulting in: j ≡ k(mode p). ü This last equality is impossible because j and k are both positive integers less than

p. ü Therefore, we know that the (p -1) elements of X are all positive integers, with no

two elements equal. ü We can conclude the X consists of the set of integers {1,2,..., p -1} in some order. ü Multiplying the numbers in both sets and taking the result mod p yields

a x 2a x ... x (p-1) [(1 x 2 x ... x (p-1)](mode p) ap-1(p-1)! ≡ (p - 1)!(mod p) We can cancel the (p- 1)! term because it is relatively prime to p. This yields

Use of Fermat’s theorem: This is used in public key and primality testing.

3. State Chinese Remainder theorem and find X for the given set of congruent equations using CRT.(Apr/May’17)

X ≡ 1 mod 5 X ≡ 2 mod 7 X ≡ 3 mod 9 X ≡ 4 mod 1

a1=1 a2=2 a3=3 a4=4 n1=5

Page 13: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

n2=7 n3=9 n4=11 M=n1n2n3n4 M=5*7*9*11=3465

mi=M/ni m1=3465/5=693 m2=3465/7=495 m3=3465/9=385 m4=3465/11=315

miyi=1 mod ni

693y1=1 mod 5 y1=2 mod 5 495y2= 1 mod 7 y2=3 mod 7 385y3=1 mod 9 y3=4 mod 9 315y4=1 mod 11 y4=8 mod 11

x=(a1m1y1+a2m2y2+ a3m3y3)mod M =((1*693*2)+(2*495*3)+(3*385*4)+(4*315*8)) mod 3465 =19056 mod 3465 =1731

4. Describe : i) Play fair cipher ii) Rail fence cipher iii) Vignere cipher.

ü The best known multiple letter encryption cipher is the playfair, which treats digrams in the plaintext as single units and translates these units into cipher text digrams.

ü The play fair algorithm is based on the use of 5x5 matrix of letters constructed using a keyword.

Let the keyword be “monarchy‟. The matrix is constructed by

ü Filling in the letters of the keyword from left to right and from top to bottom

ü Duplicates are removed ü Remaining unfilled cells of the matrix is filled with remaining alphabets

in alphabetical order. ü The matrix is 5x5. It can accommodate 25 alphabets. To accommodate the

26th alphabet I and J are counted as one character.

Rules for encryption

Page 14: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

ü Repeating plaintext letters that would fall in the same pair are separated with a filler letter such as ‘x’.

ü Two plaintext letters that fall in the same row of the matrix are each replaced by the letter to the right, with the first element of the row circularly following the last. For example, ar is encrypted as RM.

ü Two plaintext letters that fall in the same column are each replaced by the letter beneath, with the top element of the column circularly following the last. For example, mu is encrypted as CM.

ü Otherwise, each plaintext letter in a pair is replaced by the letter that lies in its own row and the column occupied by the other plaintext letter. Thus, hs becomes BP and ea becomes IM (or JM, as the encipherer wishes).

Example

Plain text: Balloon Ba ll oo n Ba lx lo on BaàI/JB lxàSU loàPM onàNA

Strength of play fair cipher ü Play fair cipher is a great advance over simple mono alphabetic ciphers. ü Since there are 26 letters, 26x26 = 676 diagrams are possible, so identification of

individual digram is more difficult. ü Frequency analysis is much more difficult.

Disadvantage ü Easy to break because it has the structure and the resemblance of the plain text

language (ii) RAIL FENCE CIPHER

ü It is simplest of such cipher, in which the plaintext is written down as a sequence of diagonals and then read off as a sequence of rows.

Plaintext = meet at the school house ü To encipher this message with a rail fence of depth 2,

We write the message as follows: m e a t e c o l o s e t t h s h o h u e The encrypted message Cipher text MEATECOLOSETTHSHOHUE ROW TRANSPOSITION CIPHERS-

ü A more complex scheme is to write the message in a rectangle, row by row, and read the message off, column by column, but permute the order of the columns. The order of columns then becomes the key of the algorithm.

e.g., plaintext = meet at the school house Key = 4 3 1 2 5 6 7 PT = m e e t a t t h e s c h o o l h o u s e CT = ESOTCUEEHMHLAHSTOETO Demerits

Page 15: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

ü Easily recognized because the frequency is same in both plain text and cipher text. ü Can be made secure by performing more number of transpositions.

(iii) VIGENERE CIPHER

ü Each of the 26 ciphers is laid out horizontally, with the key letter for each cipher to its left.

ü A normal alphabet for the plaintext runs across the top. The process of encryption is simple: Given a key letter x and a plaintext letter y, the cipher text is at the intersection of the row labelled x and the column labelled y; in this case, the cipher text is V.

ü To encrypt a message, a key is needed that is as long as the message. Usually, the key is a repeating keyword.

Ex: Key=deceptive Plain text= we are discovered save yourself e.g., key = d e c e p t i v e d e c e p t i v e d e c e p t i v e PT = w e a r e d i s c o v e r e d s a v e y o u r s e l f CT = ZICVTWQNGRZGVTWAVZHCQYGLMGJ

ü Decryption is equally simple. The key letter again identifies the row. The position of the cipher text letter in that row determines the column, and the plaintext letter is at the top of that column.

Strength of Vigenere cipher

ü There are multiple cipher text letters for each plaintext letter. ü Letter frequency information is obscured

5. i) Explain in detail about the relationships between the security services and security mechanism.

Page 16: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

ii) Write short notes on brute force attacks and crypt analysis.

Brute-force attack:

ü A brute force attack is a trial-and-error method used to obtain information such as a user password or personal identification number (PIN) or keys used for encryption.

ü It is any type of attack that involves trying every possible combination of characters or data in order to find the key in order to decrypt an encrypted message.

ü A brute force attack is usually used as a last-resort tactic in a cryptanalysis scenario, as it very much involves extreme amounts of trial and error and often relies on a lot of luck in order to find the key.

ü The attacker tries every possible key on a piece of cipher text until an intelligible translation into plaintext is obtained. On average, half of all possible keys must be tried to achieve success.

ü Alternatively, the attacker can attempt to guess the key which is typically created from the password using a key derivation function. This is known as an exhaustive key search.

ü Moore's Law (Gordon Moore, founder of Intel) states that processing speed doubles every 18 months. As a result, advances in technology and computing performance will always make brute force an increasingly practical attack on keys of a fixed length.

Birthday Attack

ü A birthday attack is a class of brute force attack used against hashing functions. ü It is based on the "birthday paradox." This states that in a group of 23 people,

there is at least a 50% probability that at least two people will share the same birthday. In a group of 60 people, the probability is over 99%.

ü A hash function gives a set value for a message. It can be easier for an attacker to find two messages with the same digest value than it is to match a specific value.

Cryptanalysis:

ü Cryptanalysis is the science of cracking codes and decoding secrets. It is used to violate authentication schemes, to break cryptographic protocols, to find and correct weaknesses in encryption algorithms.

ü Cryptanalytic attacks rely on the nature of the algorithm plus some knowledge

Page 17: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

of the general characteristics of the plaintext or even some sample plaintext cipher text pairs.

ü This type of attack exploits the characteristics of the algorithm to attempt to deduce a specific plaintext or to deduce the key being used.

Types of Attacks

Type of Attack Known to Cryptanalyst

Cipher text only

ü Encryption algorithm

ü Cipher text

ü A cipher text only attack (COA) is a case in which only the encrypted message is available for attack, but because the language is known a frequency analysis could be attempted.

ü In this situation the attacker does not know anything about the contents of the message, and must work from cipher text only.

Known plaintext ü Encryption algorithm ü Cipher text ü One or more plaintext-cipher text pairs

formed with the secret key. ü In a known plaintext attack (KPA) both

the plaintext and matching cipher text are available for use in discovering the key.

ü The attacker knows or can guess the plaintext for some parts of the cipher text.

ü For example, maybe all secure login sessions begin with the characters LOGIN, and the next transmission may be PASSWORD.

ü The task is to decrypt the rest of the cipher text blocks using this information.

Chosen plaintext ü Encryption algorithm ü Cipher text ü Plaintext message chosen by

cryptanalyst, together with its corresponding cipher text generated with the secret key

Chosen cipher text ü Encryption algorithm ü Cipher text ü Purported cipher text chosen by

cryptanalyst, together with its corresponding decrypted plaintext generated with the secret key

Page 18: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

Chosen text ü Encryption algorithm ü Cipher text ü Plaintext message chosen by

cryptanalyst, together with its corresponding cipher text generated with the secret key

ü Purported cipher text chosen by cryptanalyst, together with its corresponding decrypted plaintext generated with the secret key

6. Using Play fair cipher algorithm encrypt the message with the key “MONARCHY” and explain. Play fair Cipher

ü The best-known multiple-letter encryption cipher is the Play fair, which treats

digrams in the plaintext as single units and translates these units into cipher text

digrams. Ie) this technique encrypts pair of letters.

ü The Play fair algorithm is based on the use of a 5 x 5 matrix of letters constructed

using a keyword.

Implementation of play fair cipher

Step 1: Choose a keyword such that it should not contain any repeating characters.

Ex: Valid keyword : MONARCHY Invalid : Technology .(Letter ‘o’ is

repeated)

Step 2 : Create table

a) Insert the desired keyword in the table.

b) Followed by the rest of the alphabets excluding the characters in the keyword.

c) Letter ‘I’ and ‘J’ both occupy the same cell.

Ex :

Step 3 : Encryption Rules

i) Repeating plaintext letters that are in the same pair are separated with a filler letter,

such as x, so that balloon would be treated as ba lx lo on.

ii) Two plaintext letters that fall in the same row of the matrix are each replaced - by the

letter to the right, with the first element of the row circularly following the last.

For example, ar is encrypted as RM.

M O N A R

C H Y B D

E F G I/J K

L P Q S T

U V W X Z

Page 19: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

iii)Two plaintext letters that fall in the same column are each replaced -by the letter

beneath, with the top element of the column circularly following the last.

For example, mu is encrypted as CM.

iv)Otherwise, each plaintext letter in a pair is replaced by the letter that lies in its

own row and the column occupied by the other plaintext letter. Thus, hs becomes BP

and ea becomes IM

Decryption ü To decrypt, use the INVERSE (opposite) of the last 3 rules, and the 1st as-is

(dropping any extra "X"s, or "Q"s that do not make sense in the final message when

finished).

Example: Plaintext = meet me at the school house

Splitting two letters as a unit => me et me at th es ch ox ol ho us ex

Corresponding cipher text => CL KL CL RS PD IL HY AV MP HF XL IU

Me - ‘m’ and ‘e’ occurs in same column. Hence each letter is replaced by the letter beneath it- CL.

et- ‘e’ is replaced by ‘K’.

’t’ is replaced with ‘L’

ch -‘c’ is replaced with ‘H’.

‘h’ is replaced with ‘Y’

Strength of play fair cipher ü There are 26 letters, 26x26 = 676 diagrams are possible, so identification of

individual digram is more difficult.

ü Frequency analysis is much more difficult.

ü The relative frequencies of individual letters exhibit a much greater range than that

of digrams making frequency analysis difficult.

ü For this reason, the playfair cipher was for long time considered unbreakable.

Limitations

ü Any given letter can only correspond to a fairly limited number of cipher text

letters: only the ones in the same column or row, and never to itself.

ü The Play fair cipher is relatively easy to break because it still leaves much of the structure of the plaintext language intact. A few hundred letters of cipher text are

Page 20: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

generally sufficient. 7. Explain the substitution encryption techniques in detail. / Explain the following

with suitable examples: i)Caesar cipher ii)Mono alphabetic cipher iii) Simple columnar transposition technique iv) Vernam cipher

ü A substitution technique is one in which the letters of plaintext are replaced by other letters or by numbers or symbols.

ü Substitution ciphers can be categorized as either

i)Monoalphabetic ciphers or ii) polyalphabetic ciphers.

ü In monoalphabetic substitution, the relationship between a symbol in the plaintext to a symbol in the cipher text is always one-to-one.

ü In polyalphabetic substitution, each occurrence of a character may have a different substitute. The relationship between a character in the plaintext to a character in the cipher text is one-to-many.

Various substitution ciphers are (i) Caesar Cipher (ii) Mono alphabetic cipher (iii) Play fair cipher (iv) Hill cipher (v) Poly alphabetic cipher (vi) Vignere cipher

(i)CAESAR CIPHER (OR) SHIFT CIPHER

Caeser cipher was proposed by Julius Caesar. The Caesar cipher involves replacing each letter of the alphabet with the letter standing 3 places further down the alphabet.

Let us assign a numerical equivalent to each letter:

Note that the alphabet is wrapped around, so that letter following ‘z’ is ‘a’. For each plaintext letter p, substitute the cipher text letter c such that C = E(3, p) = (p+3) mod 26 Decryption is

p=D(3,c)=(c-3) mod 26

The general Caesar algorithm is Encryption C = E(k, p) = (p + k) mod 26 where k takes on a value in the range 1 to 25. The decryption algorithm is simply

p = D(k, c) = (C - k) mod 26

Page 21: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

If it is known that a given cipher text is a Caesar cipher, then a brute-force cryptanalysis is easily performed: simply try all the 25 possible keys. Cryptanalysis of Caesar Cipher 1. The encryption and decryption algorithms are known 2. There are only 25 possible keys. Hence brute force attack takes place 3. The language of the plaintext is known and easily recognizable ii) MONOALPHABETIC CIPHER

ü Each plaintext letter maps to a different random cipher text letter ü Here, 26! Possible keys are used to eliminate brute force attack ü There is, however, another line of attack. If the cryptanalyst knows the nature of the

plaintext (e.g., non-compressed English text), then the analyst can exploit the regularities of the language.

ü As a first step, the relative frequency of the letters can be determined and compared

to a standard frequency distribution for English

ü The best known multiple letter encryption cipher is the play fair, which treats

digrams in the plaintext as single units and translates these units into cipher text digrams.

ü The play fair algorithm is based on the use of 5x5 matrix of letters constructed using a keyword. Let the keyword be “monarchy‟. The matrix is constructed by

ü Filling in the letters of the keyword from left to right and from top to bottom

ü Duplicates are removed ü Remaining unfilled cells of the matrix is filled with remaining alphabets

in alphabetical order. ü The matrix is 5x5. It can accommodate 25 alphabets. To accommodate the

26th alphabet I and J are counted as one character.

Rules for encryption

ü Repeating plaintext letters that would fall in the same pair are separated with a

Page 22: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

filler letter such as ‘x’. ü Two plaintext letters that fall in the same row of the matrix are each replaced by

the letter to the right, with the first element of the row circularly following the last. For example, ar is encrypted as RM.

ü Two plaintext letters that fall in the same column are each replaced by the letter beneath, with the top element of the column circularly following the last. For example, mu is encrypted as CM.

ü Otherwise, each plaintext letter in a pair is replaced by the letter that lies in its own row and the column occupied by the other plaintext letter. Thus, hs becomes BP and ea becomes IM (or JM, as the encipherer wishes).

Example

Plain text: Balloon Ba ll oo n Ba lx lo on BaàI/JB lxàSU loàPM onàNA

Strength of play fair cipher ü Play fair cipher is a great advance over simple mono alphabetic ciphers. ü Since there are 26 letters, 26x26 = 676 diagrams are possible, so identification of

individual digram is more difficult. ü Frequency analysis is much more difficult.

Disadvantage ü Easy to break because it has the structure and the resemblance of the plain text

language (iv) HILL CIPHER

ü It is a multi-letter cipher. It is developed by Lester Hill. ü The encryption algorithm takes m successive plaintext letters and substitutes for

them m cipher text letters. ü The substitution is determined by m linear equations in which each character is

assigned numerical value (a=0,b=1…z=25). For m =3 the system can be described as follows:

C and P are column vectors of length 3 representing the cipher and plain text respectively. Consider the message 'ACT', and

Encryption C=KP mod 26 Decryption P=K-1C mod 26

Page 23: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

The key below (or GYBNQKURP in letters)

Thus the enciphered vector is given by:

which corresponds to a cipher text of 'POH’ Decryption

ü Decryption algorithm is done as P=K-1C mod 26 ü In order to decrypt, we turn the cipher text back into a vector, then simply multiply

by the inverse matrix of the key matrix (IFKVIVVMI in letters).

Plain text of 'POH'

Now gets us back the plain text 'ACT' Merits and Demerits

ü Completely hides single letter and 2 letter frequency information. ü Easily attacked with known plain text attack

(v) POLYALPHABETIC CIPHERS Poly alphabetic cipher is a simple technique to improve mono-alphabetic technique. The features are

ü A set of related mono-alphabetic substitution rules are used ü A key determines which particular rule is chosen for a given transformation.

Example: Vigenere Cipher

ü Each of the 26 ciphers is laid out horizontally, with the key letter for each cipher to its left.

ü A normal alphabet for the plaintext runs across the top. The process of encryption is simple: Given a key letter x and a plaintext letter y, the cipher text is at the intersection of the row labelled x and the column labelled y; in this case, the cipher text is V.

ü To encrypt a message, a key is needed that is as long as the message. Usually, the key is a repeating keyword.

Example : Key=deceptive Plain text= we are discovered save yourself

Page 24: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

e.g., key = d e c e p t i v e d e c e p t i v e d e c e p t i v e Plain Text = w e a r e d i s c o v e r e d s a v e y o u r s e l f Cipher Text = ZICVTWQNGRZGVTWAVZHCQYGLMGJ

ü Decryption is equally simple. The key letter again identifies the row. The position of the cipher text letter in that row determines the column, and the plaintext letter is at the top of that column.

Strength of Vigenere cipher

ü There are multiple cipher text letters for each plaintext letter. ü Letter frequency information is obscured

(vi) VERNAM CIPHER or ONE-TIME PAD ü It is an unbreakable cryptosystem. It represents the message as a sequence of 0s and

1s. ü This can be accomplished by writing all numbers in binary, for example, or by using

ASCII. The key is a random sequence of 0‟s and 1‟s of same length as the message. Once a key is used, it is discarded and never used again.

The system can be expressed as follows: Ci = Pi⊕ Ki Ci - ith binary digit of cipher text Pi - ith binary digit of plaintext Ki - ith binary digit of key ⊕ – exclusive OR operation

ü Thus the cipher text is generated by performing the bitwise XOR of the plaintext and the key. Decryption uses the same key. Because of the properties of XOR, decryption simply involves the same bitwise operation:

Pi = Ci ⊕ Ki Advantages

ü It is unbreakable since cipher text bears no statistical relationship to the plaintext ü Not easy to break

Drawbacks ü Practically impossible to generate a random key as to the length of the message ü The second problem is that of key distribution and key protection. ü Due to the above two drawbacks, one time pad is of limited use and is used for low

band width channel which needs high security. 8. Explain about the different encryption mechanisms/ cipher techniques in detail with

examples. ü In cryptography, encryption is the process of encoding messages or information in

such a way that only authorized parties can read it.

Page 25: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

ü Encryption does not of itself prevent interception, but denies the message content to the interceptor. In an encryption scheme, the intended communication information or message, referred to as plaintext, is encrypted using an encryption algorithm, generating cipher text that can only be read if decrypted. For technical reasons, an encryption scheme usually uses a pseudo-random encryption key generated by an algorithm.

ü It is in principle possible to decrypt the message without possessing the key, but, for a well-designed encryption scheme, large computational resources and skill are required. An authorized recipient can easily decrypt the message with the key provided by the originator to recipients, but not to unauthorized interceptors.

ü The purpose of encryption is to ensure that only somebody who is authorized to access data (e.g. a text message or a file), will be able to read it, using the decryption key. Somebody who is not authorized can be excluded, because he or she does not have the required key, without which it is impossible to read the encrypted information.

Types of Encryption: Symmetric key encryption

ü In symmetric-key schemes, the encryption and decryption keys are the same. Communicating parties must have the same key before they can achieve secure communication.

Public key encryption

Illustration of how encryption is used within servers Public key encryption.

Public key encryption

In public-key encryption schemes, the encryption key is published for anyone to use and encrypt messages. However, only the receiving party has access to the decryption key that enables messages to be read. Public-key encryption was first described in a secret document in 1973, before then, all encryption schemes were symmetric-key (also called private-key).

9. Explain in detail about classical encryption techniques. Classical Cryptographic Techniques

ü All classical encryption algorithms use private key for both encryption and decryption.

ü sender and recipient share a common key ü have two basic components of classical ciphers: substitution and transposition ü In substitution ciphers letters are replaced by other letters ü In transposition ciphers the letters are arranged in a different order ü these ciphers may be: ü monoalphabetic - only one substitution/ transposition is used, or ü polyalphabetic - where several substitutions/ transpositions are used ü several such ciphers may be concatenated together to form a product cipher

Caesar Cipher - a monoalphabetic cipher

Page 26: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

ü replace each letter of message by a letter a fixed distance away eg use the 3rd letter on

ü reputedly used by Julius Caesar eg. L FDPH L VDZ L FRQTXHUHG I CAME I SAW I CONQUERED General Monoalphabetic

ü special form of mixed alphabet ü use key as follows:

ü write key (with repeated letters deleted) ü then write all remaining letters in columns underneath ü then read off by columns to get cipher text equivalents

Example Strawberry STARW BCDEF GHIJK LMNOP QUVXY Z Plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ Cipher: SBGLQZTCHMUADINVREJOXWFKPY Plaintext: I KNOW ONLY THAT I KNOW NOTHING Cipher text: H UINF NIAP OCSO H UINF INOCHIT Polyalphabetic Substitution

ü in general use more than one substitution alphabet ü makes cryptanalysis harder since have more alphabets to guess ü and because flattens frequency distribution ü (since same plaintext letter gets replaced by several cipher text letter, depending on

which alphabet is used) Vigenère Cipher

ü basically multiple caesar ciphers ü key is multiple letters long K = k_(1) k_(2) ... k_(d) ü ith letter specifies ith alphabet to use ü use each alphabet in turn, repeating from start after d letters in message

Plaintext THISPROCESSCANALSOBEEXPRESSED Keyword CIPHERCIPHERCIPHERCIPHERCIPHE Plaintext VPXZTIQKTZWTCVPSWFDMTETIGAHLH Transposition cipher: - classical transposition or permutation ciphers.

ü These hide the message by rearranging the letter order, without altering the actual letters used can recognize these since have the same frequency distribution as the original text rail fence cipher and row transposition cipher.

Rail Fence cipher ü write message letters out diagonally over a number of rows ü then read off cipher row by row ü eg. write message out as: m e m a t r h t g p r y e t e f e t e o a a t ü giving cipher text MEMATRHTGPRYETEFETEOAAT

Page 27: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

Row Transposition Ciphers ü a more complex scheme ü write letters of message out in rows over a specified number of columns ü then reorder the columns according to some key ü before reading off the columns Key: 4 3 1 2 5 6 7

Plaintext: a t t a c k p o s t p o n e d u n t i l t w o a m x y z Cipher text: TTNAAPTMTSUOAODWCOIXKNLYPETZ

10. Explain in detail about security attacks and services.

Attack: any action that compromises the security of information

Attacks can be generally classified as i) Passive attacks ii) Active attacks

Passive attacks

Reading contents of messages

ü Also called eavesdropping

ü Difficult to detect passive attacks

ü Defense: to prevent their success

Traffic analysis

Eaves dropping

Active attacks ü Modification or creation of messages

(by attackers) ü Four categories: modification of

messages, replay, masquerade, denial of service

ü Easy to detect but difficult to prevent ü Defense: detect attacks and recover

from damages

Modification

Page 28: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

Masquerade

Replay

Denial of service

Security Services (Goals) ü Data Confidentiality: protecting data from unauthorized disclosure. ü Data Integrity:

ü assuring that data received is as sent (w/o modification) ü or detecting its non-integrity.

ü Authentication: ü The action of confirming someone or something as authentic. ü (Peer) entity authentication: When establishing a logical connection, assure

that the other party is as claimed. ü Data origin authentication: In a connectionless transfer, assure that the

source of received data is as claimed. ü Message Authentication

ü Data origin authentication ü Data integrity ü Entity Identification ü Entity authentication

ü Non-Repudiation: ü Origin non-repudiation: preventing sender from denying that he has sent a

Page 29: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

message ü Destination non-repudiation: preventing receiver from denying that she has

received a message ü Access Control: preventing unauthorized use of a resource. ü Availability: making systems or resources available upon demand by legitimate

users. 11. Describe Chinese Reminder Theorem & Modular Exponentiation with an example.

ü The Chinese remainder theorem is a theorem of number theory, which states that, if one knows the remainders of the division of an integer n by several integers, then one can determine uniquely the remainder of the division of n by the product of these integers, under the condition that the divisors are pairwise coprime.

ü Let n1, ..., nk be integers greater than 1, which are often called moduli or divisors. Let us denote by N the product of the ni.

ü The Chinese remainder theorem asserts that if the ni are pairwise coprime, and if a1, ..., ak are integers such that 0 ≤ ai < ni for every i, then there is one and only one integer x, such that 0 ≤ x < N and the remainder of the Euclidean division of x by ni is ai for every i.

ü This may be restated as follows in term of congruences: If the ni are pairwise coprime, and if a1, ..., ak are any integers, then there exists an integer x such that

and any two such x are congruent modulo N.

In abstract algebra, the theorem is often restated as: if the ni are pairwise coprime, the map

ü Modular exponentiation is a type of exponentiation performed over a modulus. It

is useful in computer science, especially in the field of public-key cryptography.

ü The operation of modular exponentiation calculates the remainder when an integer b (the base) raised to the eth power (the exponent), be, is divided by a positive integer m (the modulus). In symbols, given base b, exponent e, and modulus m, the modular exponentiation c is: c ≡ be (mod m).

ü For example, given b = 5, e = 3 and m = 13, the solution c = 8 is the remainder of dividing 53 = 125 by 13.

ü Given integers b and e, and a positive integer m, a unique solution c exists with the property 0 ≤ c < m.

ü Modular exponentiation can be performed with a negative exponent e by finding the modular multiplicative inverse d of b modulo m using the extended Euclidean algorithm. That is:

o c ≡ be ≡ d−e mod m where e < 0 and b ⋅ d ≡ 1 mod m.

12. Encrypt the message “PAY” using Hill cipher with the following key matrix and show

Page 30: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

the decryption to get the original plain text.

Solution:

Hill system can be expressed as follows:

C = E(K, P) = KP mod 26

P = D(K, P) = K-1C mod 26 = K-1KP = P

Consider the plaintext "pay" and use the encryption key

Encryption :

The first three letters of the plaintext are represented by the vector

Cipher Text = LNS Decryption :

ü Decryption requires using the inverse of the matrix K. The inverse K1 of a matrix K

is defined by the equation KK1 = K1K = I, where I is the matrix that is all zeros

except for ones along the main diagonal from upper left to lower right.

ü The inverse of a matrix does not always exist, but when it does, it satisfies the

preceding equation. In this case, the inverse is:

Then, Represent LNS by vector by referring the table

Page 31: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

13. i) Explain Euclidean Algorithm with example. EUCLIDEAN ALGORITHM Euclidean algorithm is a simple procedure for determining the greatest common divisor of two positive integers. The positive integer c is said to be the greatest common divisor of a and b if 1. c is a divisor of a and of b. 2. Any divisor of a and b is a divisor of c. An equivalent definition is the following:

gcd(a,b)=gcd(|a|,|b|) gcd(a,0)=|a|

EUCLID(a, b) 1. Aß a; Bßb 2. if B = 0 return A = gcd(a, b) 3. R = A mod B 4. AßB 5. BßR 6. goto 2

Euclidean Algorithm Revisited For any integers a, b, with a ≥ b ≥ 0, gcd(a, b) = gcd(b, a mod b) Example gcd(55, 22) = gcd(22, 55 mod 22) = gcd(22, 11) = 11 gcd(18, 12) = gcd(12, 6) = gcd(6, 0) = 6 gcd(11, 10) = gcd(10, 1) = gcd(1, 0) = 1 ii) Explain Euclidean algorithm to compute the greatest common divisor of two

polynomials. To find greatest common divisor for polys

a. c(x) = GCD(a(x), b(x)) if c(x) is the poly of greatest degree which divides both a(x), b(x)

can adapt Euclid’s Algorithm to find it:

Page 32: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com

Euclid(a(x), b(x)) if (b(x)=0) then return a(x); else return Euclid(b(x), a(x) mod b(x));

14. Explain in detail about Finite Fields of the Form GF(2 n ) ü Virtually all encryption algorithms, both symmetric and public key, involve

arithmetic operations on integers. ü If one of the operations that is used in the algorithm is division, then we need to work

in arithmetic defined over a field. ü For convenience and for implementation efficiency, we would also like to work with

integers that fit exactly into a given number of bits with no wasted bit patterns. That is, we wish to work with integers in the range 0 through 2n - 1, which fit into an n-bit word.

ü In mathematics, finite field arithmetic is arithmetic in a finite field (a field containing a finite number of elements) as opposed to arithmetic in a field with an infinite number of elements, like the field of rational numbers.

Suppose we wish to use 3-bit blocks in our encryption algorithm and use only the operations of addition andmultiplication.

1. The addition and multiplication tables are symmetric about the main diagonal, in conformance to thecommutative property of addition and multiplication. This property is also exhibited in Table , which uses mod 8 arithmetic.

2. All the nonzero elements defined by the following Table have a multiplicative inverse, unlike the case with Table

3. The scheme defined by the following Table satisfies all the requirements for a finite field. Thus, we can refer to this schemeas GF(23).

4. For convenience, we show the 3- bit assignment used for each of the elements of GF(23).

Page 33: UNIT I INTRODUCTION & NUMBER THEORY UNIT-I / PART-A …studentsfocus.com/notes/anna_university/IT/7SEM/CS6701 - CNS/2marks_16marks/UNIT1.pdfModular arithmetic-Euclid‟s algorithm-Finite

www.studentsfocus.com