220 likes | 231 Views
Learn about substitution-boxes, permutation-boxes, product ciphers, DES construction, SPN networks, modes of operation like ECB, CBC, CFB, and Counter Mode of operation in secret key cryptography.
E N D
Chapter-5 Secret Key Cryptography Prepared by: Mohan Gholap
PRODUCT CIPHERS • Modern day ciphers are synthesized by Substitution-box (S-box) and Permutation-box (P-box). • S-box: • It’s a device that takes input m-bit string and produces output n-bit string. • Usually m = n in most of the cases. In DES, m > n. • S-box is implemented using a table (or array) of 2m rows with each row containing n-bit value. • Input to S-box is used to index the table, which returns n-bit output of S-box. Prepared by: Mohan Gholap
P-box: • It performs permutation or re-arrangement of bits in the input. • It is more restrictive than S-box. • For example, no. of 0’s in output will be equal to no. of 0’s in input. Which is usually not possible in S-box. Prepared by: Mohan Gholap
A P-box or S-box by itself is not sufficient to create a cipher-text, often the combination of operations are used. • Usually, cascading the P-boxes and S-boxes increases the strength of cipher. Such a cipher is called as “Product Cipher”. • Following 3 operations takes place in sequence, 1. Operation involving function of encryption key 2. Substitution 3. Permutation Prepared by: Mohan Gholap
Three-round SPN network Prepared by: Mohan Gholap
First step is usually implemented by X-OR operation between input string & round key. • Wkt, S-box is implemented as a table. If cipher size is b. Then, size of b x b S-box is b x 2b • So, the size of table increases rapidly. • Hence, single S-box is divided into multiple S-boxes as shown in figure. • Contribution of S-boxes? [non-linearity] • Contribution of P-boxes? [spreading bits] Prepared by: Mohan Gholap
DES Construction • Fiestel Structure: • DES block size is 64 bits. • It uses key of either 56 bits or 128 bits. • Single plain text block is converted into cipher-text block by passing through following operations in sequence, • Initial permutation • 16 rounds of a given function • 32-bit left-right swap • Final permutation Prepared by: Mohan Gholap
Let Li-1 and Ri – 1 be the left half and right half to round-I, as shown in fig. • Encryption: Li = Ri –1 Ri = Li-1 f (Ri –1, Ki) • Decryption: Ri –1 = Li Li-1 = Ri f (Li , Ki) Prepared by: Mohan Gholap
2. Round Function It involves following 4 operations, • Expansion: Input is Ri-1 (32 bit) -> expanded to 48-bits. ii. XOR with round key: 48-bit XORed with Ki iii. Substitution: Result of XOR is divided into 8, 6-bit blocks. Each block is substituted by 4-bit block. iv. Permutation: wkt, S-box is implemented as a table. After substitution, each row is permutated. Prepared by: Mohan Gholap
Modes of Operation 1. Electronic Code Book (ECB) Mode: Here, each block is encrypted separately. Drawbacks: • Identical blocks of plain-texts will be encrypted to same cipher-text blocks. • Re-ordering of blocks by an attacker in transit will not be detected by receiver. Figure: Prepared by: Mohan Gholap
2. Cipher Block Chaining (CBC) Mode • Here, before performing encryption, previous block of cipher-text is combined with current block of plain text, as shown in fig. • By this, it has the effect of randomizing & hence, two identical blocks will not produce same ciphers. • Encryption starts with Initialization Vector (IV), it’s a random b-bit string. Its known to both Sender and Receiver. • Drawback: If a block of cipher-text is received with error, the error will propagate throughout the steps. Prepared by: Mohan Gholap
CBC Mode Prepared by: Mohan Gholap
3. Cipher Feedback Mode (CFB) • CFB encrypts and transmits sub-blocks of size s, instead of blocks of size b. • It uses a shift register of size b, as shown in fig. Prepared by: Mohan Gholap
The steps in encryption are as follows • Shift register is initially loaded with initialization vector (IV). • Contents of shift register are encrypted with cipher key. • Most significant s-bits of b-bit output are then XORed with s-bits of plain text to create next s-bit block of cipher text. Remaining (s-b) bits discarded. • Shift register shifted left by s-bits. (Left most s-bits will be lost). • Then, s-bits of cipher text are inserted into vacated (right most s bits of register). Prepared by: Mohan Gholap
Here, decryption is easily carried out by encryption function itself. • Drawback: number of encryption operations per b-bit block is now b/s. (Which was single encryption operation in other modes) Prepared by: Mohan Gholap
4. Counter Mode of operation • Here, b-bit counter is initialized to random value. • This value is encrypted with secret key & XORed with first block of plain text. The counter is incremented. • Now, incremented value is encrypted & XORed with next block of plain text to create next block of cipher text, and so on. Prepared by: Mohan Gholap
Advantages of Counter Mode: • Blocks of plain text can be encrypted in any order, unlike CBC & CFB modes. • Multiple plain text blocks can be processed in parallel, which speeds up the encryption. • Encryption of the counter values can be performed even before the plain text is available for encryption. Prepared by: Mohan Gholap
MAC & Other Applications • Secret key cryptographic schemes are used for message confidentiality • It is also used for Authentication. • Entity Authentication: To ensure that, you are communicating with intended party. • Message Authentication: To ensure that, each received message is from intended party with whom you have established connection. Prepared by: Mohan Gholap
Message authentication & Integrity can both be provided by a checksum called “MAC or Message Authentication Code”. • MAC is a one way fixed length function of both a message and secret shared by sender & receiver. • For each message, sender computes MAC and append to the message. • On receipt of message and MAC, receiver compute same function on the message and secret shared with sender. Prepared by: Mohan Gholap
Necessary Properties of MAC: Prepared by: Mohan Gholap