CNS Unit3
CNS Unit3
NETWORK SECURITY
UNIT-III PART-01
(Public key cryptography
and
Authentication requirements)
M. Muni Babu
M.Tech, (Ph.D)
Assistant Professor
Dept. of CSE
IIIT R K Valley, RGUKT - AP
CONTENT
• Principles of public key crypto systems
• RSA algorithm - security of RSA
• Key management
• Diffle- Hellman key exchange algorithm
• Introductory idea of Elliptic curve cryptography
• Elgamel encryption
• Message Authentication and Hash Function:
• Authentication requirements and Authentication functions
• Message authentication code
• Hash functions
• Birthday attacks
• Security of hash functions and MACS.
Principles of Public-Key Cryptosystems
• Public-Key Cryptosystems
• Applications for Public-Key Cryptosystems
• Requirements for Public-Key Cryptography
• Public-Key Cryptanalysis
Public-Key Cryptosystems
• Asymmetric algorithms rely on one key for encryption and a different but related key for
decryption.
These algorithms have the following important characteristic.
• It is computationally infeasible to determine the decryption key given only knowledge of the
cryptographic algorithm and the encryption key.
• In addition, some algorithms, such as RSA, also exhibit the following characteristic.
• Either of the two related keys can be used for encryption, with the other used for decryption.
• Public key – Ingredients:
• Plaintext
• Encryption algorithm
• Public and private keys
• Ciphertext
• Decryption algorithm
Public-Key Cryptosystems – Essential Steps
• Essential steps:
1. Each user generates a pair of keys to be used for the encryption and decryption 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
Public-Key Cryptosystems
Public-Key Cryptosystems
Public-Key Cryptosystems – Conventional and Public-Key Encryption
Public-Key Cryptosystems
• There is some source A that produces a message in plaintext, X = [X1, X2, ...,XM]. 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, PUb, and a private key, PRb. PRb is known only to B, whereas PUb is publicly available
and therefore accessible by A.
• With the message X and the encryption key PUb as input, A forms the ciphertext Y =
[Y1, Y2, ..., YN]:
Y = E(PUb, X)
• The intended receiver, in possession of the matching private key, is able to invert the
transformation:
X = D(PRb, Y)
• Figures 9.1b and 9.3 show the use of public-key encryption to provide authentication:
• Y = E(PRa, X)
• X = D(PUa, Y)
Public-Key Cryptosystems – Conventional and Public-Key Encryption
Public-Key Cryptosystems
Public-Key Cryptosystems
Public-Key Cryptosystems - Applications
• Public-key systems are characterized by the use of a cryptographic algorithm with two
keys, one held private and one available publicly.
• Depending on the application, the sender uses either the sender’s private key or the
receiver’s public key, or both, to perform some type of cryptographic function.
• In broad terms, we can classify the use of public-key cryptosystems into three categories
• Encryption /decryption: The sender encrypts a message with the recipient’s public key.
• Digital signature: The sender “signs” a message with its private key. Signing is achieved
by a cryptographic algorithm applied to the message or to a small block of data that is a
function of the message.
• Key exchange: Two sides cooperate to exchange a session key. Several different
approaches are possible, involving the private key(s) of one or both parties.
Public-Key Cryptosystems – Requirements
RSA
ALGORITHM
RSA - Introduction
• The RSA – derived from the last names (Ron Rivest, Adi Shamir, and Leonard
Adleman)of the three mathematicians in 1977.
• Terms:
• Prime: A number is said to be Prime if it is only divisible by 1 and itself. Such as
2,3,5,7,11, 13, 17 and etc.
• Factor: A factor is a number you can multiple to get another number.
• For example, The factors of 12 are – 1, 2, 3, 4, 6, and 12.
• Semi-Factor: A number is Semi-Prime if its only factors are prime (excluding 1 and
itself) for example,
• 12 is not semi-prime – one of its factors is 6, which is not prime.
• 21 is semi-prime – the factors of 21 are 1, 3, 7, 21. If exclude 1 and 21, we are left with 3
and 7, both of which are prime.
• Modulos: 12 MOD 5 – dividing 12 by 5, which results in 2.
RSA - Introduction
• RSA makes use of an expression with exponentials.
• Plaintext is encrypted in blocks, with each block having a binary value less than some
number n. That is, the block size must be less than or equal to log2(n) + 1; in practice, the
block size is i bits, where 2i 6 n ≤ 2i+1.
• Encryption and decryption are of the following form, for some plaintext block M and
cipher text block C.
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 PR = {d, n}.
For this algorithm to be satisfactory for public-key encryption, the following requirements must
be met.
RSA - Introduction
• For this algorithm to be satisfactory for public-key encryption, the following
requirements must be met.
• 1. It is possible to find values of e, d, n such that Med mod n = M for all M < n.
• 2. It is relatively easy to calculate Me mod n and Cd mod n for all values of M < n.
• 3. It is infeasible to determine d given e and n.
• For now, we focus on the first requirement and consider the other questions later. We
need to find a relationship of the form
• Med mod n = M
• The preceding relationship holds if e and d are multiplicative inverses modulo
• φ(n), where φ(n) is the Euler totient function. p, q prime, φ (pq) = (p - 1)(q - 1).
• The relationship between e and d can be expressed as ed mod φ(n) = 1
RSA - Steps
1. Select two prime numbers – P and Q i.e. P=7 and
Q=19
2. Calculate the product – N=P*Q; i.e. N=7*19; N=133
3. Calculate the Totient of N – (P-1) * (Q-1) i.e. (7-
1)*(19-1) = 6*8 = 108
4. Select a Public key
• It must be Prime
• It must be less than the Totient
• It must NOT be a factor of the Totient
5. Select a Private Key
C = Me mod (n=pq)
Plaintext: M Cd mod n Ciphertext: C
• 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
Diffie-Hellman
Key Exchange
Diffie-Hellman Key Exchange
• The first published public-key algorithm that defined public-key cryptography was
published by Diffie and Hellman.
• It is generally referred to as the Diffie –Hellman key exchange.
• A number of commercial products employ this key exchange technique.
• Purpose of the algorithm is to enable two users to exchange a secret key securely that then
can be used for subsequent encryption of messages
• The algorithm itself is limited to the exchange of the keys.
• Depends for its effectiveness on the difficulty of computing discrete logarithms.
Diffie-Hellman Key Exchange - Steps
• Selection of Global Elements
The key exchange protocol is vulnerable to such an attack because it does not
authenticate the participants. This vulnerability can be overcome with the use of digital
signatures and public-key certificates;
Elgamal
Encryption
ElGamal Cryptosystem
• In 1984, T. Elgamal announced a public-key scheme based on discrete
logarithms, closely related to the Diffie-Hellman technique [ELGA84,
ELGA85].
• The ElGamal2 cryptosystem is used in some form in a number of standards
including the digital signature standard (DSS), and the S/MIME e-mail
standard.
• Procedure - Steps
• Global Public Elements
• Key Generation by Alice
• Encryption by Bob with Alice’s Public Key
• Decryption by Alice with Alice’s Private Key
ElGamal Cryptosystem
ElGamal Cryptosystem
ElGamal Cryptosystem
ELLIPTIC CURVE
CRYPTOGRAPHY
Elliptic Curve Cryptography - Introduction
• Most of the products and standards that use public-key cryptography for
encryption and digital signatures use RSA.
• As we have seen, the key length for secure RSA use has increased over recent
years, and this has put a heavier processing load on applications using RSA.
• This burden has ramifications, especially for electronic commerce sites that
conduct large numbers of secure transactions.
• A competing system challenges RSA: elliptic curve cryptography (ECC).
• ECC is showing up in standardization efforts, including the IEEE P1363
Standard for Public-Key Cryptography.
• The principal attraction of ECC, compared to RSA, is that it appears to offer
equal security for a far smaller key size, thereby reducing processing overhead.
• ECC is fundamentally more difficult to explain than either RSA or Diffie-
Hellman.
Elliptic Curve Cryptography - Introduction
• An elliptic curve is defined by an equation in two variables with coefficients.
• ECC offers several benefits compared to RSA:
• It operates on devices with low CPU and memory resources.
• It encrypts and decrypts faster.
• Larger key sizes can be used without significantly increasing the key size or CPU
and memory requirements.
General form of a EC
• An elliptic curve is a plane curve defined by an
equation of the form
y x ax b
2 3
Examples
ECC Diffie-Hellman Key Exchange
ECC Diffie-Hellman Key Exchange
Elliptic Curve Cryptography – Encryption and Decryption
END
MESSAGE AUTHENTICATION
52
MESSAGE SECURITY REQUIREMENTS
53
MESSAGE AUTHENTICATION
55
PUBLIC-KEY MESSAGE ENCRYPTION
• If public-key encryption is used:
• Anyone potentially knows public-key
However if
• Sender signs message using their private-key
• Then encrypts with recipients public key
• Have both secrecy and authentication
• Again need to recognize corrupted messages
• But at cost of two public-key uses on message
56
HASH FUNCTIONS
57
CRYPTOGRAPHIC HASH FUNCTION
58
HASH FUNCTIONS & MESSAGE AUTHENTICATION
59
A
61
C
• Shows the use of a hash function but no encryption for message authentication.
• The technique assumes that the two communicating parties share a common
secret value S.
• A computes the hash value over the concatenation of M and S and appends the
resulting hash value to M.
• Because the secret value itself is not sent, an opponent cannot modify an
intercepted message and cannot generate a false message. 62
D
63
MESSAGE AUTHENTICATION CODE (MAC)
64
Message Authentication Code…
• A small fixed-sized block of data
• Generated from message + secret key
• MAC = C(K,M)
• Appended to message when sent
65
MESSAGE AUTHENTICATION CODES
• Is a many-to-one function
• potentially many messages have same MAC
• but finding these needs to be very difficult
67
3.6 HMAC
3.6.1 HMAC DESIGN OBJECTIVES
Use, without modifications, hash functions
69
3.6.2 HMAC SECURITY
• Proved security of HMAC relates to that of the
underlying hash algorithm