CO-1 PPT 5
CO-1 PPT 5
COURSE NAME:
INTRODUCTION TO BLOCKCHAIN
& CRYPTO CURRENCIES
COURSE CODE:
22CS2233
AIM OF THE
SESSION
To familiarize students with the basic concepts of Cryptography
INSTRUCTIONAL
OBJECTIVES
This Session is designed to:
Demonstrate Principles of Authentication Cryptography
LEARNING OUTCOMES
Alice’s “I am
IP addressAlice”
Failure scenario??
Trudy can create
a packet “spoofing”
Alice’s address
AUTHENTICATION CASE III
R Failure scenario??
KA-B(R) Alice is live, and
only Alice knows
key to encrypt
nonce, so it must
be Alice!
AUTHENTICATION CASE V
Case IV used shared symmetric key. Can we authenticate using public key
techniques?
R KM -(R)
KA -(R)
“Send me your public key”
KA+ KM +(m)
Trudy gets
- + KA +(m) - +
m = K (K (m)) m = K (K (m))
A A M M
sends m to
Alice
encrypted
with Alice’s
AUTHENTICATION CASE V (CONT.)
Difficult to detect:
Bob receives everything that Alice sends, and
vice versa. (e.g., so Bob, Alice can meet one
week later and recall conversation)
Problem: Trudy receives all messages as well!
AUTHENTICATION THREATS
Issuer
Subject
Subject
Public Key
Issuer
Digital
Signature
CERTIFICATE GENERAL STRUCTURE
DIGITAL SIGNATURE
Cryptographic technique analogous to hand-written signatures
• Sender (Bob) digitally signs document, establishing he is document owner/creator
• Recipient (Alice) can prove to someone that Bob, and no one else (including Alice),
could have signed document
MIC
MIC MIC
MIC MIC
It is critical that a forger cannot compose a different message that would produce the same MIC value.
DIGITAL SIGNATURE AT WORK
Message Message
Digest
Hash Function Digest
Algorithm Hash Function
Algorithm
Digest
Public Key
• Key Generation
• Choose an L-bit prime p, where 512≤L ≤1024, and L is divisible by 64 and 2 L-
1
<p<2L.
• Choose a 160-bit prime q, such that p-1=qz, where z is any natural number.
• Key Generation
• Choose x by some random method, where 0<x<q; this is
user’s private key.
• Calculate y=gx mod p, this s user’s public key.
• Public key is (p,q,g,y) and Private key is x.
DSA SIGNATURE CREATION
• to sign a message M the sender:
• generates a random signature key k, 1<k<q
• k must be random, be destroyed after use, and never be
reused
• then computes signature pair:
r = (gk(mod p))(mod q)
s = (k-1.SHA(M)+ x.r)(mod q)
• sends signature (r,s) with message M
DSA: SIGNING A MESSAGE
r = (gk mod p) mod q
Private
key
Random secret (r,s) is the
between 0 and signature on M
q
Message
Compute
Messag (gH(M’)w yr’w mod q mod p) mod q
e
Signatur
e
w = s’-1 mod q
If they match, signature is
valid
WHY DSA VERIFICATION WORKS
• If (r,s) is a valid signature, then
r (gk mod p) mod q ; s k-1(H(M)+xr) mod q
• Thus H(M) -xr+ks mod q
• Multiply both sides by w=s-1 mod q
• H(M)w + xrw k mod q
• Exponentiate g to both sides
• (gH(M)w + xrw gk) mod p mod q
• In a valid signature, gk mod p mod q = r, gx mod p = y
• Verify gH(M)wyrw r mod p mod q
SECURITY OF DSA
Append length
Append 64 bit length of the original message to the result
step 1.
If original length is greater than 264 only low-order 64 bits
of the length are used. The length of expanded message is
L*512 bits.
No of blocks=L
No of words=N=16*L
SECURE HASH ALGORITHM (SHA-
1)
Output
After all N 512-bit blocks have been
processed;
The output from the stage is the
160-bit message digest.
Addresses
http://gavwood.com/paper.pdf
Ethereum
• Hash with Keccak-256 the public key (64 hex
characters/32 bytes)
• Check here-
https://emn178.github.io/online-tools/keccak_256.ht
ml
http://gavwood.com/paper.pdf
Ethereum
https://www.oreilly.com/library/view/m
astering-ethereum/9781491971932/ch
04.html
• Private key 68
f8f8a2f43c8376ccb0871305060d7b27b0554d2cc72bccf41b27056084
52f315
0x001d3f1ef827552ae1114027bd3ecf1f086ba0f9
sh of the public key, it is important to let the hashing algo know the format is “hex”. See https://leventozturk.com/engine
Bitcoin addresses
• Bitcoin addresses have more steps but the idea is
very similar
https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bi
tcoin_addresses
Bitcoin addresses
1. Start with private ECDSA key
18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725
00010966776006953D5567439E5E39F86A0D273BEE
445C7A8007A93D8733188288BB320A8FE2DEBD2AE1B47F0F50BC10BAE84
5C094
6. Perform SHA-256 on extended
RIPEMD-160
Bitcoin addresses
7. Perform SHA-256 on the previous SHA-256
D61967F63C7DD183914A4AE452C9F6AD5D462CE3D277798075B107615C1A8A30
16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM
This is the bitcoin address.
Bitcoin addresses
75
Bitcoin addresses
Addresses
• https://bitcointalk.org/index.php?topic=78132.0
ACKNOWLEDGEMENTS