Está en la página 1de 22

St.JOSEPHS COLLEGE OF ENGINEERING, CHENNAI 600 119.

. MODEL EXAMINATION - I KEY Set I Subject : Cryptography & Network Security Sub. Code : IT2352 Part - A (10 * 2 = 20) 1. Distinguish passive attack from active attack . passive attacks which attempt to learn or make use of information from the system but does not affect system resources. By eavesdropping on, or monitoring of, transmissions to: + obtain message contents + monitor traffic flows active attacks which attempt to alter system resources or affect their operation. By modification of data stream to: + masquerade of one entity as some other + replay previous messages + modify messages in transit + denial of service 2. Encrypt the message MODEL EXAM using Shift Cipher with key as 13. C = ZBQRY RKNZ 3. Define congruence. Give an example. The quality or state of agreeing or corresponding.A relation between two numbers indicatin gthat the numbers give the same remainder when divided by some given number. Compare residue 11 = 6 = 1 mod 5 4. Define Confusion & Diffusion Confusion : encryption operation where the relationship between cleartext and ciphertext is obscured. Some examples are: (a) Shift cipher - main operation is substitution. (b) German Enigma (broken by Turing) | main operation is smart substitution. 2. Diffusion - encryption by spreading out the inuence of one cleartext letter over many ciphertext letters. An example is: (a) permutations - changing the positioning of the cleartext. 5. Define Brute force attack. Trying all possible combinations for key to get Plain text from Cipher Text 6. Define Steganography an alternative to encryption hides existence of message using only a subset of letters/words in a longer message marked in some way using invisible ink hiding in LSB in graphic image or sound file has drawbacks high overhead to hide relatively few info bits The art of hiding the key/plain text in a file or image is called as steganography.

7. Discuss about Legendre and Jacobi Symbols. For any integer a and any positive odd integer n the Jacobi symbol is defined as the product of the Legendre symbols corresponding to the prime factors of n:

represents the Legendre symbol, defined for all integers a and all odd primes p by

8. Find the gcd(4000,9648) by Euclidean Algorithm? gcd(4000,9648) is 16

9. Given (n) = 180 and e= 7, find d. d = 103 10. Find 2123 mod 59 by modular exponentiation 2123 mod 59 =10 Part - B (5 * 16 = 80) 11.a. Explain the concept symmetric and asymmetric encryption with neat diagram.(16) symmetric encryption C=EK(P) & P=DK(C) asymmetric encryption 1. C=EKRA(P) P=DKUA(C) 2. C=EKUB(P) P=DKRB(C) 3. C=EKRA(E KUB(P)) P=DKRB(D KUA (C)) 4. C=EKUB(E KRA(P)) P=DKUA(D KRB (C))

Symmetric Encryption A (Source) P


Encryptio n

Decryptio n

B(Destination) P

K C=EK(P) & P=DK(C)

Asymmetric Encryption A (Source) P


Encryptio n

Decryptio n

B(Destination) P

KRA C=EKRA(P) & P=DKUA(C) Asymmetric Encryption A (Source) P


Encryptio n

KUA

Decryptio n

B(Destination) P

KUB C=EKUB(P) & P=DKRB(C)

KRB

Asymmetric Encryption C=EKUB(E KRA(P)) P=DKUA(D KRB (C))

11.b.i Explain the various types of attacks Active attacks Passive attacks Attacks against Cryptoalgorithms 1. Ciphertext-Only Attack 2. Known Plaintext Attack 3. Chosen Plaintext Attack

4. Chosen Ciphertext Attack 11.b.ii Explain the various axioms of Group Group a set of elements or numbers with some operation whose result is also in the set (closure) obeys: associative law: (a.b).c = a.(b.c) has identity e: e.a = a.e = a has inverses a-1: a.a-1 = e if commutative a.b = b.a then forms an abelian group 12. a. Encrypt and decrypt the message SECRET using the following key. 17 17 5 K = 21 18 21 2 2 19 (16) C = UYEKWN 4 K = 15 24 P= SECRET
-1

9 17 0

15 6 17

