CNS UNIT 4
CNS UNIT 4
Message:
A message refers to any data, text, or information that is sent from one entity to another in a
communication system.
It can be in various forms, including plain text, binary data, multimedia, or structured information
like JSON or XML.
Message Digest:
A message digest is a fixed-size output (hash) generated from a message using a cryptographic hash
function (e.g., SHA-256, MD5).
Checking Integrity:
1. Deterministic
The same input must always produce the same hash output.
2. Fast Computation
The function should compute the hash value quickly for any given input.
Given an input x and its hash H(x), it should be infeasible to find another input y
(where y ≠ x) such that H(y) = H(x).
5. Collision Resistance
It should be extremely difficult to find two different inputs x and y that produce the
same hash output, i.e., H(x) = H(y).
6. Avalanche Effect
A small change in the input should produce a significantly different hash output,
making the function highly sensitive to input changes.
The hash function should always produce a fixed-length output, regardless of the
input size.
2) When a message is given for which a digest exists, the oracle simply gives the
digest in the record.
3) The digest for a new message needs to be chosen independently from all previous
digests. This implies that the oracle cannot use a formula or an algorithm to
calculate the digest.
Example:
The table has two columns. The left column shows the messages whose digests have been issued
by the oracle
Pigeonhole Principle:
pigeonhole principle: if n pigeonholes are occupied by n +1 pigeons, then at least one
pigeonhole is occupied by two pigeons.
Example:
Assume that the messages in a hash function are 6 bits long and the digests are only 4 bits
long.
Then the possible number of digests (pigeonholes) is 2 4 = 16,
The possible number of messages (pigeons) is 2 6 = 64.
This means n = 16 and kn + 1 = 64, so k is larger than 3.
The conclusion is that at least one digest corresponds to four (k + 1) messages.
MESSAGE AUTHENTICATION
Message authentication is the process of verifying the integrity and origin of a message to ensure
that it has not been altered in transit and comes from a legitimate sender.
The digest created by a cryptographic hash function is normally called a modification detection code
(MDC). The code can detect any modification in the message.
If Alice needs to send a message to Bob and be sure that the message will not change during
transmission, Alice can create a message digest, MDC, and send both the message and the MDC to
Bob. Bob can create a new MDC from the message and compare the received MDC and the new
MDC. If they are the same, the message has not been changed
Figure 11.9 shows that the message can be transferred through an insecure chan nel. Eve can read
or even modify the message. The MDC, however, needs to be trans ferred through a safe channel.
The term safe here means immune to change.
The MAC ensures the integrity of the message and the data origin authentication.
MAC is that the second includes a secret between Alice and Bob.
Alice uses a hash function to create a MAC from the concatenation of the key and the message, h (K|
M). She sends the message and the MAC to Bob over the insecure channel. Bob separates the
message from the MAC. He then makes a new MAC from the concatenation of the message and the
secret key. Bob then compares the newly cre ated MAC with the one received. If the two MACs
match, the message is authentic and has not been modified by an adversary.
Nested MAC:
To improve the security of a MAC, nested MACs were designed in which hashing is done in two
steps. In the first step, the key is concatenated with the message and is hashed to create an
intermediate digest. In the second step, the key is concatenated with the intermediate digest to
create the final digest.
Hashed MAC(HMAC):
3. The result of step 2 is exclusive-ored with a constant called ipad (input pad) to create a b-bit block.
4. The resulting block is prepended to the N-block message. The result is N + 1 blocks.
5. The result of step 4 is hashed to create an n-bit digest. We call the digest the inter mediate HMAC
6. The intermediate n-bit HMAC is left padded with 0s to make a b-bit block.
9. The result of step 8 is hashed with the same hashing algorithm to create the final n-bit HMAC.
CMAC: Cipher Based CMAC
Merkle-Damgard Scheme:
Merkle-Damgard Scheme
The Merkle-Damgard scheme is an iterated hash function that is collision resistant if the
compression function is collision resistant.
Rabin Scheme:
Davies-Meyer Scheme:
The Davies-Meyer scheme is basically the same as the Rabin scheme except that it uses forward feed
to protect against meet-in-the-middle attack.
Matyas-Meyer-Oseas Scheme:
The Matyas-Meyer-Oseas scheme is a dual version of the Davies-Meyer scheme: the message block
is used as the key to the cryptosystem.
The scheme can be used if the data block and the cipher key are the same size.
Miyaguchi-Preneel Scheme:
To make the algorithm stronger against attack, the plain text, the cipher key, and the ciphertext are
all exclusive-ored together to create the new digest.
Digital signature.
PROCESS:
The sender uses a signing algorithm to sign the message. The message and the signature are
sent to the receiver.
The receiver receives the message and the signature and applies the verifying algorithm to
the combination.
If the result is true, the message is accepted; otherwise, it is rejected.
In a digital signature, the signer uses her private key, applied to a signing algo rithm, to sign
the document.
The verifier, on the other hand, uses the public key of the signer, applied to the verifying
algorithm, to verify the document.
A digital signature uses the private and public keys of the sender.
The sender can sign the message digest and the receiver can verify the message digest.
Key Generation:
Alice creates a signature out of the message using her private exponent,
S = M mod n
Verifying:
Bob receives M and S. Bob applies Alice’s public exponent to the signature to create a copy
of the message
M′ = S ^e mod n.
Bob compares the value of M′ with the value of M. If the two values are congruent, Bob
accepts the message.
Key Generation:
Signing:
Verifying:
SYMMETRIC-KEY DISTRIBUTION
Key-Distribution Center: KDC:
key-distribution center (KDC) is a trusted third party, each person establishes a shared
secret
key with the KDC,
A secret key is established between the KDC and each member
Alice has a secret key with the KDC, which we refer to as KAlice; Bob has a secret
key with the KDC,
which we refer to as KBob; and so on.
How Alice can send a confidential message to Bob. The process is as follows:
1) Alice sends a request to the KDC stating that she needs a session (temporary) secret
key between herself and Bob.
2) The KDC informs Bob about Alice’s request.
3) If Bob agrees, a session key is created between the two.
Session Keys:
A KDC creates a secret key for each member. This secret key can be used only between
the member and the KDC, not between two members. If Alice needs to communicate
secretly with Bob, she needs a secret key between herself and Bob. A KDC can create a
session key between Alice and Bob, using their keys with the center. The keys of Alice
and Bob are used to authenticate Alice and Bob to the center and to each other before
the session key is established.
Used:
UNIX/Linux systems
Servers:
Operation
A client process (Alice) can access a process running on the real server (Bob) in six
steps,
Alice sends her request to the AS in plain text using her registered identity.
The AS sends a message encrypted with Alice’s permanent symmetric key, K A-
AS.The message contains two items: a session key, K A-TGS, that is used by Alice
tocontact the TGS.
Alice now sends three items to the TGS. The first is the ticket received from
theAS. The second is the name of the real server (Bob), the third is a timestamp
that is encrypted by KA-TGS.
Now, the TGS sends two tickets, each containing the session key between
Aliceand Bob, KA-B. The ticket for Alice is encrypted with KA-TGS; the ticket forBob
is encrypted with Bob’s key, KTGS-B.
Alice sends Bob’s ticket with the timestamp encrypted by K A-B.
Bob confirms the receipt by adding 1 to the timestamp The message is encrypted
with KA-B and sent to Alice.
EXAMPLE:
Assume that g = 7 and p = 23.