BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography Uses two keys for every simplex logical...

28
BASIC CRYPTOGRAPHIC CONCEPTS

Transcript of BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography Uses two keys for every simplex logical...

Page 1: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

BASIC CRYPTOGRAPHIC CONCEPTS

Page 2: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Public Key Cryptography

Uses two keys for every simplex logical communication link. Public key Private key

The use of two keys has profound consequences in the areas of Confidentiality Key distribution Authentication

Page 3: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Basic ingredients of the scheme: Plaintext (P)

Message to be encrypted Public Key (KU) and Private Key (KR)

One with the sender and other with the receiver Ciphertext (C)

Message after encryption Encryption algorithm (EA)

Uses P and KU Decryption algorithm (DA)

Uses C and KR

Page 4: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Illustration :: Encryption

EA DA

B’s public keyKUB

B’s private keyKRB

BA

PlaintextP

PlaintextP

CiphertextC

Page 5: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Key Usage for Encryption

Private key of B KRB

Public key of B KUB

Page 6: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Illustration :: Authentication

EA DA

A’s private keyKRA

A’s public keyKUA

BA

PlaintextP

PlaintextP

CiphertextC

Page 7: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Key Usage for Authentication

Private key of A KRA

Public key of A KUA

Page 8: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Applications

Three categories: Encryption/decryption:

The sender encrypts a message with the recipient’s public key.

Digital signature / authentication: The sender signs a message with its private

key. Key exchange:

Two sides cooperate to exchange a session key.

Page 9: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Requirements

Computationally easy for a party B to generate a key pair Public key KUB Private key KRB

Easy for sender to generate ciphertextC = E (M, KUB )

Easy for receiver to decrypt ciphertext using private key:

M = D(C, KRB ) = D(E (M, KUB ), KRB )

Page 10: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Computationally infeasible to determine KRB knowing KUB.

Computationally infeasible to recover message M, knowing KUB and ciphertext C.

Either of the two keys can be used for encryption, with the other used for decryption:M = D (E (M, KUB ), KRB)= D ( E (M, KRB),

KUB)

Page 11: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

The RSA Public Key Algorithm RSA Algorithm

Developed by Ron Rivest, Adi Shamir and Len Adleman at MIT, in 1977.

A block cipher. Not fixed size

The most widely implemented.

Page 12: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

RSA : Key Generation

1. Select p,q p and q both prime2. Calculate n = p × q3. Calculate ɸ(n) = (p-1)(q-1)4. Select integer e gcd(ɸ(n),e) =1 ; 1<e< ɸ(n)5. Calculate d de=1 mod ɸ(n)6. Public Key KU={e, n}7. Private Key KR={d, n}

ɸ(n) is the number of positive number less than n and relatively prime to n (called Euler totient).

Page 13: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

RSA : Encryption

Plaintext M < n Ciphertext C = Me (mod n)

Page 14: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

RSA : Decryption

Ciphertext C Pliantext M= Cd (mod n)

Page 15: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Example

Select two prime numbers, p=7 and q=17. Calculate n=pq= 7× 17 = 119. Calculate ɸ(n) = (p-1)(q-1) =96. Select e such that e is relatively prime to

ɸ(n)=96, and less than ɸ(n). In this case, e=5.

Determine d such that de = 1 mod 96 and d<96. D=77, because 77 × 5 = 385 = 4 ×96 + 1.

Public key KU = {5, 119} Private key KR={77, 119}

Page 16: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Encryption process: Say, plaintext M = 19. Ciphertext C= 195 mod 119

= 2476099 mod 119 = 66

Decryption process: M = 6677 mod 119 = 19.

Page 17: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

The security of RSA

RSA is secure since We use large number of bits in e and d. The problem of factoring n into two prime

factors is computationally very difficult. Knowing p and q will allow us to know ɸ(n). This will help an intruder to know the values of

e and d. Key sizes in the range of 1024 to 2048 bits

seems safe

Page 18: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Until recently, this was felt to be infeasible for numbers in the range of 100 decimal digits or so (approximately 300 bit).

A worldwide team cooperating over the internet and using 1600 computers recently cracked the code in eight months.

Currently, a 1024-bit key size (about 300 decimal digits) is considered strong enough for virtually all applications.

Page 19: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Diffie-Hellman Key Exchange Proposed in 1976. Allows group of users to agree on secret

key over insecure channel. Cannot be used to encrypt and decrypt

messages. Depends for its effectiveness on the

difficulty of computing discrete logarithms.

Page 20: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

D-H Algorithm

A and B want to agree on secret key. They agree on two large numbers n and g,

such that 1<g<n. A choose random x, computes X=gx mod n,

and sends X to B. B chooses random y, computes Y=gy mod n,

and sends Y to A. A computes k1 =Yx mod n. B computes k2 =Xy mod n.

Note: k1 =k2 = gxy mod n.

Page 21: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

A B

Choose x Choose y

Compute Yx mod n Compute Xy mod n

X = gx mod n

Y = gy mod n

Page 22: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

D-H Algorithm

Requires no prior communication between A and B.

Security depends on difficulty of computing x, given X = gx mod n.

Choices for g and n are critical. Both n and (n-1)/2 should be prime. n should be large.

Susceptible to intruder-in-the-middle (man-in-the-middle) attack. Active intruder.

Page 23: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Man-in-the-Middle Attack

Intruder

BA

Page 24: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

A Comparison

Symmetric encryption/decryption is much faster than asymmetric encryption/decryption:

RSA: kilobits/secondDES: megabits/second

DES is about 100 times faster than RSA Key size:

RSA: selected by user DES: 56 bits

Page 25: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Message Authentication

Page 26: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Various Approaches

Authentication using conventional encryption. Only the sender and receiver should share a key.

Message authentication without message encryption.

An authentication tag is generated and appended to each message.

Message authentication code. Calculate the MAC as a function of the message and

key: MAC = F(K,M)

Page 27: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

MESSAGE

MESSAGE

MESSAGEMAC

MACAlgorith

m

MACAlgorith

m

=?

Transmit

MAC

K

K

Page 28: BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.

Commonly Used Schemes

The MD family MD2, MD4 and MD5 (128-bit hash).

The SHA family SHA-1 (160-bit), SHA-256 (256-bit), SHA-

384 (384-bit) and SHA-512 (512-bit). RIPEMD-128 (128-bit), RIPEMD-160 (160-

bit).