12. b. Discuss about Simple Data Encryption Standard with neat diagram (16) SIMPLIFIED DES S-DES encryption (decryption) algorithm takes 8-bit block of plaintext (ciphertext) and a 10-bit key, and produces 8-bit ciphertext (plaintext) block. Encryption algorithm involves 5 functions: an initial permutation (IP); a complex function fK, which involves both permutation and substitution and depends on a key input; a simple permutation function that switches (SW) the 2 halves of the data; the function fK again; and finally, a permutation function that is the inverse of the initial permutation (IP-1). Decryption process is similar. The function fK takes 8-bit key which is obtained from the 10-bit initial one two times. The key is first subjected to a permutation P10. Then a shift operation is performed. The output of the shift operation then passes through a permutation function that produces an 8-bit output (P8) for the first subkey (K1). The output of the shift operation also feeds into another shift and another instance of P8 to produce the 2nd subkey K2 S-DES KEY GENERATION Scheme of key generation: First, permute the 10-bit key k1,k2,..,k10: P10(k1,k2,k3,k4,k5,k6,k7,k8,k9,k10)=(k3,k5,k2,k7,k4,k10,k1,k9,k8,k6) Or it may be represented in such a form P10 = 3 5 2 7 4 10 1 9 8 6 Each position in this table gives the identity of the input bit that produces the output bit in this position. So, the 1st output bit is bit 3 (k3), the 2nd is k5 and so on. For example, the key

(1010000010) is permuted to (1000001100). Next, perform a circular shift (LS-1), or rotation, separately on the 1st 5 bits and the 2nd 5 bits. In our example, the result is (00001 11000) Next, we apply P8, which picks out and permutes 8 out of 10 bits according to the following rule: P8 = 6 3 7 4 8 5 10 9 The result is subkey K1. In our example, this yields (10100100) We then go back to the pair of 5bit strings produced by the 2 LS-1 functions and perform a circular left shift of 2 bit positions on each string. In our example, the value (00001 11000) becomes (00100 00011). Finally, P8 is applied again to produce K2. In our example, the result is (01000011)

S-DES ENCRYPTION The input to the algorithm is an 8-bit block of plaintext, which is permuted by IP function: IP = 2 6 3 1 4 8 5 7 At the end of the algorithm, the inverse permutation is used: IP-1 = 4 1 3 5 7 2 8 6 It may be verified, that IP-1(IP(X)) = X. The most complex component of S-DES is the function fK, which consists of a combination of permutation and substitution functions. The function can be expressed as follows. Let L and R be the leftmost 4 bits and rightmost 4 bits of the 8-bit input to fK, and let F be a mapping (not necessarily one to one) from 4-bit strings to 4-bit strings. Then we let fK(L,R) = (L_F(R,SK),R) where SK is a subkey and _ is the bit-by-bit XOR operation. For example, suppose the output of the IP stage in Fig.3.3 is (1011 1101) and F(1101,SK) = (1110) for some key SK. Then fK(1011 1101) = (0101 1101) because (1011) _ (1110) = (0101). We now describe the mapping F. The input is a 4-bit number (n1 n2 n3 n4).

The 1st operation is an expansion/permutation: E/P = 4 1 2 3 2 3 4 1 For what follows, it is clearer to depict result in this fashion: n4|n1 n2|n3 n2|n3 n4|n1 The 8-bit subkey K1 = (k11, k12, k13, k14, k15, k16, k17, k18) is added to this value using XOR: n4+k11|n1+k12 n2+k13|n3+k14 n2+k15|n3+k16 n4+k17|n1+k18 Let us rename these bits: p00|p01 p02|p03 p10|p11 p12|p13

