Cns 3
Cns 3
C
KEY AND
ASY M M ETRIC KEY
ENC IPHERM ENT
UNIT - 2
INTRODUCTION
• The A d v a n c e Encryption Standard (AES) is a symmetric-key block cipher
published by the National Institute of Standard a n d Technology(NIST) in December
2001.
• In 1997, NIST started looking for a replacement for DES, which would be called the
Advanced Encryption Standard or AES.
• The NIST specifications required a block size of 128 bits and three different key sizes of
128, 192, and 256 bits.
• Criteria:
• The criteria defined by NIST for selecting AES fall into three areas:
• Security The main emphasis was on security. Because NIST explicitly demanded a
128-bit key, this criterion focused on resistance to cryptanalysis attacks other than brute-
force attack.
• Cost Computational efficiency and storage requirements.
• Implementation Flexibility(platform independent),simplicity and storage.
A d v a n c e Encryption Standard
Rounds
•AES is a non-Feistel cipher that encrypts and decrypts a data block of 128 bits.
•It uses 10, 12, or 14 rounds. The key size, which can be 128, 192, or 256 bits, depends on the
number of rounds.
•Figure 7.1 shows the general design for the encryption algorithm (called cipher); the decryption
algorithm (called inverse cipher) is similar, but the round keys are applied in the reverse order.
•In Figure 7.1, Nr defines the number of rounds. The figure also shows the relationship between the
number of rounds and the key size, which means that we can have three different AES versions;
they are referred as AES-128, AES-192, and AES-256.
•However, the round keys, which are created by the key-expansion algorithm are always 128 bits,
the same size as the plaintext or ciphertext block.
•The number of round keys generated by the key-expansion algorithm is always one more than the
number of rounds. In other words, we have
•Number of round keys = Nr + 1 We refer to the round keys as K0, K1, K2, …, KNr .
Data Units
• AES uses five units of measurement to refer to data: bits, bytes, words, blocks, and state. The bit is the smallest
and atomic unit; other units can be expressed in terms of smaller ones.
• Bit In AES, a bit is a binary digit with a value of 0 or 1. We use a lowercase letter to refer to a bit.
• Byte A byte is a group of eight bits that can be treated as a single entity, a row matrix (1 × 8) of eight bits, or a
column matrix (8 × 1) of eight bits. When treated as a row matrix, the bits are inserted to the matrix from left to
right; when treated as a column matrix, the bits are inserted into the matrix from top to bottom. We use a
lowercase bold letter to refer to a byte.
• Word A word is a group of 32 bits that can be treated as a single entity, a row matrix of four bytes, or a column
matrix of four bytes. When it is treated as a row matrix, the bytes are inserted into the matrix from left to right;
when it is considered as a column matrix, the bytes are inserted into the matrix from top to bottom. We use the
lowercase bold letter w to show a word.
• Block AES encrypts and decrypts data blocks. A block in AES is a group of 128 bits. However, a block can be
represented as a row matrix of 16 bytes.
• State AES uses several rounds in which each round is made of several stages. Data block is transformed from
one stage to another. At the beginning and end of the cipher, AES uses the term data block; before and after
each stage, the data block is referred to as a state.
Figure : Block-to-state a n d state-to-block
transformation
• Exa m p le : “AES use s a
m a trix”
• Structure of Each Round: the structure of each round at the encryption side. Each round, except the last, uses
four transformations that are invertible. The last round has only three transformations.
• each transformation takes a state and creates another state to be used for the next transformation or the next
round. The pre-round section uses only one transformation (AddRoundKey); the last round uses only three
transformation.
Transformations Used by AES
To provide security, AES uses four types of
transformations:
• Substitution
• Permutation
• M ixing a nd
• Key adding
Substitution
• A ES use s sub stitutio n
• M e c ha nism is d iffe re nt
1. Sub stitution d o ne fo r e a c h b yte
2. Ta b le is use d fo r sub stitution fo r e a c h b yte
3. Table Lookup process or mathematical calculation in GF(2 8
field)
• A ES use s tw o inv e rtib le tra nsfo rm a tio ns.
• Subbytes
• InvSubBytes
• Subbytes:
• The first transformation, SubBytes, is used at the encryption site.
• To substitute a byte, we interpret the byte as two hexadecimal
digits.
• Le ft d ig it – ro w
• Rig ht d ig it -c o lum n
• InvMixColumns:
• It is basically s a m e as the MixColumns
transformation.
• Algorithm:
• Ke y A d d ing :
• AddRoundKey: AddRoundKey also proceeds one column at a time.
• It is sim ila r to M ixC olum ns.
• AddRoundKey adds a round key word with e a c h state column matrix.
• The operation in MixColumns is matrix multiplication; the operation in AddRoundKey
is matrix addition.
w 0, w 1, w 2, … … . W 4(N r + 1) - 1
• Second, asymmetric key cryptography means that Bob a n d Alice cannot use the
s a m e set of keys for two way communication.
• Third, asymmetric key cryptography means that Bob needs only one private key
to receive all correspondence from anyone in the community.
• Encryption a n d Decryption in asymmetric key cryptography are
mathematical functions applied over the numbers representing the
plaintext a n d ciphertext.
Function:
A function is a rule that associates(maps) on e element in set A, called the domain,
to on e element in set B called the range.
An invertible function is a function that associates e a c h element in the range
with exactly on e element in the domain.
O ne -w ay
func tio n
Kna p sa c k
•c ryp to systeEncryption
Knapsack m: Algorithm is the first general public key cryptography algorithm. It
is developed by Ralph Merkle and Mertin Hellman.
• Definition:
Suppose we are given two k-tuples, a = [a1, a2, ….. ,ak] and x = [x1, x2,…. , xk].
The first tuple is predefined set; the second tuple, in which xi is only 0 or 1, defines which
element of a are to be dropped in the knapsack.
• The sum o f e le m ents in the kna p sa c k is
s = knapsackSum (a, x) = x1a1+ x2a2 + … … + xkak.
• S = knapsackSum (x, a) is easy to calculate, but x = inv_knapsackSum(s,a) is difficult.
• Sup e rinc re a sing
Tup le :
RSA Cryptosystem
• The most c o m m o n public key algorithm is the RSA cryptosystem, names fir
its inventors(Rivest, Shamir a n d Adleman).
• Decryption:
Examples
Solve
Show the steps of RSA Algorithm. If the RSA public key is (31, 3599), what is
the corresponding private key?
• e=31 a n d n=3599 p=59 a n d q=61 phi(n)= 3480
• d *e =1 m o d 3480
• d= 3031
• Priv a te key = 3031
Solve
1.Bob chooses 7 a n d 11 as p a n d q a n d calculates n value. Find the value of φ(n).
N o w ch oos e the two exponents e a n d d. N o w assume that Alice wants to send the
plain text 5 to Bob. Find the cipher text a n d decrypt it on receiving side to get
plaintext using RSA algorithm.
2.Show the steps of RSA Algorithm. If the RSA public key is (31, 3599), what is
the corresponding private key?
• C oppersmith attack :
• Theorem states that in a modulo n polynomial f (x) of degree e, on e c a n use a n
algorithm of the complexity log n to find the roots if on e of the roots is smaller than n
1/e
• Broadcast attack
• Suppose Alice wishes to send s a m e m e s s a g e to three recipients with the s a m e
public key exponent e a n d the moduli n1,n2,n3
Related Message attack
• If Alice encrypt two P1 a n d P2 with e =3 a n d send C 1 a n d C 2 to Bob.
• If P1 a n d P2 is related by a linear function, then e v e c a n recover P1 a n d p2 in
a feasible computation time.
• Short p a d attack:
• Alice has a m e s s a g e M to send to Bob. She pads the m e s s a g e with r1, encrypt
a n d send C 1 to Bob.
• Ev e inte rc e p t C 1 a nd d ro p s it
• Bob inform Alice that he has not received the message, so Alice pads the
m e s s a g e again with r2, encrypt a n d send to Bob.
• Ev e a lso will inte rc e p t the m e ssa g e .
• Eve now has C 1 a n d C2, knows both belong to s a m e plaintext .
• If r1 a n d r2 are short, e v e m a y b e able to recover M
Attacks on Decryption key:
• Revealed decryption exponent attack:
• If attacker som ehow guess decryption key d, cipher text generated by encryption
key is in danger, a n d e v e n future messages are also in danger.
• So, it is advised to take fresh values of two prime numbers (i.e; P a n d Q), N a n d E.
• Cycling attack:
• Attacker will think that plain text is converted into cipher text using permutation.
• Continuous encryption of ciphertext will eventually result in plain text. But attacker
does not know the plain text. Hence will keep doing it until gets the ciphertext,
goes b a ck on e step find the plain text
• Unconcealed Message attack:
• For s om e plain-text messages, encryption provides cipher-text which is the equal as
the original plain-text.
• If this appears, the original plain-text message cannot b e secret.
• Therefore, this attack is known as u n con ce a le d message attack.
• Attacks on the Modulus – C ommon modulus attack
• If a community uses a c o m m o n modulus n, select p a n d q, calculate n a n d Φ(n),
and
create a pair of exponents(ei, di) for e a c h entity.
• The p ro b le m is e v e c a n a lso d e c ryp t the m e ssa g e , if he is a m e m b e r o f the
c o m m unity a n d assigned a pair of exponent (ee, d e )
• Implementation –Timing attack:
• Ev e inte rc e p t a la rg e num b e r o f c ip he rte xt C 1,C 2… to C m .
• Eve observe how long it takes for the underlying hardware to calculate a
multiplication operation from t1 to tm( t is time required to calculate the
multiplication operation)
• The timing difference allows Eve to find the value of bits in d, on e by on e
Implementation – Power attack
• Eve c a n precisely measure the power con s u m e d during decryption, c a n launch
power attack.
• M ultip lic a tio n a nd sq ua ring c o nsum e s m o re p o w er.
• O p tic a l A sym m e tric Enc ryp tio n
Pa d d ing (O A EP)