CNS R20 Unit 4
CNS R20 Unit 4
CNS R20 Unit 4
Message Integrity and Message Authentication, Cryptographic Hash Functions, Digital Signature, Key
Management.
Message Integrity and Message Authentication:
The cryptography systems that we have studied so far provide secrecy, or confidentiality, but not
integrity. However, there are occasions where we may not even need secrecy but instead must have
integrity.
Cryptographic Hash Function Criteria: A cryptographic hash function must satisfy three criteria: preimage
resistance, second preimage resistance, and collision resistance.
Cryptography and Network Security M. PALLAVI, Asst. Prof, VIEW
For a hash value h=H(x), we say that is the preimage of h. That is, is a data block whose hash function, using
the function H, is h. Because H is a many-to-one mapping, for any given hash value, there will in general be
multiple pre images. A collision occurs if we have x!=y and H(x)=H(y). Because we are using hash functions
for data integrity, collisions are clearly undesirable.
Pre-Image Resistance
This property means that it should be computationally hard to reverse a hash function.
In other words, if a hash function h produced a hash value z, then it should be a difficult process to find
any input value x that hashes to z.
This property protects against an attacker who only has a hash value and is trying to find the input.
Collision Resistance
This property means it should be hard to find two different inputs of any length that result in the same
hash. This property is also referred to as collision free hash function.
Assume an oracle with a table and a fair coin. The table has two columns.
a. The message AB1234CD8765BDAD is given for digest calculation. The oracle checks its table. This
message is not in the table, oracle flips its coin 16 times. Assume the result HHTHHHTTHTHHTTTH, in
which H represents heads as a bit-1 and T represents Tail as a bit-0 and gives 1101110010110001 in
binary, or DCB1 in Hexadecimal, as the message digest.
b. The message 4523AB1352CDEF45126 is given for digest calculation. The oracle checks its table and finds
that there is a digest for this message in the table (first row). The oracle simply gives the corresponding
digest (13AB).
MESSAGE AUTHENTICATION:
A message digest guarantees the integrity of a message. A message digest does not authenticate the sender
of the message. To provide message authentication, Alice needs to provide proof that it is Alice sending the
message and not an impostor. The digest created by a cryptographic hash function is normally called a
modification detection code (MDC). What we need for message authentication is a message authentication
code (MAC).
A modification detection code (MDC) is a message digest that can prove the integrity of the message: that
message has not been changed. 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.
Nested MAC:
HMAC ALGORITHM:
CMAC Algorithm:
Hash functions are extremely useful and appear in almost all information security applications.
A hash function is a mathematical function that converts a numerical input value into another
compressed numerical value. The input to the hash function is of arbitrary length but output is always
of fixed length.
A hash function H accepts a variable-length block of data M as input and produces a fixed-size hash
value h=H(M).
Values returned by a hash function are called message digest or simply hash values.
The kind of hash function needed for security applications is referred to as a cryptographic hash
function.
A cryptographic hash function is an algorithm for which it is computationally infeasible (because no
attack is significantly more efficient than brute force) to find either
(a) a data object that maps to a pre-specified hash result (the one-way property) or
Merkle-Damgard Scheme: The Merkle-Damgard Scheme is an iterated hash function that is collision
resistant if the compression function is collision resistant.
Middle attack.
Matyas-Meyer-Oseas Scheme:
Miyaguchi-Preneel Scheme:
Family of SHA comprise of four SHA algorithms; SHA-0, SHA-1, SHA-2, and SHA-3 Though from same family,
there are structurally different.
The original version is SHA-0, a 160-bit hash function, was published by the National Institute of
Standards and Technology (NIST) in 1993. It had few weaknesses and did not become very popular.
Later in 1995, SHA-1 was designed to correct alleged weaknesses of SHA-0.
SHA-512 Logic:
The algorithm takes as input a message with a maximum length of less than 2128 bits and produces as
output a 512-bit message digest. The input is processed in 1024-bit blocks. The following Figure depicts the
overall processing of a message to produce a digest. The processing consists of the following steps.
Step 1 Append padding bits. The message is padded so that its length is congruent to 896 modulo 1024.
Padding is always added even if the message is already of the desired length. Thus, the number of padding
bits is in the range of 1 to 1024. The padding consists of a single 1 bit followed by the necessary number of
0 bits.
Step 2 Append length. A block of 128 bits is appended to the message. This block is treated as an unsigned
128-bit integer (most significant byte first) and contains the length of the original message (before the
padding). The outcome of the first two steps yields a message that is an integer multiple of 1024 bits in
length. In Figure, the expanded message is represented as the sequence of 1024-bit blocks M1,M2, MN, so
that the total length of the expanded message is N X 1024 bits .
The heart of the algorithm is a module that consists of 80 rounds; The logic is illustrated in Figure 11.9.
th
Step 5 Output. After all N 1024-bit blocks have been processed, the output from the N stage is the 512-
bit message digest.
It remains to indicate how the 64-bit word values Wt are derived from the 1024-bit message. Figure 11.11
llustrates the mapping. The first 16 values of Wt are taken directly from the 16 words of the current block.
Whirlpool is an iterated cryptographic hash function, based on the Miyaguchi-Preneel scheme, that uses a
symmetric-key block cipher in place of the compression function.
Created by Vincent Rijmen and Paulo S. L. M. Barreto.
Hashes messages of plaintext length 2^256
Result is a 512 bit message
Three versions have been released – WHIRLPOOL-0 – WHIRLPOOL-T – WHIRLPOOL
designed specifically for hash function use
with security and efficiency of AES
but with 512-bit block size and hence hash
similar structure & functions as AES but Input is mapped row wise, Has 10 rounds, A
different primitive polynomial for GF(2^8), Uses different S-box design & values.
“W” is a 512-bit block cipher ,“m” is the plaintext, split into 512 bit blocks ,“H” is the blocks formed
from the hashes.
Each round uses four transformations. The block cipher W is the core element of the Whirlpool hash
function
It is comprised of 4 steps.
–Add Round Key
– Shift Columns
– Mix Rows
– Substitute bytes
Substitute bytes:
Add Round Key
During the Add Round Key step, the message is XOR’d with the key
If this is the first message block being run through, the key is a block of all zeros
If this is any block except the first, the key is the digest of the previous block
Shift Columns
Mix Rows
DIGITAL SIGNATURE:
A person signs a document to show that it originated from him or was approved by him.
The signature is proof to the recipient that the document comes from the correct entity and nobody
else. A sign of authentication: A verified signature on a document. A message can be signed
electronically.
The electronic signature can prove the authenticity of the sender of the message - 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.
Attack Types:
Forgery Types:
Existential Forgery: Existential forgery is the creation (by an adversary) of any message/signature pair (m,σ),
where σ was not produced by the legitimate signer.
Selective Forgery: Selective forgery is the creation (by an adversary) of a message/signature pair (m,σ) where m
has been chosen by the adversary prior to the attack.
Blind Signatures
Sometimes we have a document that we want to get signed without revealing the contents of the
document to the signer.
Key Management
Symmetric-key Distribution
Symmetric-key cryptography is more efficient than asymmetric-key cryptography for enciphering
large messages. Symmetric-key cryptography, however, needs a shared secret key between two
parties.
If Alice wants to exchange messages with N people, she needs N different symmetric (secret) keys.
If N people need to communicate with each other, a total of N(N-1)/2 keys would be needed
assuming a single key is used in both directions of communications between a pair of people. This is
normally referred to as the N^2 problem.
The distribution of keys is another problem. We need an efficient and reliable (trusted) way to
maintain and distribute secret keys.
Key-Distribution Center: KDC
A Trusted Third party, reffered to as a Key-Distribution Center. Each person establishes a shared key with
the Key-distribution center (KDC).
The procedure to get a session key between Alice and Bob is as follows
Alice sends a request to KDC stating that she needs a session (temporary) secret key between
herself and Bob. Alice uses her secret key with the KDC to authenticate her request and herself to
the KDC.
The KDC informs Bob about Alice’s request.
If Bob agrees and authenticates himself using his secret key with the KDC, a session key is created
between the two.
Flat Multiple KDCs.
When the number of people using a KDC increases, the system becomes unmanageable. To solve this
problem, we divide the community into domains. Each domain has one KDC (or more if redundancy is
desired for fault tolerance). If Alice is in one domain and Bob is in another domain, Alice contacts her KDC
which in turn contacts the KDC in Bob’s domain. The two KDC’s can create a secret key between Alice and
Bob. This system is called Flat multiple KDCs.
Session Keys
The secret key established between the KDC and a member can be used only between that member
and the KDC, not between two members.
The KDC can help two members (after authenticating their secret key with the KDC) establish a
temporary key that can be used by the two members for a single session. After communication is
terminated, the session key becomes invalid.
A session symmetric key between two parties is used only once.
1. Alice sends a plaintext message to KDC to request a symmetric session key between herself and Bob.
2. The KDC creates a ticket encrypted using Bob’s key KB containing the session key. The ticket and the
session key are sent to Alice in a message encrypted using Alice’s key KA. Alice decrypts the message
and retrieves the session key and Bob’s ticket.
3. Alice sends the ticket to Bob who opens (decrypts) the ticket and obtains the value of the session key.
Needham-Schroeder Protocol
1. Alice sends a message to KDC that includes her nonce R, her identity, and bob’s identity.
2. The KDC sends an encrypted message to Alice that includes Alice’s nonce, the session key, and an
encrypted ticket to B that includes the session key. The ticket is encrypted using Bob’s key and the
whole message is encrypted using Alice’s key.
3. Alice sends the ticket to Bob.
4. Bob decrypts the ticket and sends his challenge RB encrypted to Alice with the session key.
5. Alice responds by sending to Bob the encrypted value RB-1 (rather than RB to prevent replay attacks).
Otway-Rees Protocol:
KERBEROS:
Kerberos is an authentication protocol, and at the same time a KDC that has become very popular
Several connected. In a backbone network, no station is directly connected to the backbone; the
stations are KDC, popular. systems, including Windows 2000, use Kerberos. Originally designed at
MIT, it has gone through several versions.
Kerberos has separated user verification from the process of issuing tickets that allow the user to
access different servers. Kerberos is designed to support client-server applications, such as FTP, in
which the client process at the user site communicates with the server process at the server site.
Kerberos Servers:
Authentication Server (AS): is the KDC in the Kerberos protocol. Each user registers with AS and is granted
a user ID and password.
Ticket-Granting Server (TGS): issues a ticket for the real server (Bob). It also provides the session key (KAB)
between the user and the real server.
Real Server (Bob) provides services for the user (Alice).
Operation:
The client process (Alice) can access the real server process (Bob) in six steps
1. Alice sends her request to AS in plaintext.
2. The AS sends a message encrypted with Alice’s key K A-AS. The message contains a session key KA-TGS
that will be used by Alice to contact TGS and a ticket for TGS encrypted using TGS’s key K AS-TGS.
When the message arrives, Alice types her password which is used by the client process to create
KA-AS, then decrypt the message to extract the session key and the ticket.
3. Alice sends three items to TGS: the ticket from AS, the name of the real server (Bob), and a
timestamp encrypted with KA-TGS.
4. TGS sends to Alice two tickets both containing the session key K A-B and Bob Alice’s encrypted with
the session between Alice Bob. Alice s ticket is key K A-TGS and Bob’s ticket is encrypted with Bob’s
password/key KTGS_B.
5. Alice sends Bob’s ticket with the timestamp encrypted with KA-B.
6. Bob responds by subtracting 1 from the timestamp and encrypts the response with KA-B.
PUBLIC-KEY DISTRIBUTION:
In asymmetric-key cryptography, people do not need to know a symmetric shared key; everyone shields a
private key and advertises a public key.
Public Announcement
Bob makes his public key available on
his web site. Alice can get Bob’s public
key by accessing Bob’s site or sending
email to him. This method is simple but
is not secure and is subject to forgery.
Trusted Center
The trusted center retains and updates a
directory of public keys. Each user must
register with the trusted center and establish
a user ID and password. The
user can then deliver his/her public key
for insertion into the directory.
The center can publicly advertise the
Certification Authority:
Security certificates are used to reduce the load on trusted centers.
A server (Bob) can request a certificate from a certification authority (CA), which could be a cross-
certified company or state or federal organization. Bob’s request contains his identification and his
public key.
The CA checks the identification of Bob. If verified, the CA writes Bob’s public key on the certificate
and signs it with its own private key.
Bob can now upload the signed certificate and store it on his site or Bob may send the certificate to
users upon request.
Any user who wants Bob’s public key can download the certificate and decrypts it using the CA’s
public key to extract Bob’s public key.
The Internet community has accepted the ITU-T*recommendation X.509 as a way to unify certificate
formats. In X.509, the certificate has the following important fields:
Version number: this field is the version of X.509 (current version is 3).
Serial number: this field is the serial number assigned to each certificate and is unique for each certificate
issuer.
Signature algorithm ID: this field identifies the signature algorithm used in the certificate. This field is
repeated in the signature field.
Issuer name: this field identifies the CA that issued the certificate.
Validity Period: this field defines the earliest (not before) time and the latest (not after) time during which
the certificate is valid.
Subject name: this field defines the entity that owns the public key stored in this certificate.
Subject public key: this field gives the value of the public key of the owner of the certificate and defines the
public key algorithm.
Signature: this field contains the digest of all other fields in the certificate encrypted by the CA’s private
key, and also contains the ID of the signature algorithm.
* ITU-T = International Telecommunication Union- Telecommunication Standardization Sector
Certificate Renewal
Each certificate has a period of validity. If there is no problem with the certificate, the CA issues a new
certificate before the old one expires.
Certificate Revocation
In some cases a certificate must be revoked before its expiration (e.g., the private key of the subject or of
the CA has been compromised). The revocation is done by periodically issuing a certificate revocation list
(CRL) that contains all revoked certificates that have not expired on the date the CRL is issued. To ensure
the validity of a certificate, the user must check the latest CRL published by the CA that issued the
certificate.
Delta Revocation
To make revocation more efficient, the delta certificate revocation list (delta CRL) has been introduced.
Example:
User1 knows only the public key of the root CA. Show how can User1 obtain a verified copy of User3’s
public key.
Solution User3 sends a chain of certificates, CA<<CA1>> and CA1<<User3>>, to User1.
a. User1 validates CA<<CA1>> using the public key of CA.
b. User1 extracts the public key of CA1 from CA<<CA1>>.
c. User1 validates CA1<<User3>> using the public key of CA1.
d. User1 extracts the public key of User 3 from CA1<<User3>>.
Users1 has used the following chain CA<<CA1>> CA1<<User3>>
REVOCATION OF CERTIFICATES
Each certificate includes a period of validity, much like a credit card. Typically, a new certificate is issued
just before the expiration of the old one-for one of the following reasons.
1. The user’s private key is assumed to be compromised.
2. The user is no longer certified by this CA. Reasons for this include that the subject’s name has changed,
the certificate is superseded, or the certificate was not issued in conformance with the CA’s policies.
3. The CA’s certificate is assumed to be compromised.
Each certificate revocation list (CRL) posted to the directory is signed by the issuer and includes the issuer’s
name, the date the list was created, the date the next CRL is scheduled to be issued, and an entry for each
revoked certificate. Each entry consists of the serial number of a certificate and revocation date for that
certificate. Because serial numbers are unique within a CA, the serial number is sufficient to identify the
certificate.
The directory entry for each CA includes two types of certificates:
• Forward certificates: Certificates of X generated by other CAs
• Reverse certificates: Certificates generated by X that are the certificates of other CAs
The following figure is an example of CA hierarchy.
In this example, user A can acquire the following certificates from the directory to establish a certification
path to B:
When A has obtained these certificates, it can unwrap the certification path in sequence to recover a
trusted copy of B’s public key. Using this public key, A can send encrypted messages to B. If A wishes to
receive encrypted messages back from B, or to sign messages sent to B, then B will require A’s public key,
which can be obtained from the following certification path:
B can obtain this set of certificates from the directory, or A can provide them as part of its initial message
to B.