2 Intro Crypto
2 Intro Crypto
Lecture 2:
The Elements of Cryptography I
Secure Communication
Confidentiality
Authentication
Message Integrity
Anti-Replay
Anti Replay Protection
Client PC with Anti-Delay Protection
Server with
Cryptographic Cryptographic
System Provided
P id d System
Software Automatically Software
Key Length
Number of Possible Keys
in Bits
1 2
2 4
4 16
8 256
16 65,536
40 1,099,511,627,776
56 72,057,594,037,927,900
112 5,192,296,858,534,830,000,000,000,000,000,000
6 (c) Prof. Ehab Al-Shaer, UNCC
Key Length and Number of Possible
Keys
Key Length
Number of Possible Keys
in Bits
112 5.1923E+33
168 3.74144E+50
256 1.15792E+77
512 1.3408E+154
• Key Secrecy:
9Security depends on the secrecy of the key, and not the secrecy of the algorithm.
Key Size No of Alt Keys Time Req @ 106 Decryption/µs
Symmetric
y Keyy Encryption
yp ((Secret Key)
y)
Public Key Encryption
DES E
Encryption
ti
Process
64-Bit Ciphertext
Block
12 (c) Prof. Ehab Al-Shaer, UNCC
Model of Conventional Encryption
Process
• An encryption scheme has 5
major
j components:t
9(4) Transmitted
T itt d Ciphertext
Ci h t t
DES Key
K
Initialization DES Encryption Second
Vector (IV) Process 64-Bit Plaintext Block
Second
64-Bit Ciphertext Block
14 (c) Prof. Ehab Al-Shaer, UNCC
Triple DES (3DES)
168 Bit Encr
168-Bit Encryption
ption with
ith Three 56
56-Bit
Bit Ke
Keys
s
Sender Receiver
Sender Receiver
Sender Receiver
Encrypts
yp pplaintext with Decrypts
yp ciphertext
p with
the key the key
Processing
Moderate High Modest
Requirements
Encrypted
Encrypt with Decrypt with
Message
Party B’s
B s Public Key Party B’s
B s Private Key
Party A Party B
Decryptt with
D ith Encryptt with
E ith
Party A’s Private Key Encrypted Party A’s Public Key
Message
•Three Categories:
yp / yp
9Encryption/Decryption: Sender encrypts
yp a message
g
with the recipient’s public key.
9Key y Exchange:
g Two sides cooperate
p two exhange
g a
session key.
25 (c) Prof. Ehab Al-Shaer, UNCC
Mi
Misconceptions
ti about
b t PK E
Encryption
ti
•Authentication
A h i i Requirements:
R i
9 Requirements - must be able to verify that:
-Message came from apparent source or author,
- Contents have not been altered,
- Sometimes,
Sometimes it was sent at a certain time or sequence.
sequence
Output is of a fixed
Length of Output is (variable)
short length,
Result similar in length to input
regardless of input
•Algorithm:
Al ith
9Check that provides data against modification.
9 h value
9Hash l is generated
d by
b ffunction: h = H(M)
( )
-M = Variable length message
-H(M) = Fixed length hash value
9Hash value is appended to the message at the source at a
time when the message is assumed to known to be correct.
correct
9Receiver Authenticates the message by re-computing the
hash value.
[i it Confidential?
[is C fid ti l? How?]
H ?]
Challenge
g
2.
Applicant Verifier sends Challenge Message Verifier
V ifi
(Client) (This is sent to avoid/detect spoofing)
(Server)
3.
3
Applicant (Supplicant) Password Challenge
creates a Response Message:
(a) Adds password to g
Hashing
Challenge Message (Not Encryption)
(b) Hashes the resultant bit
string (does not encrypt)
Response
espo se
( ) Th
(c) The hhashh iis th
the R
Response
Message
4.
Applicant sends Response Message without encryption
Transmitted Response
Password Challenge 5.
Verifier adds password to the
Hashing Challenge Message it sent.
Hashes the combination. This
is the expected Response
Expected Response
Message.
6.
If the two Response Messages are equal, the
applicant knows the password and is authenticated.
Sever logs Client in.
7.
Note that only hashing is involved. There is no encryption.
Done only at the initiation of a session
session. Is this enough?
46
9Public-key Encryption: Confidentiality, Authentication
(c) Prof. Ehab Al-Shaer, UNCC
and Signature
Authentication with Public-keys
( confidentiality)
(no fid ti lit )
•Authentication
Authentication Process:
9(1) Bob prepares a message
to Alice and encrypts the
message using his private
key.
9(2) Alice decrypts Bob
Bob’ss
message by using his Public-
key.
9 (3) Since the message was
encrypted using the sender’s
private key,
p y, only
y the sender
could have sent this message.
47 (c) Prof. Ehab Al-Shaer, UNCC
Ensuring Both Encryption and
A th ti ti
Authentication
• Question:
9Given the two preceding processes, how are you
able to ensure for both Encryption and
Authentication?
• Solution:
9 Encrypt first (using sender private key) ,
followed byy the signature
g
9Signature first has the advantage that the
signature can be verified by parties other than
th Recipient.
the R i i t
48 (c) Prof. Ehab Al-Shaer, UNCC
Digital Signature for Message-by-
M
Messageg A Authentication
th ti ti
DS Plaintext
Field Description
Version
V i Version
V i number b off th
the X
X.509.
509 Most
M t certificates
tifi t
Number follow Version 3. Different versions have
different fields. This figure reflects the
Version 3 standard
standard.
Field Description
Public
P bli K
Key The algorithm
Th l ith the th subject
bj t uses tto sign
i messages
Algorithm with digital signatures.
Field Description
Field Description
Digital
g Certificate Digital
g Signature
g
Public Key
y of Signature
g to Be
True Party + Tested with
Public Key of
True Party
Authentication
3.
Request Certificate 7. Copy of CRL
for Lee
4. 5.
Create & Certificate
Certificate
Distribute for Lee
f Lee
for L
(1) Private Key
and
Verifier ((2)) Digital
g Certificate Applicant (Lee)
(Brown)
59 (c) Prof. Ehab Al-Shaer, UNCC
Key Distribution for Symmetric
Session Key
Public Key Distribution
Diffie Hellman Key Agreement
Diffie-Hellman
1. Create
Symmetric
Session Key
Party A Party B
Party A Party B
Party X Party Y
2. 2.
Generates Generates
Random Random
Number x Number y
Party X Party Y
3. 3.
Computes Computes
xx’=g^x
g x mod p 4.
Exchange x’ and y’ yy’=g^y
=g^y mod p
Without Security
•RSA:
•RSA
9Proposed in 1976, and is the first public key
algorithm
l h ((predates
d RSA))
p
9Purpose of the algorithm
g is to enable two
users to exchange a key securely over a
potentially insecure channel.
9Limited to the exchange of keys, I.e. can not
be used for en-/de-cryption.
Party X Party Y
5.
5 5.
5
Compute Key= Compute Key=
y’^x mod p x’^yy mod p
=g^(xy)
^( ) moddp 6 Subsequent
6. S b tEEncryption
ti =g^(xy) mod p
with Symmetric
Session Keyy
Applicable. Sender
Applicable
Public
P bli Applicable.
A li bl S Sender
d
encrypts with receiver’s
Key encrypts with own
public key.
Encryption private key.
Applicable. Used in
Hashing Not applicable. MS-CHAP and
HMACs discussed in the
next chapter.
71 (c) Prof. Ehab Al-Shaer, UNCC
Delay Attacks: Impact and Solution
y Delaying
y g messages
g is dangerous
g for real-time control application
pp
(biding, military, alarms)
y Algorithm
y Server learns the client Actual Time (Ct) and calculates the offset = St – Ct
y Every time the client sends a msg, it includes the timestampe (Cts)
y When the server receives the message at time T, it calculates the time in the
server bbasedd on th
the client
li t clock
l k when
h ththe message iis received
i d as ffollows:
ll
y St = Cts + offset
y The server if | T – St | > threashold Î the message
g was delayed
y (action:
(
ignore or ..)
y Threshold should be > RTT/2 + alph
Phase 2:
Client PC Mutual Authentication Server
Phase 3:
Key Exchange or
Key Agreement
73
Cryptographic System
Phase 4:
Ongoing Communication with
Message-by-Message
Confidentiality, Authentication,
and Message Integrity
Client PC
Server
{ Privacy/confidentiality,
Privacy/confidentiality and
74 { Key exchange mechanism
Major Cryptographic Systems
Layer Cryptographic System
Application Kerberos
T
Transport
t SSL/TLS
Internet IPsec
76
SSL/TLS
y History
y invented by Netscape then by Microsoft!
y SSL leads IETF to standardize TLS
y widely used in browsers today
y Architecture
y not transparent
y client & server-aware secure socket API:
y ssl_connect( ); ssl_accept( ) .. etc
77
SSL/TLS Operation
Applicant Verifier
(Customer Client) ((Merchant Server))
Protects All Application Traffic
That is SSL/TLS-Aware
78
SSL/TLS Operation
Applicant Verifier
(Customer Client) (Merchant Server)
79
SSL/TLS Operation
Applicant Verifier
(Customer Client) (Merchant Server)
80
Perspective on SSL/TLS
y Useful if Connection Will be Limited to Web services
y SSL/TLS is built into all browsers and webservers
y Provides only medium security, but exploitation is difficult
((why?)
h ?)
y In VPNs, clients can be required to have digital certificates,
raising the security of SSL/TLS considerably
81