CNS Module2
CNS Module2
AES
The Advanced Encryption Standard (AES) was published by the National
Institute of Standards and Technology (NIST) in 2001. AES is a symmetric block
cipher that is intended to replace DES as the approved standard for a wide
range of applications.In AES, all operations are performed on 8-bit bytes. In
particular, the arithmetic operations of addition, multiplication, and division are
performed over the finite field GF(28 ) .Designed by Rijmen-Daemen in Belgium.
Figure shows the overall structure of the AES encryption process. The cipher
takes a plaintext block size of 128 bits, or 16 bytes. The key length can be 16,
24, or 32 bytes (128, 192, or 256 bits). The algorithm is referred to as AES-128,
AES-192, or AES-256, depending on the key length.
The input to the encryption and decryption algorithms is a single 128-bit
block.This block is copied into the State array, which is modified at each stage
of encryption or decryption. After the final stage, State is copied to an output
matrix. These operations are depicted in Figure 5.2a. Similarly, the key is
depicted as a square matrix of bytes. This key is then expanded into an array of
key schedule words. Figure 5.2b shows the expansion for the 128-bit key. Each
word is four bytes, and the total key schedule is 44 words for the 128-bit key.
Note that the ordering of bytes within a matrix is by column. So, for example,
the first four bytes of a 128-bit plaintext input to the encryption cipher occupy
the first column of the in matrix, the second four bytes occupy the second
column, and so on. Similarly, the first four bytes of the expanded key, which
form a word, occupy the first column of the w matrix.
The cipher consists of N rounds, where the number of rounds depends on the
key length.Refer table 5.1. The first N - 1 rounds consist of four distinct
transformation functions: SubBytes, ShiftRows, MixColumns, and AddRoundKey,
which are described subsequently. The final round contains only three
transformations, and there is a initial single transformation (AddRoundKey)
before the first round,which can be considered Round 0. Each transformation
takes one or more 4 * 4 matrices as input and produces a 4 * 4 matrix as
output. Figure 5.1 shows that the output of each round is a 4 * 4 matrix, with
the output of the final round being the ciphertext. Also, the key expansion
function generates N + 1 round keys, each of which is a distinct 4 * 4 matrix.
Each round key serve as one of the inputs to the AddRoundKey transformation
in each round.
AES encrytpion and decryption
MixColumns Transformation
The forward mix column transformation,called MixColumns, operates on each
column individually. Each byte of a column is mapped into a new value that is a
function of all four bytes in that column.
AddRoundKey Transformation
The first matrix is State, and the second matrix is the round key.The inverse
add round key transformation is identical to the forward add round key
transformation, because the XOR operation is its own inverse.
AES Decryption
AES decryption is not identical to 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
Implementation Aspects
➔ can efficiently implement on 8 - bit CPU
– byte substitution works on bytes using a table of 256 entries– shift rows is
simple byte shift,add round key works on byte XOR ’ s– mix columns requires
matrix multiply in GF(2 8 ) which works on byte values, can be simplified to use
table lookups & byte XOR ’ s
➔ can efficiently implement on 32 - bit CPU
– redefine steps to use 32 - bit words-can precompute 4 tables of 256 - words–
then each column in each round can be computed using 4 table lookups + 4
XORs– at a cost of 4Kb to store tables
**For stream cipher refer your assignment number 2......
MODULE 3
Public-Key Cryptosystems
A public-key encryption scheme has six ingredients
Plaintext: This is the readable message or data that is fed into the
algorithm as input.
Encryption algorithm: The encryption algorithm performs various
transformations on the plaintext.
Public and private keys: This is a pair of keys that have been selected
so that if one is used for encryption, the other is used for decryption. The
exact transformations performed by the algorithm depend on the public
or private key that is provided as input.
Ciphertext: This is the scrambled message produced as output. It
depends on the plaintext and the key. For a given message, two different
keys will produce two different ciphertexts.
Decryption algorithm: This algorithm accepts the ciphertext and the
matching key and produces the original plaintext.
The essential steps are the following.
1. Each user generates a pair of keys to be used for the encryption and decryp-
tion of messages.
2. Each user places one of the two keys in a public register or other accessible
file.This is the public key.The companion key is kept private.As Figure 9.1a
suggests,each user maintains a collection of public keys obtained from others.
3. If Bob wishes to send a confidential message to Alice, Bob encrypts the
message using Alice’s public key.
4. When Alice receives the message, she decrypts it using her private key. No
other recipient can decrypt the message because only Alice knows Alice’s
private key.
There is some source A that produces a message in plaintext, X = [X 1 , X 2 , . . .
, X M ]. The M elements of X are letters in some finite alphabet. The message is
intended for destination B. B generates a related pair of keys: a public key, PU b
, and a private key, PR b . PR b is known only to B, whereas PU b is publicly
available and therefore accessible by A.With the message X and the encryption
key PU b as input, A forms the ciphertext Y = [Y 1 , Y 2 , . . . , Y N ]:
Y = E(PU b , X)
Encryption and decryption are of the following form, for some plaintext block
M and ciphertext block C:
C = Me mod n
M = Cd mod n = (Me)d mod n = Med 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 PU =
{d, n}. For this algorithm to be satisfactory for public-key encryption
n = pq (public,
calculated)
The private key consists of {d, n} and the public key consists of {e, n}.
Suppose that user A has published its public key and that user B wishes to send
the message M to A. Then B calculates C = Me modn and transmits C. On
receipt of this ciphertext, user A decrypts by calculating M = Cd mod n.
Example
An Example Illustrated
The Security of RSA
Four possible approaches to attacking the RSA algorithm are as follows:
Brute force: This involves trying all possible private keys.
Mathematical attacks: There are several approaches, all equivalent in
effort to factoring the product of two primes.
Timing attacks: These depend on the running time of the decryption
algorithm.
Chosen ciphertext attacks: This type of attack exploits properties of
the RSA algorithm.
Key Management
At this point, public keys have been securely delivered to A and B, and
they may begin their protected exchange
5. B sends a message to A encrypted with PUa and containing A's nonce
(N1) as well as a new nonce generated by B (N2) Because only B could
have decrypted message (3), the presence of N1 in message (6) assures
A that the correspondent is B.
6. A returns N2, encrypted using B's public key, to assure B that its
correspondent is A
Public-Key Certificates
1. Any participant can read a certificate to determine the name and public key
of the certificate's owner.
2. Any participant can verify that the certificate originated from the
certificate authority and is not counterfeit.
3. Only the certificate authority can create and update certificates.
4 Any participant can verify the currency of the certificate.
CA = E(PRauth, [T||IDA||PUa])
where PRauth is the private key used by the authority and T is a timestamp. A
may then pass this certificate on to any other participant, who reads and
verifies the certificate as follows:
D(PUauth, CA) = D(PUauth, E(PRauth, [T||IDA||PUa])) = (T||IDA||PUa)
Example
User A & B exchange the key using Diffie Hellman alg. Assume
á=5 q=11 XA=2 XB=3. Find YA, YB, K.
Soln:
YA = áXA mod q
=52 mod 11
=3
YB = áXB mod q
= 53 mod 11
=4
KA = YBXA mod q
= 42 mod 11
=5
KB = YAXB mod q
= 33 mod 11
=5
Comparison of RSA & DES