CS6701 CNS Unit-Ii Notes
CS6701 CNS Unit-Ii Notes
Data Encryption Standard- Block cipher principles- block cipher modes of operation- Advanced
Encryption Standard (AES)- Triple DES-Blowfish- RC5 algorithm. Public key cryptography:
Principles of public key cryptosystems- The RSA algorithm-Key management - Diffie Hellman
Key exchange- Elliptic curve arithmetic- Elliptic curve cryptography.
The most widely used private key block cipher, is the Data Encryption Standard (DES). It
was adopted in 1977 by the National Bureau of Standards as Federal Information
Processing Standard 46 (FIPS PUB 46). DES encrypts data in 64-bit blocks using a 56-bit
key. The DES enjoys widespread use. It has also been the subject of much controversy its
security
In the late 1960s, IBM set up a research project in computer cryptography led by Horst
Feistel. The project concluded in 1971 with the development of the LUCIFER algorithm.
LUCIFER is a Feistel block cipher that operates on blocks of 64 bits, using a key size of
128 bits.
Because of the promising results produced by the LUCIFER project, IBM embarked on
an effort, headed by Walter Tuchman and Carl Meyer, to develop a marketable
commercial encryption product that ideally could be implemented on a single chip. It
involved not only IBM researchers but also outside consultants and technical advice from
NSA. The outcome of this effort was a refined version of LUCIFER that was more
resistant to cryptanalysis but that had a reduced key size of 56 bits, to fit on a single chip.
In 1973, the National Bureau of Standards (NBS) issued a request for proposals for a
national cipher standard. IBM submitted the modified LUCIFER. It was by far the best
algorithm proposed and was adopted in 1977 as the Data Encryption Standard.
1
The overall scheme for DES encryption is illustrated in Stallings Figure 3.4, which takes as input
64-bits of data and of key.
The left side shows the basic process for enciphering a 64-bit data block which consists of:
- 16 rounds of a complex key dependent round function involving substitutions & permutations
The right side shows the handling of the 56-bit key and consists of:
- an initial permutation of the key (PC1) which selects 56-bits out of the 64-bits input, in two 28-
bit halves
- 16 stages to generate the 48-bit subkeys using a left circular shift and a permutation of the two
28-bit halves
1
We now review the internal structure of the DES round function F, which takes R
half & subkey, and processes them. The round key Ki is 48 bits. The R input is 32
bits. This R input is first expanded to 48 bits by using a table that defines a
permutation plus an expansion that involves duplication of 16 of the R bits (Table
3.2c). The resulting 48 bits are XORed with Ki This 48-bit result passes through a
substitution function that produces a 32-bit output, which is permuted as defined
by Table 3.2d. This follows the classic structure for a feistel cipher.
Note that the s-boxes provide the “confusion” of data and key values, whilst the
permutation P then spreads this as widely as possible, so each S-box output
affects as many S-box inputs in the next round as possible, giving “diffusion”.
1
Modes of Operation
Modes of Operation
Topics
o Ci = EK (Pi)
Remarks on ECB
Weakness:
o If the same message is encrypted (with the same key) and sent twice, their
ciphertext are the same.
1
Typical application:
Each previous cipher blocks is chained to be input with current plaintext block, hence
name
C0 = IV
CBC scheme
Remarks on CBC
The encryption of a block depends on the current and all blocks before it.
Encrypt previous ciphertext , then combined with the plaintext block using X-OR to
produce the current ciphertext
1
Any number of bit (1, 8 or 64 or whatever) to be feed back (denoted CFB-1, CFB-
8, CFB-64)
Ci = Pi XOR SelectLeft(EK
(ShiftLeft(Ci-1)))
C0 = IV
CFB Scheme
CFB Encryption/Decryption
In CFB mode, encipherment and decipherment use the encryption function of the
underlying block cipher.
Remark on CFB
• enable to encrypt any number of bits e.g. single bits or single characters (bytes)
A ciphertext segment depends on the current and all preceding plaintext segments.
A corrupted ciphertext segment during transmission will affect the current and next
several plaintext segments.
But output of the encryption function output of cipher is fed back (hence name), instead
of ciphertext
1
Ci = Pi XOR Oi
Oi = EK (Oi-1)
O0 = IV
OFB Scheme
In OFB mode, encipherment and decipherment use the encryption function of the
underlying block cipher.
Remarks on OFB
Each bit in the ciphertext is independent of the previous bit or bits. This avoids error
propagation
Security issue
when jth plaintext is known, the jth output of the forward cipher function will be
known
Easily cover jth plaintext block of other message with the same IV
Counter (CTR)
Encrypts counter value with the key rather than any feedback value (no feedback)
can be any function which produces a sequence which is guaranteed not to repeat
for a long time
Relation
Ci = Pi XOR Oi
1
Oi = EK (i)
CTR Scheme
Remark on CTR
Strengthes:
Counter must be
Topics
block cipher
stream cipher
1
CTR is faster because simpler and it allows parallel processing
1
What is AES?
1
1
Some Comments on AES
1. an iterative rather than Feistel cipher
2. key expanded into array of 32-bit words
̶ four words form round key in each round
3. 4 different stages are used as shown
4. has a simple structure
5. only AddRoundKey uses key
6. AddRoundKey a form of Vernam cipher
7. each stage is easily reversible
8. decryption uses keys in reverse order
9. decryption does recover plaintext
10.final round has only 3 stages
AES Decryption
• AES decryption is not identical to
1
encryption since steps done in reverse
• but can define an equivalent inverse
cipher with steps as for encryption
– but using inverses of each step
– with a different key schedule
• works since result is unchanged when
– swap byte substitution & shift rows
– swap mix columns & add (tweaked) round key
Triple DES
In cryptography, Triple DES (3DES), officially the Triple Data Encryption
Algorithm (TDEA or Triple DEA), is a symmetric-keyblock cipher, which applies the Data
Encryption Standard (DES) cipher algorithm three times to each data block.
The original DES cipher's key size of 56 bits was generally sufficient when that algorithm was
designed, but the availability of increasing computational power made brute-force
attacks feasible. Triple DES provides a relatively simple method of increasing the key size of
DES to protect against such attacks, without the need to design a completely new block cipher
algorithm.
1
Triple DES - Algorithm
Triple DES uses a "key bundle" that comprises three DES keys, K1, K2 and K3, each of 56 bits
(excluding parity bits). The encryption algorithm is:
ciphertext = EK3(DK2(EK1(plaintext)))
I.e., DES encrypt with K1, DES decrypt with K2, then DES encrypt with K3.
Decryption is the reverse:
plaintext = DK1(EK2(DK3(ciphertext)))
I.e., decrypt with K3, encrypt with K2, then decrypt with K1.
Each triple encryption encrypts one block of 64 bits of data.
In each case the middle operation is the reverse of the first and last. This improves the
strength of the algorithm when using keying option 2, and provides backward
compatibilitywith DES with keying option 3
BlowFish
• characteristics
1
• Allows tuning for speed/security tradeoff
• used to generate
• i=1..4
• j=0..255
Public-key cryptography
1
Public-key cryptography, or asymmetric cryptography, is any cryptographic system that uses
pairs of keys: public keys that may be disseminated widely paired with private keys which are
known only to the owner. There are two functions that can be achieved: using a public key to
authenticate that a message originated with a holder of the paired private key; or encrypting a
message with a public key to ensure that only the holder of the paired private key can decrypt it.
In a public-key encryption system, any person can encrypt a message using the public key of the
receiver, but such a message can be decrypted only with the receiver's private key. For this to
work it must be computationally easy for a user to generate a public and private key-pair to be
used for encryption and decryption. The strength of a public-key cryptography system relies on
the degree of difficulty (computational impracticality) for a properly generated private key to be
determined from its corresponding public key. Security then depends only on keeping the private
key private, and the public key may be published without compromising security.
In an asymmetric key encryption scheme, anyone can encrypt messages using the public key, but
only the holder of the paired private key can decrypt. Security depends on the secrecy of the
private key.
1
a related private-key, known only to the recipient, used to decrypt messages,
and sign (create) signatures
is asymmetric because
1
RSA
RSA is the best known, and by far the most widely used general public key encryption
algorithm, and was first published by Rivest, Shamir & Adleman of MIT in 1978
[RIVE78]. The Rivest-Shamir-Adleman (RSA) scheme has since that time reigned
supreme as the most widely accepted and implemented general-purpose approach to
public-key encryption. It is based on exponentiation in a finite (Galois) field over integers
modulo a prime, using large integers (eg. 1024 bits). Its security is due to the cost of
factoring large numbers.
The scheme developed by Rivest, Shamir, and Adleman makes use of an expression with
exponentials. Plaintext is encrypted in blocks, with each block having a binary value less
than some number n. The actual RSA encryption and decryption computations are each
simply a single exponentiation mod (n). Both sender and receiver must know the value of
n. The sender knows the value of e, and only the receiver knows the value of d. Thus, this
is a public-key encryption algorithm with a public key of PU = {e, n} and a private key of
PR = {d, n}. Note that the message must be smaller than the modulus. The “magic” is in
the choice of the modulus and exponents which makes the system work.
1
Traditionally, secure encrypted communication between two parties required that they
first exchange keys by some secure physical channel, such as paper key lists transported
by a trusted courier. The Diffie–Hellman key exchange method allows two parties that
have no prior knowledge of each other to jointly establish a shared secret key over
an insecure channel. This key can then be used to encrypt subsequent communications
using a symmetric key cipher.
Diffie–Hellman is used to secure a variety of Internet services. However, research
published in October 2015 suggests that the parameters in use for many D–H Internet
applications at that time are not strong enough to prevent compromise by very well-
funded attackers, such as the security services of large governments.[3]
• Diffie-Hellman Key Exchange
• by Diffie & Hellman in 1976 along with the exposition of public key concepts
– note: now know that James Ellis (UK CESG) secretly proposed the concept in
1970
• value of key depends on the participants (and their private and public key information)
• Diffie-Hellman Setup
1
• each user (eg. A) generates their key
• KAB is used as session key in private-key encryption scheme between Alice and Bob
• if Alice and Bob subsequently communicate, they will have the same key as before,
unless they choose new public-keys
• Diffie-Hellman Example
1
• majority of public-key crypto (RSA, D-H) use either integer or polynomial arithmetic
with very large numbers/polynomials
• y2 = x3 + ax + b
• majority of public-key crypto (RSA, D-H) use either integer or polynomial arithmetic
with very large numbers/polynomials
– y2 = x3 + ax + b
1
• have addition operation for elliptic curve
• Elliptic curve cryptography uses curves whose variables & coefficients are finite
• best in software
• best in hardware
1
• need “hard” problem equiv to discrete log