You are on page 1of 36

Network Security

Lec 11
(Message Authentication &
Hash Functions)

Message Authentication
Message authentication is a
mechanism used to verify the integrity
of the message.
Message authentication assures that
data received are exactly as
sent(contains no modification, insertion,
deletion, or replay) and that the
purported identity of the sender is valid.
Symmetric encryption provides
authentication among those who share
the secret key.

Techniques of Message
Authentication
Two most common cryptographic
technique for message authentication
are:
Message authentication code(MAC)
Secure Hash function

MAC
A MAC is an algorithm that requires the
use of secret key.
A MAC takes a variable-length message
and a secret key as input and produces
an authentication code.
A recipient in possession of the secret
key can generate an authentication code
to verify the integrity of the message.

Hash functions
A hash function maps a variable-length
message into a fixed length hash value,
or message digest.
For message authentication, a secure
hash function must be combined in
some fashion with a secret key.

Authentication
Requirements
Disclosure: Release of message contents
to any person not possessing the
appropriate cryptographic key.
Traffic analysis: Discovery of patterns of
traffic between parties.
Connection oriented : the frequency and
duration of connections could be determine
Connection or connectionless :the number
and length of message between parties could
be determined.

Masquerade: insertion of message into


the network from a fraudulent source

Authentication
Requirements

Content modification: Changing the


content of the message, including insertion,
deletion etc.
Sequence modification: Any modification
to sequence of messages between parties
including insertion, deletion.
Timing modification: Delayed or replay of
messages.
Source repudiation: Denial of transmission
of message by source.
Destination repudiation: Denial of receipt
of message by destination.

Authentication
Requirements
The first two attacks deal with
message confidentiality.
3 to 6 deal with message
authentication.
And last two deal with digital
signatures.

Authentication Functions
Types of functions that may be used to
produce an authenticator:
Message Encryption
Message authentication code(MAC)
Hash Function

Message Encryption
Message encryption can itself provide
measure of authentication. The analysis
differ for :
Symmetric
public- key encryption schemes

Symmetric Encryption

Symmetric Encryption
If no other party knows the key, the
confidentiality is provided, no other can
recover the plaintext of the message.
In addition , B is assured that the
message generated by A.
Message was come from A because A is
the only party that possess K.
Furthermore if M is recovered B knows
that non of the bits are altered, because
an opponent that does not knows K would
not be able to alter bits in the cipher text
to produce desired changes in the
plaintext.

Symmetric Encryption
We can say that symmetric encryption
provide both confidentiality and
authentication.
Consider what is happening at B ,
Given decryption function D , B will
accept any cipher text X and produce Y.
If X is the cipher text of legitimate
message then Y is some cipher text ,
otherwise meaning less sequence of
bits.
So if Y is legitimate plaintext therefore

Symmetric Encryption
For example we are transmitting English
language message using caeser cipher
with a shift of one (K=1) .A sends the
following legitimate cipher text.
Decrypts to produce the following
plaintext
A Simple Frequency analysis confirms
that message has the profile of ordinary
English.
On the other hand if opponent

Symmetric Encryption
It may be difficult to determine
automatically if incoming ciphertext
decrypts to intelligible plaintext.
If the plaintext , is a object file or
digitized X-ray, determination of
properly formed and therefore authentic
plaintext may be difficult.
One solution to this is to force the
plaintext to have some structure that
can be easily recognized but cannot be
easily replicated without resource to
encryption function.

Symmetric Encryption
Append an error correcting code or a frame
check sequence(FCS) to each message before
encryption.
A prepares plaintext message and provide
this input to the function F that produce an
FCS.
FCS is appended to M and entire block is
encrypted.
At destination B decrypts the incoming
block and treat the result as a message with
appended FCS.
B applies the same function F to attempt to
reproduce the FCS.
If the calculated FCS is equal to the
incoming FCS, then message is considered

Symmetric Encryption

Order Matters
The order in which the FCS and encryption
function are performed in critical.
With internal error control , authentication
is provided because an opponent would
have difficulty generating ciphertext that ,
when decrypted , would have valid error
control bits.
If instead the FCS is the outer code, an
opponent can construct messages with valid
error control codes.
Although the opponent cannot know the