The 1st 4 bits (1st row of the preceding matrix) are fed into the S-box S0 to produce a 2-bit output, and the remaining 4 bits (2nd row) are fed into S1 to produce another 2-bit output. The S-boxes operate as follows. The 1st and 4th input bits are treated as a 2- bit number that specify a row of the S-box, and the 2nd and 3rd input bits specify a column of the S-box. The entry in that row and column, in base 2, is the 2-bit output. For example, if (p00, p03) = (00) and (p01, p02) = (10), then the output is from row 0, column 2 of S0, which is 3, or (11) in binary. Similarly, (p10, p13) and (p11, p12) are used to index into a row and column of S1 to produce an additional 2 bits. Next, the 4 bits produced by S0 and S1 undergo a further permutation as follows: P4 = 2 4 3 1 The output of P4 is the output of function F. The function fK only alters the leftmost 4 bits of input. The switch function SW interchanges the left and right bits so that the 2nd instance of fK operates on a different 4 bits. In the 2nd instance, the E/P, S0, S1, and P4 functions are the same. The key input is K2. 13. a. Explain the various stages in detail with neat diagram in AES encryption procedure. (16) AES

designed by Rijmen-Daemen in Belgium has 128/192/256 bit keys, 128 bit data an iterative rather than feistel cipher processes data as block of 4 columns of 4 bytes operates on entire data block in every round designed to be: resistant against known attacks speed and code compactness on many CPUs design simplicity data block of 4 columns of 4 bytes is state key is expanded to array of words has 9/11/13 rounds in which state undergoes: byte substitution (1 S-box used on every byte) shift rows (permute bytes between groups/columns) mix columns (subs using matrix multipy of groups) add round key (XOR state with key material) view as alternating XOR key & scramble data bytes initial XOR key material & incomplete last round with fast XOR & table lookup implementation Byte Substitution

a simple substitution of each byte uses one table of 16x16 bytes containing a permutation of all 256 8-bit values each byte of state is replaced by byte indexed by row (left 4-bits) & column (right 4-bits) eg. byte {95} is replaced by byte in row 9 column 5 which has value {2A} S-box constructed using defined transformation of values in GF(28) designed to be resistant to all known attacks

Shift rows

a circular byte shift in each each 1st row is unchanged 2nd row does 1 byte circular shift to left 3rd row does 2 byte circular shift to left 4th row does 3 byte circular shift to left decrypt inverts using shifts to right since state is processed by columns, this step permutes bytes between the columns Mix columns

each column is processed separately each byte is replaced by a value dependent on all 4 bytes in the column effectively a matrix multiplication in GF(28) using prime poly m(x) =x8+x4+x3+x+1

Add round key

XOR state with 128-bits of the round key again processed by column (though effectively a series of byte operations) inverse for decryption identical since XOR own inverse, with reversed keys designed to be as simple as possible a form of Vernam cipher on expanded key requires other stages for complexity / security AES key expansion

takes 128-bit (16-byte) key and expands into array of 44/52/60 32-bit words start by copying key into first 4 words

then loop creating words that depend on values in previous & 4 places back in 3 of 4 cases just XOR these together 1st word in 4 has rotate + S-box + XOR round constant on previous, before XOR 4th back 13. b Explain any 3 modes of operation in detail with neat diagram (16) Electronic Codebook Book (ECB) message is broken into independent blocks which are encrypted each block is a value which is substituted, like a codebook, hence name each block is encoded independently of the other blocks Ci = DESK1(Pi) uses: secure transmission of single values Advantages and Limitations of ECB message repetitions may show in ciphertext if aligned with message block particularly with data such graphics or with messages that change very little, which become a code-book analysis problem weakness is due to the encrypted message blocks being independent main use is sending a few blocks of data

Cipher Block Chaining (CBC) message is broken into blocks linked together in encryption operation each previous cipher blocks is chained with current plaintext block, hence name use Initial Vector (IV) to start process Ci = DESK1(Pi XOR Ci-1) C-1 = IV uses: bulk data encryption, authentication

Cipher FeedBack (CFB) message is treated as a stream of bits added to the output of the block cipher result is feed back for next stage (hence name) standard allows any number of bit (1,8, 64 or 128 etc) to be feed back denoted CFB-1, CFB-8, CFB-64, CFB-128 etc most efficient to use all bits in block (64 or 128) Ci = Pi XOR DESK1(Ci-1) C-1 = IV uses: stream data encryption, authentication Advantages and Limitations of CFB appropriate when data arrives in bits/bytes most common stream mode limitation is need to stall while do block encryption after every n-bits note that the block cipher is used in encryption mode at both ends errors propogate for several blocks after the error

