CO-1 ppt 3
CO-1 ppt 3
CO-1 ppt 3
COURSE TITLE:
INTRODUCTION TO BLOCKCHAIN & CRYPTO CURRENCIES
COURSE CODE:
23CS3045RB
AIM OF THE
SESSION
To familiarize students with the basic concepts of Cryptography
INSTRUCTIONAL
OBJECTIVES
This Session is designed to:
Demonstrate Principles of various Cryptographic Technique
LEARNING OUTCOMES
Decryption
Encryption
5
PUBLIC KEY CRYPTOGRAPHY EARLY
HISTORY
• Features
• Each user has two keys (a public key and a private key)
• The algorithm is public knowledge.
• Knowledge of the algorithm does not help an attacker.
• Public-key encryption was proposed in 1970 by James Ellis
• in a classified paper made public in 1997 by the British
Governmental Communications Headquarters
• Concept of digital signature is still originally due to Diffie &
Hellman.
DIFFIE-HELLMAN PROTOCOL
• Alice and Bob never met and share no secrets
• Public info: p and g
• p is a large prime number, g is a generator of Zp*
• Zp*={1, 2 … p-1}; aZp* i such that a=gi mod p
• guarantees security.
• Also implies the need for computationally hard problems.
NUMBER THEORY STUFF
• Prime Numbers
• Integers that have no positive factors except themselves and 1.
• Composite Numbers
• Integers that have at least one non-trivial factor except themselves and 1.
• Co-prime or Relatively Prime
• Two integers a and b are co-prime iff GCD(a, b)=1.
11
MORE NUMBER THEORY
• Euler’s Totient function
• ɸ(n) = Count of numbers < n that are co-prime to n
• If n is prime
• ɸ(n) = n-1
• Euler’s Theorem
• Given a number n, ∀a ∈ {1, 2, 3,…., n-1}
• GCD(a, n)=1 => aɸ(n) mod n = 1
12
SOME NUMBER THEORY FACTS
• Euler totient function (n) where n1 is the number of integers in the
[1,n] interval that are relatively prime to n
• Two numbers are relatively prime if their greatest common divisor (gcd) is 1
• Euler’s theorem:
public
key
private
public ? key
key
Alice Bob
Given: Everybody knows Bob’s public key
• Encryption: given plaintext M and public key PK, easy to compute ciphertext
C=EPK(M)
• Decryption: given ciphertext C=EPK(M) and private key SK, easy to compute
plaintext M
• Infeasible to learn anything about M from C without S K
slide 15
APPLICATIONS OF PUBLIC-KEY CRYPTO
• Encryption for confidentiality
• Anyone can encrypt a message
• With symmetric crypto, must know the secret key to encrypt
• Only someone who knows the private key can decrypt
• Secret keys are only stored in one place
slide 20
DISADVANTAGES OF PUBLIC-KEY CRYPTO
• Calculations are 2-3 orders of magnitude slower
• Modular exponentiation is an expensive computation
• Typical usage: use public-key cryptography to establish a shared secret,
then switch to symmetric crypto
• SSL, IPsec, most other systems based on public crypto
• Keys are longer
• 2048 bits (RSA) rather than 128 bits (AES)
• Relies on unproven number-theoretic assumptions
• Factoring, RSA problem, discrete logarithm problem, decisional Diffie-
Hellman problem…
slide 21
RSA
• Invented in 1978 by Ron Rivest, Adi Shamir and
Leonard Adleman
• Published as R L Rivest, A Shamir, L Adleman, "On
Digital Signatures and Public Key Cryptosystems",
Communications of the ACM, vol 21 no 2, pp120-
126, Feb 1978
22
RSA ALGORITHM
d d
c c m = c mod n letter
decrypt:
17 481968572106750915091411825223071697 12 l
RSA: EN/DECRYPTION
• Given (n,e) and (n,d) as computed above
• To encrypt bit pattern, m, compute
c = me mod n (0 < m < n)
• To decrypt received bit pattern, c, compute
m = cd mod n
e d
m = (m mod n) mod n
c
RSA: WHY IS e d
mod n
m = (m mod n)
e d ed
(m mod mod n = m
n) mod (p-1)(q-1)
ed mod n 1
= m mod n = m mod n
(since we chose ed to be divisible b
using number theory result above)
(p-1)(q-1) with remainder 1 )
= m
WHY RSA DECRYPTION WORKS
e
• e is usually chosen to be 3 or 216 + 1 = 65537
• In order to speed up the encryption
• the smaller the number of 1 bits, the better
RSA SECURITY
• Factoring problem: given positive integer n, find primes p1, …, pk such that
n=p1e1p2e2…pkek
Signing message M
• Verify 0 < M < n
• Compute S = Md mod n
Verifying signature S
• Use public key (e, n)
• Compute Se mod n = (Md mod n)e mod n = M
Note: in practice, a hash of the message is signed and not the
message itself.
PRACTICAL SCENARIOS
countermeasures
use constant exponentiation
time
add random delays
blind values used in
calculations
TIMING ATTACKS
• An interactive chosen-ciphertext
attack
• the attacker sends many ciphertexts
to be decrypted by an end-system
• may result in the gradual revelation
of the secret key.
OTHER DECRYPTION ATTACKS ON RSA
Recipient’s Symmetric
private key “session” key
Asymmetric
decryption of Session key
“session” key (e.g. RSA)
Digital envelope must be
contains “session” decrypted using
key encrypted the recipient’s
using recipient’s Digital private key
public key Envelope
Thanks