Assignment-3 - Abdul Haleem
Assignment-3 - Abdul Haleem
Message Integrity
Message integrity implies that the message is not altered in the way. Some times message
secrecy is not of the concern but its integrity is required. For example Alice may write a
will to distribute her estate upon her death. The secrecy of the will is not important. Every
one can examine the will but it is important that it remains unchanged [1].
For maintaining message integrity hash functions are used which create a hash value of
the message. Original message and its hash value are sent to the receiver who verifies
message integrity by re-computing the hash value and comparing with the received one.
The computed hash value should be one-way collision free. One-way property ensures
that given a hash value, its actual message cannot be retrieved. Collision free property
ensures that no two different messages should have same hash value [2].
Preimage_attack(D)
for (i = 1 to k) // number of times algorithm to be executed
create(M[i]) // create a new message
T = h(M[i]) // create hash of new message and store in T
if (T == D) return M[i] // match T with intercepted hash
return failure
The complexity of this algorithm is proportional to 2n, where n is the size of digest D [2].
Preimage_attack(D, M)
for (i = 1 to k) // number of times algorithm to be executed
create(M[i]) // create a new message
T = h(M[i]) // create hash of new message and store in T
if (T == D) return M[i] // match T with intercepted hash
return failure
The complexity of this algorithm is proportional to 2n, where n is the size of digest D [2].
Collision Attack
In collision attack, two messages are built from the scratch whose hash value is same. For
example Trudy prepares another will whose hash is same as of original will. When the
time comes, fake will is presented and the forgery goes undetected.
All currently known practical attacks on md5 and sha-1 hash functions are collision
attacks [2].
Following ideal algorithm elaborates how to perform collision attack [2].
Collision_attack
for (i = 1 to k) // number of times algorithm to be executed
create (M[i]) // create a new message
D[i] = h(M[i]) // create hash of new message and store in D[i]
for (j = 1 to i) // find a matching digest with the new one
if (D[i] == D[j]) return M[i] and M[j]
return failure
The complexity of this algorithm is 2n/2, where n is the size of digest D [2].
2. The size of key is normally very large, so Trudy can use another tool: the pre-
image attack. In this type of attack Trudy tries to find out another message whose
digest is same as of intercepted one. After that she can find out the key and forge
the actual message.
3. Given some pairs of messages and their MACs, Trudy can manipulate them to
create a new message with its MAC.
Nested MAC
Nested MAC improves the security of MAC by applying hash function in two steps [1].
1. Concatenate key with actual message and apply hash function to create
intermediate digest.
2. Concatenate key with the intermediate digest and apply hash function to create
final digest.
HMAC
HMAC is much more complex than the simple nested MAC. There are additional
features such as padding. Here are its general steps [1]:
1. The message is divided in N blocks each of b bits.
2. The secret key is left padded to create a b-bit key. It is then exclusive-ored with a
predefined bitmap called ipad (input pad).
3. The resultant block is pre-pended with the actual N block message to create (N+1)
blocks.
4. Hash function is now applied on the N+1 blocks to create an n-bit digest. This
digest is called intermediate digest.
6. The secret key is again padded to make b-bits and exclusive-ored with a different
bitmap called opad (output pad).
7. The resultant key is pre-pended with the padded digest and then hash function is
applied to get final n-bit HMAC.
CMAC
The idea in CMAC is to create one block of MAC from N blocks of plain text using a
symmetric key N times. Here are the steps [1]:
1. The message is divided in N blocks of m bits. If last block is not of m bits, it is
padded with 1 followed by required number of zeros.
2. The first block is encrypted using the symmetric key to create an m-bit encrypted
block.
3. The encrypted block is exclusive-ored with next block and then encrypted to
create next m-bit encrypted block.
4. The process continues until the last block of plain text is exclusive-ored and
encrypted.
References
1. Behrouz A. Forouzan, Cryptography & Network Security, Special Indian Edition,
McGraw Hill.
2. P. Hoffman and B. Schneier, “Attacks on Cryptographic Hashes in Internet
Protocols”, RFC 4270, November 2005.
3. http://en.wikipedia.org/wiki/Cryptographic_hash_function