Public Key Encryption

Message Authentication
Code

Authentication technique involves the use of


secret key to generate a small fixed-size block of
data, known as cryptographic checksum or MAC
that is appended to message.
Assume the two parties say A and B, share a
common secret key K. when A has a message to
send to B , it calculates the MAC as a function of
the message and the key:
MAC = C(K,M), where
M= input message
C= MAC function
K=shared secret key
MAC = message authentication code

MAC
The message plus MAC are transmitted
to the intended recipient.
The recipient perform the same
calculation on the received message,
using the same secret key to generate a
new MAC.
The received MAC is compared to the
calculated MAC.
If we assume that only the receiver
and the sender knows the identity of the
secret key and if the received MAC
matches the calculated MAC,

MAC
Then, the received is assured that
message is not altered. If the attacker
alters the message but does not alter
the MAC, then the receivers calculation
of the MAC will differ from the received
MAC. Because the attacker is assumed
not to know the secret key, the attacker
cannot alter the MAC to corresponds to
the alteration in the message.
The receiver is assured that the
message is from the alleged sender.
Because no one else knows the secret

MAC

MAC
A MAC function is similar to encryption.
One difference is that MAC need not to
reversible, as it must be decryption.
The process provides authentication but
not confidentiality, because the message
as a whole is transmitted in the clear.
Confidentiality can be provided by
performing message encryption either
after or before the MAC algorithm.
In both cases, two separate keys are
needed , each of which is shared by the
sender and the receiver.

Two cases
In first case, the MAC is calculated with
the message as the input and then
concatenated to the message.
The entire block is then encrypted.
In the second case, the message is
encrypted first. Then the MAC is
calculated using the resulting ciphertext
and is concatenated to the ciphertext to
form the transmitted block.

Continued

Hash Functions
A variation on the MAC is the one-way
hash function.
As with MAC, a hash function accepts a
variable size message M as input and
produce a fixed-size output , referred to
hash function
Unlike a MAC, a hash code does not use a
key but is function only of the input
message.
Also referred to message digest or hash
value.
The hash code is a function of all the bits
of the message and provide an errordetection capability: A change to any bit or

Uses of HASH function


Variety of ways to use hash function.
The message plus concentrated hash code is
encrypted using symmetric encryption.
Only A and B knows the secret key , the message
must have come from A and has not been altered.
The hash code provide to achieve authentication.
Because encryption is applied to the entire
message plus hash code, confidentiality is also
provided.

Only hash code is


encrypted

Only hash code is encrypted, using


symmetric encryption. The reduces the
processing burden for those
applications that do not require
confidentiality.

Only hash code, using


Public key encryption
Only hash code is encrypted , using
public-key encryption and using senders
private key.
is also provide digital signatures ,
because only the sender could have
produced the encrypted hash code.

Confidentiality and DS
If confidentiality as well as a digital
signature is desired, then the message
plus the private-key-encrypted hash
code can be encrypted using a
symmetric secret key.

Hash function but no


encryption
Use hash function but no encryption for
message authentication.
The technique assumes that the two
communication parties share a secret value S.
A computes the hash value over the
concatenation of M and S and append the
resulting hash value of M.
Because B possess S , it can recomputed
the hash value to verify.
Because the secret value itself is not sent,
an opponent cannot modify an intercepted

Continued

Confidentiality can be
added to last approach
Confidentiality can be added to the
last approach by encrypted the entire
message plus the hash code.

Conclusion
The difference between a one-way
hash and a MAC (Message
authentication code), is that the hash
verifies the uniqueness of a message
or file.
The MAC is usually an encrypted
hash, also used to verify the
uniqueness of a message, but which
only can be verified if you know the
secret key.

Continued
For example, say you have a list of the MD5
hashes of all your system files.If you verify
the MD5 values of the files periodically with
this list, you could see which files have been
changed or updated, by a virus, for instance.
However, if a virus comes in your system,
and replaces a system file, it could also
replace the MD5 value in your list with the
new one, and you wouldn't know this
happened.
If you had a list of MACs, however, the virus
could replace your system file, but it has no

You might also like