Cyber Security Lecture Notes 05

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

Department of Computer Science

COMP40451 Cyber Security

Lecture 5
Cryptography (1)

Dr Xiaoqi Ma
Outline
1 Basic concepts of cryptography

2 Cryptographic mechanisms

3 Cryptographic keys

4 Historical background

5 Summary
Cryptography
 The word cryptography has its origin from the Greek word κρυπτός (kryptos), which
means “hidden” or “secret”
 Cryptography is the science of secret writing, or the practice and study of hiding
information
 Cryptography is widely used in applications present in technologically advanced
societies; examples include the security of ATM cards, computer passwords and
electronic commerce, which all depend on cryptography
Cryptanalysis
 Cryptanalysis is the study of methods for obtaining the meaning of encrypted
information, without access to the secret information which is normally required to do so
 Non-technically, cryptanalysis is the practice of code breaking
 In more general sense, cryptanalysis is also used to refer to any attempt to circumvent the
security of other types of cryptographic algorithms and protocols in general, and not just
encryption
Cryptology and cryptosystem
 Cryptology, often shortened to just crypto, is the study of both cryptography and
cryptanalysis
 A cryptosystem (abbreviation of cryptographic system) refers to a suite of algorithms
needed to implement a particular form of encryption and decryption
 Typically, a cryptosystem consists of three algorithms:
 Key generation algorithm
 Encryption algorithm
 Decryption algorithm
Cryptographic mechanisms
 Cryptographic mechanisms are the basic building blocks of cryptographic schemes
 Cryptographic mechanisms are used in cryptographic protocols and rely on good key
management to offer effective protection
 Most frequently used cryptographic mechanisms include:
 Encryption/decryption algorithms
 Digital signature schemes
 Integrity check functions (cryptographic hash functions)
Encryption and Decryption (1)
 Encryption is the process of transforming information using an algorithm to make it
unreadable to anyone except those possessing special knowledge, usually referred to as a
key
 Decryption is the process of transforming encrypted information back into its normal,
original form
Encryption and Decryption (2)
 Encryption is sometimes also called encode or encipher
 Decryption is sometimes also called decode or decipher
 A cipher (or cypher) is an algorithm for performing encryption and decryption
 The original form of a message is known as plaintext
 The encrypted form of a message is called ciphertext
Cryptographic Keys (1)
 In daily life, to lock and unlock a door, you need a key; locks differ in strength
 In information security, cryptographic algorithms use keys to protect data; there are
variations in strength
 Brute force attacks exhaustively search the entire key space and give an upper bound for
the strength of an algorithm
 Modern cryptography does not rely on the secrecy of its algorithm; the key used in a
cryptographic transformation should be the only item that needs protections
Cryptographic Keys (2)
 Key management is of paramount importance for the security of cryptographic schemes
 Important questions need to be addressed:
 Where are keys generated
 How are keys generated
 Where are keys stored
 How do they get there
 Where are the keys actually used
 How are keys revoked and replaced
Caesar Cipher: A Historical Example
 Caesar cipher is the earliest known use of a cipher by Julius Caesar
 It is a type of substitution cipher in which each letter in the plaintext is replaced by a
letter some fixed number of positions down the alphabet.
 Caesar used the shift of 3 in history
Caesar Cipher Shifts
Caesar Cipher
 For each plaintext letter p, substitute the ciphertext letter C:

𝐶 = 𝐸(𝑝) = (𝑝 + 3) mod 26
 Ciphers with shifts being of any amount can be considered as general Caesar cipher:

𝐶 = 𝐸(𝑝) = (𝑝 + k) mod 26
where the key k takes on a value in the range of 1 to 25
Example of Caesar Cipher
 The transformation can be represented by aligning two alphabets:
Plaintext a b c d e f g h i j k l m n o p q r s t u v w x y z
Ciphertext d e f g h i j k l m n o p q r s t u v w x y z a b c

 Encryption: 𝐶 = 𝐸(𝑝) = (𝑝+3) mod 26


 Decryption: 𝑝 = 𝐷(𝐶) = (𝐶−3) mod 26
 Example:
Plaintext the quick brown fox jumps over the lazy dog
Ciphertext
Example of Caesar Cipher
 The transformation can be represented by aligning two alphabets:
Plaintext a b c d e f g h i j k l m n o p q r s t u v w x y z
Ciphertext d e f g h i j k l m n o p q r s t u v w x y z a b c

 Encryption: 𝐶 = 𝐸(𝑝) = (𝑝+3) mod 26


 Decryption: 𝑝 = 𝐷(𝐶) = (𝐶−3) mod 26
 Example:
Plaintext the quick brown fox jumps over the lazy dog
Ciphertext wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj
Cryptanalysis of Caesar Cipher
 It is trivial to cryptanalyse the original Caesar cipher as we have already known the key,
which is 3
 For general Caesar cipher, a brute-force cryptanalysis can be easily performed
 Suppose we don’t know the key and try to analyse the cipher by brute force

Plaintext wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj
Key 1 vjg swkem dtqyp hqz lworu qxgt vjg ncba fqi
Key 2 uif rvjdl cspxo gpy kvnqt pwfs uif mbaz eph
Key 3 the quick brown fox jumps over the lazy dog
Monoalphabetic Cipher
 With only 25 possible keys, the Caesar cipher is far from secure
 A dramatic increase in the key space can be achieved by allowing an arbitrary
substitution:

Plaintext a b c d e f g h i j k l m n o p q r s t u v w x y z
Ciphertext n x q g u s v k l c a y p f r i t z j w e o h d b m
 Message cipher:

Plaintext Flee at once, we are discovered!


Ciphertext Syuu nw rfqu, hu nzu gljqrouzug!
Security of Monoalphabetic Cipher
 Caesar cipher only has 25 effective keys
 The number of keys of monoalphabetic cipher:
26! ≈ 288.4 ≈ 4 × 1026
 It is more difficult to cryptanalyse monoalphabetic ciphers as its key space is much larger
than Caesar cipher
 Is it really secure enough?
Breaking Monoalphabetic Cipher
Summary
1 Basic concepts of cryptography
2 Cryptographic mechanisms
3 Importance of cryptographic keys
4 Caesar cipher
5 Monoalphabetic cipher

You might also like