Output FeedBack (OFB) message is treated as a stream of bits output of cipher is added to message output is then feed back (hence name) feedback is independent of message can be computed in advance Ci = Pi XOR Oi Oi = DESK1(Oi-1) O-1 = IV uses: stream encryption on noisy channels Advantages and Limitations of OFB bit errors do not propagate more vulnerable to message stream modification a variation of a Vernam cipher hence must never reuse the same sequence (key+IV) sender & receiver must remain in sync originally specified with m-bit feedback subsequent research has shown that only full block feedback (ie CFB-64 or CFB-128) should ever be used

Counter (CTR) a new mode, though proposed early on similar to OFB but encrypts counter value rather than any feedback value must have a different key & counter value for every plaintext block (never reused) Ci = Pi XOR Oi Oi = DESK1(i) uses: high-speed network encryptions

Advantages and Limitations of CTR efficiency can do parallel encryptions in h/w or s/w can preprocess in advance of need good for bursty high speed links random access to encrypted data blocks provable security (good as other modes) but must ensure never reuse key/counter values, otherwise could break (cf OFB) 14. a.Write notes on Double and Triple DES.(16) Double DES could use 2 DES encrypts on each block C = EK2(EK1(P)) issue of reduction to single stage and have meet-in-the-middle attack works whenever use a cipher twice since X = EK1(P) = DK2(C) attack by encrypting P with all keys and store then decrypt C with keys and match X value can show takes O(256) steps Triple DES with 2 keys hence must use 3 encryptions would seem to need 3 distinct keys but can use 2 keys with E-D-E sequence C = EK1(DK2(EK1(P)))

nb encrypt & decrypt equivalent in security if K1=K2 then can work with single DES standardized in ANSI X9.17 & ISO8732 no current known practical attacks Triple DES with 3 keys although are no practical attacks on two-key Triple-DES have some indications can use Triple-DES with Three-Keys to avoid even these C = EK3(DK2(EK1(P))) has been adopted by some Internet applications, eg PGP, S/MIME 14. b. Explain RSA algorithm with a suitable example. (16) by Rivest, Shamir & Adleman of MIT in 1977 best known & widely used public-key scheme based on exponentiation in a finite (Galois) field over integers modulo a prime uses large integers (eg. 1024 bits) security due to cost of factoring large numbers each user generates a public/private key pair by: selecting two large primes at random - p, q computing their system modulus n=p.q note (n)=(p-1)(q-1) selecting at random the encryption key e where 1<e<(n), gcd(e,(n))=1 solve following equation to find decryption key d e.d=1 mod (n) and 0dn publish their public encryption key: PU={e,n} keep secret private decryption key: PR={d,n} to encrypt a message M the sender: obtains public key of recipient PU={e,n} computes: C = Me mod n, where 0M<n to decrypt the ciphertext C the owner: uses their private key PR={d,n} computes: M = Cd mod n note that the message M must be smaller than the modulus n (block if needed) Example : 1. Select primes: p=17 & q=11 2. Compute n = pq =17 x 11=187 3. Compute (n)=(p1)(q-1)=16 x 10=160 4. Select e: gcd(e,160)=1; choose e=7 5. Determine d: de=1 mod 160 and d < 160 Value is d=23 since 23x7=161= 10x160+1 6. Publish public key PU={7,187} 7. Keep secret private key PR={23,187} sample RSA encryption/decryption is: given message M = 88 (nb. 88<187) encryption: C = 887 mod 187 = 11

