Cryptography and Advanced Computer Security (CENG625)
Cryptography and Advanced Computer Security (CENG625)
Topics Covered
Textbooks
Understanding Cryptography, Christof Paar and Jan Pelzl, Springer 2010.
References
1. Cryptography and Network Security: Principles and Practice, Fifth Edition.
William Stallings. Publisher: Pearson. 2011.
Grading Scheme
10% Participation
35% Midterm
40% Final exam
15% Project
5 10/23/2020
Chapter 1
Introduction to Cryptography and Data Security
In this chapter you will learn:
The general rules of cryptography.
Key lengths for short-, medium- and long-term security.
The difference between different types of attacks against
ciphers.
A few historical ciphers, and on the way we will learn about
modular arithmetic, which is of major Importance for
modern cryptography as well.
Why one should only use well-established encryption
algorithms.
6 10/23/2020
Cryptology
Cryptography is the science of secret writing with the goal of
hiding the meaning of a message.
Cryptanalysis is the science and sometimes art of breaking
cryptosystems.
Cryptanalysis is of central importance for modern cryptosystems:
without people who try to break our crypto methods, we will never
know whether they are really secure or not.
8 10/23/2020
Cryptography Branches
The focus of this course is on cryptography, it splits
into three main branches:
1- Symmetric Algorithms
2- Asymmetric (or Public-Key) Algorithms
3- Cryptographic Protocols
9 10/23/2020
Symmetric Algorithms
Two parties have an encryption and decryption
method for which they share a secret key.
All cryptography from ancient times until 1976
was exclusively based on symmetric methods.
Symmetric ciphers are still in widespread use,
especially for data encryption and integrity check
of messages.
10 10/23/2020
Cryptographic Protocols
Crypto protocols deal with the application of
cryptographic algorithms.
Symmetric and asymmetric algorithms can be viewed
as building blocks with which applications such as
secure Internet communication can be realized.
The Transport Layer Security (TLS) scheme, Secure
Socket Layer (SSL) which are used in every Web
browser, are examples of a cryptographic protocol.
12 10/23/2020
Basics (2)
Symmetric cryptography offers a powerful solution:
Alice encrypts her message “x” using a symmetric
algorithm, yielding the ciphertext “y”.
Bob receives the ciphertext and decrypts the message.
Decryption is, thus, the inverse process of encryption.
What is the advantage? If we have a strong
encryption algorithm, the ciphertext will look like
random bits to Oscar and will contain no information
whatsoever that is useful to him.
17 10/23/2020
Basics (3)
The variables x, y and k in Fig. 1.5 are important in
cryptography and have special names:
x is called plaintext or cleartext,
y is called ciphertext,
k is called the key,
The set of all possible keys is called the key space.
18 10/23/2020
Basics (4)
The system needs a secure channel for distribution
of the key between Alice and Bob.
The secure channel shown in Fig. 1.5 can, for
instance, be a human who is transporting the key
in a wallet between Alice and Bob. This is, of
course, a somewhat cumbersome method.
An example where this method works nicely is the
pre-shared keys used in Wi-Fi Protected Access
(WPA) encryption in wireless LANs.
19 10/23/2020
Basics (5)
Both the encryption and the decryption algorithms
are publicly known.
It seems that keeping the encryption algorithm secret
should make the whole system harder to break.
However, secret algorithms also mean untested
algorithms: The only way to find out whether an
encryption method is strong, i.e., cannot be broken
by a determined attacker, is to make it public and
have it analyzed by other cryptographers.
20 10/23/2020
Example
Example 1.2. Let’s look at another ciphertext:
iq ifcc vqqr fb rdq vfllcq na rdq cfjwhwz hr bnnb
hcc hwwhbsqvqbre hwq vhlq
Mathematical Model
27 10/23/2020
Lessons learned
Good ciphers should hide the statistical properties
of the encrypted plaintext.
The ciphertext symbols should appear to be
random.
A large key space alone is not sufficient for a
strong encryption function.
37 10/23/2020
1.3 Cryptanalysis
This section deals with recommended key lengths
of symmetric ciphers and different ways of
attacking crypto algorithms.
Recall that a cipher should be secure even if the
attacker knows the details of the algorithm.
38 10/23/2020
Classical Cryptanalysis
Classical
Classical cryptanalysis is understood as the science of
recovering the plaintext “x” from the ciphertext “y”, or,
alternatively, recovering the key “k” from the
ciphertext “y”.
We recall from the earlier discussion that cryptanalysis
can be divided into:
Analytical attacks, which exploit the internal structure of
the encryption method.
Brute-force attacks, which treat the encryption algorithm
as a black box and test all possible keys.
41 10/23/2020
Kerckhoffs’ Principle
A cryptosystem should be secure even if the attacker
(Oscar) knows all details about the system, with the
exception of the secret key. In particular, the system
should be secure when the attacker knows the
encryption and decryption algorithms.
45 10/23/2020
Important to Recall
A large key space is a necessary but not sufficient condition
for a secure symmetric cipher.
The cipher must also be strong against analytical attacks.
48 10/23/2020
Affine Cipher
To make computations with letters more
practicable, we can assign each letter of the
alphabet a number.
By doing so, an encryption with the Caesar cipher
simply becomes a (modular) addition with a fixed
value.
Instead of just adding constants, a multiplication
with a constant can be applied as well.
This leads us to the affine cipher.
50 10/23/2020
42 = 4 · 9+6
and therefore 42 ≡ 6 mod 9.
53 10/23/2020
Example 1.8
The core operation in many practical public-key
schemes is an exponentiation of the form xe mod m,
where x,e,m are very large integers, say, 2048 bits each.
Using a toy-size example, we can demonstrate two
ways of doing modular exponentiation.
We want to compute 38 mod 7.
The first method is the straightforward approach, and
for the second one we switch between equivalent
classes.
57 10/23/2020
First Method
38 = 6561 ≡ 2 mod 7, since 6561 = 937 · 7+2
Note that we obtain the fairly large intermediate
result 6561 even though we know that our final
result cannot be larger than 6.
58 10/23/2020
Second Method
Here is a much smarter method: First we perform two partial
exponentiations:
38 = 34 · 34 = 81 · 81
We can now replace the intermediate results 81 by another
member of the same equivalence class.
The smallest positive member modulo 7 in the class is 4 (since
81 = 11 · 7+4). Hence:
38 = 81 · 81 ≡ 4 · 4 = 16 mod 7
From here we obtain the final result easily as 16 ≡ 2 mod 7.
59 10/23/2020
Facts
As a general rule we should remember that it is
almost always of computational advantage to
apply the modulo reduction as soon as we can in
order to keep the numbers small.
Example 1.9. Let m=9, i.e., we are dealing with the ring Z9
={0,1,2,3,4,5,6,7,8}.
Let’s look at a few simple arithmetic operations:
6+8 = 14 ≡5 mod 9
6×8 = 48 ≡3 mod 9
62 10/23/2020
Example 1.10
Let’s see whether the multiplicative inverse of 15
exists in Z26.
Because gcd(15,26) = 1, the inverse must exist.
On the other hand, since gcd(14,26) = 2 ≠ 1, the
multiplicative inverse of 14 does not exist in Z26.
66 10/23/2020
a∈ {1,3,5,7,9,11,15,17,19,21,23,25}
74 10/23/2020
Computing a−1
But how do we find a−1? For now, we can simply
compute it by trial and error:
For a given a we simply try all possible values a−1
until we obtain: a · a−1 ≡ 1 mod 26
For instance, if a = 3, then a−1 = 9 since 3 · 9 = 27
≡ 1 mod 26.
75 10/23/2020
76 10/23/2020
Lessons Learned