decryption: M = 1123 mod 187 = 88 RSA SECURITY possible approaches to attacking RSA are: brute force key search (infeasible given size of numbers) mathematical attacks (based on difficulty of computing (n), by factoring modulus n) factor n=p.q, hence compute (n) and then d determine (n) directly and compute d find d directly timing attacks (on running of decryption) use constant exponentiation time add random delays blind values used in calculations chosen ciphertext attacks (given properties of RSA) 15.a.Explain RC4 algorithm with a suitable example? (16) RC4 Algorithm The RC4 encryption algorithm was developed by Ronald Rivest of RSA. This is a shared key stream cipher algorithm which requires a secure exchange of a shared key which is outside the specification of the RC4 algorithm. The RC4 algorithm is used identically for encryption and decryption as the data stream is simply XORed with the generated key sequence. The algorithm is serial as it requires successive exchanges of state entries based on the key sequence. Hence implementations can be very computationally intensive. This algorithm has been released to the public and is implemented by many programmers. This encryption algorithm is used by standards such as IEEE 802.11 within WEP (Wireless Encryption Protocol) using a 40 and 128-bit keys. Published procedures exist for cracking the security measures as implemented in WEP. In the algorithm the keystream is completely independent of the plaintext used. An 8 * 8 S-Box (S0 S255), where each of the entries is a permutation of the numbers 0 to 255, and the permutation is a function of the variable length key. There are two counters i, and j, both initialized to 0 used in the algorithm. RC4 Features: RC4 uses a variable length key from 1 to 256 bytes to initialize a 256-byte state table. The state table is used for subsequent generation of pseudo-random bytes and then to generate a pseudo-random stream which is XORed with the plaintext to give the ciphertext. Each element in the state table is swapped at least once. The RC4 key is often limited to 40 bits, because of export restrictions but it is sometimes used as a 128 bit key. It has the capability of using keys between 1 and 2048 bits. RC4 is used in many commercial software packages such as Lotus Notes and Oracle Secure SQL. The RC4 algorithm works in two phases, key setup and ciphering. Key setup is the first and most difficult phase of this algorithm. During a N-bit key setup (N being your key length), the encryption key is used to generate an encrypting variable using two arrays, state and key, and N-number of mixing operations. These mixing operations consist of swapping bytes, modulo operations, and other formulas. A modulo operation is the process of yielding a remainder from division. For example, 11/4 is 2 remainder 3; therefore eleven mod four would be equal to three.

Once the encrypting variable is produced from the key setup, it enters the ciphering phase, where it is XORed with the plain text message to create an encrypted message. XOR is the logical operation of comparing two binary bits. If the bits are different, the result is 1. If the bits are the same, the result is 0. Once the receiver gets the encrypted message, he decrypts it by XORing the encrypted message with the same encrypting variable.

RC4 Strengths: The difficulty of knowing where any value is in the table. The difficulty of knowing which location in the table is used to select each value in the sequence. A particular RC4 key can be used only once. Encryption is about 10 times faster than DES. RC4 Weakness: The RC4 algorithm is vulnerable to analytic attacks of the state table. One in every 256 keys can be a weak key. These keys are identified by cryptanalysis that is able to find circumstances under which one of more generated bytes are strongly correlated with a few bytes of the key. WEAK KEYS: these are keys identified by cryptanalysis that is able to find circumstances under which one or more generated bytes are strongly correlated with small subset of the key bytes. These keys can happen in one out of 256 keys generated.

RC4 Terminology: RC4 = Rons code # 4 or Rivest Cipher = a cryptographic algorithm used for encryption and decryption. Symmetric key algorithm = an algorithm that uses the same key to encrypt and decrypt Stream cipher = algorithm that encrypts data one byte at a time Anonymous remailer = distribution system that strips off all of the sender information and remails the message under an anonymous name. Cyperpunk = computer users that believe that privacy from government and large business institutions must be protected. These users generally have expertise in cryptography. State table: is a table initialized from 1 to 256 bytes. The bytes in the table are used for subsequent generation of Pseudo-Random bytes. The Pseudo-Random stream generated is XORed with the plaintext to give the ciphertext.

15. b. i)Give the Chinese remainder theorem and find the solution for X = 4 mod 7 and X = 1 mod 6 (8)

Chinese Remainder Theorem: If m1 and m2 are positive integers such that they are relatively prime, then for any integers a1 and a2, the pair of congruences x a1 (mod m1) and x a2 (mod m2) has a unique solution x modulo m1m2. The applet takes a1,a2, m1, and m2 as input, and finds all values of x (mod m1m2) that satisfy the pair of congruences x a1 (mod m1) and x a2 (mod m2). For example, to see if the congruences X = 4 mod 7 and X = 1 mod 6 so that X = 25

ii) Write short notes on LFSR (8)

----------------

También podría gustarte