COMPUTER NETWORK
SECURITY
1
UNIT 3
CRYPTOGRAPHY
2
CRYPTOGRAPHY
Definition of Terms
Plaintext: This is the original intelligible message or data that is fed into
the algorithm as input.
Ciphertext: This is the scrambled message produced as output. It depends
on the plaintext and the secret key. For a given message, two different keys
will produce two different cipher texts. The cipher text is an apparently
random stream of data and, as it stands, is unintelligible.
Encryption or Enciphering: The process of converting a plaintext into a
ciphertext
3
CRYPTOGRAPHY
Definition of Terms
Decryption or Deciphering: The process of converting a ciphertext back
to a plaintext.
Cryptography: The many schemes used for encryption constitute the area
of study known as cryptography
Cryptographer: The person who performs the act of cryptography
Cryptanalysis: Techniques used for deciphering a message without any
knowledge of the enciphering details fall into the area of cryptanalysis.
Cryptanalysis is what the layperson calls “breaking the code”
4
CRYPTOGRAPHY
Definition of Terms
Cryptology: The many schemes used for encryption constitute the area of
study known as cryptography
Secret Key: The secret key is also input to the encryption algorithm. The
key is a value independent of the plaintext and of the algorithm. The
algorithm will produce a different output depending on the specific key
being used at the time. The exact substitutions and transformations
performed by the algorithm depend on the key.
5
CRYPTOGRAPHY
There are three types of cryptographic schemes;
a) Totally secret schemes
b) Symmetric schemes
c) Asymmetric schemes
6
TOTALLY SECRET SCHEMES
All aspects of the system are secret
1. Encryption/ Decryption
2. The key
When a member abandons, the algorithm
must be changed.
• Example: The Microsoft Xbox
7
SYMMETRIC CIPHER
• The algorithms are known but the parameters (keys) are secret.
• Use the same key (K) for both encryption and decryption
• Divided into two categories:
Stream ciphers: Operate on plaintext one bit or byte at a time.
Block ciphers: Operate in groups of bits or bytes, a typical block size used is
64 bits.
Examples of symmetrical algorithms are AES, IDEA, DES,
and 3DES.
8
ASYMMETRIC CIPHER
• Use two keys, one for encryption (E), and one for decryption (D).
• Very difficult to compute the D from E.
• Each user has a public E and a private D.
Examples: RSA, Diffie‐Hellman key exchange
9
COMPARISON OF THE CRYPTOGRAPHIC
SCHEMES
Advantages of symmetric cryptography:
• Can be designed to have high rates of data throughput. Hundreds of
megabytes/ sec for Hardware implementations.
• Keys are relatively short;
• Can be employed as primitives to construct various cryptographic
mechanisms e.g. pseudorandom number generators, harsh functions etc
• Can be composed to produce stronger ciphers although on their own they
might be weak.
10
COMPARISON OF THE CRYPTOGRAPHIC
SCHEMES
Disadvantages of symmetric cryptography:
• In a two‐party communication, the key must remain secret at both ends;
• In a large network, there are many key pairs to be managed;
• In a two‐party communication, sound cryptographic practice dictates that
the key be changed frequently
11
COMPARISON OF THE CRYPTOGRAPHIC
SCHEMES
Advantages of Asymmetric cryptography:
• Only the private key must be kept secret
• A private key/ public key pair may remain unchanged for considerable
periods of time e.g many sessions (even several years)
• Yield relatively efficient digital signature mechanisms. Key used to
describe public verification is typically much smaller compared to that for
symmetric‐key scheme
• In a large network, the number of keys necessary may be considerably
smaller
12
COMPARISON OF THE CRYPTOGRAPHIC
SCHEMES
Disadvantages of Asymmetric cryptography:
• Throughput rates are several orders of magnitude slower than the best
known symmetric scheme
• Key sizes are typically much larger than those for symmetric‐key
encryption. Typically, 1024 bits for RSA and 64 or 128 bits for secure
symmetric‐key schemes. This is because, attacks on symmetric‐key
schemes involve exhaustive key search whereas attacks on public‐key
systems are subject to “shortcut” attacks (e.g factoring)
13
SYMMETRIC CIPHER
MODEL
14
SYMMETRIC CIPHER
Symmetric encryption, also referred to as conventional encryption or
single-key encryption, was the only type of encryption in use prior to the
development of public key encryption in the 1970s. It remains by far the
most widely used of the two types of encryption.
A symmetric encryption scheme has five ingredients. They are Plain Text,
Encryption Algorithm, Secret Key, Cipher Text, Decryption Algorithm.
There are two requirements for secure use of conventional encryption:
15
PRINCIPLES OF SYMMETRIC CIPHER
• We need a strong encryption algorithm. At a minimum, we would like the
algorithm to be such that an opponent who knows the algorithm and has
access to one or more cipher texts would be unable to decipher the cipher
text or figure out the key.
• Sender and receiver must have obtained copies of the secret key in a
secure fashion and must keep the key secure. If someone can discover the
key and knows the algorithm, all communication using this key is
readable.
16
PRINCIPLES OF SYMMETRIC CIPHER
17
PRINCIPLES OF SYMMETRIC CIPHER
18
SUBSTITUTION CIPHER
• A substitution technique is one in which the letters of plaintext are
replaced by other letters or by numbers or symbols. If the plaintext is
viewed as a sequence of bits, then substitution involves replacing
plaintext bit patterns with cipher text bit patterns.
The simple and the most common substitution cipher is the Caesar
cipher.
19
SUBSTITUTION CIPHER
• Caesar Cipher
The earliest known use of a substitution cipher, and the simplest, was by
Julius Caesar. The Caesar cipher involves replacing each letter of the
alphabet with a cyclic shift either to the left or to the right depending on the
Key.
Example: Let the key be 3 cyclic shift to the right. Encrypt the plain text
“meet me at the bar before you leave”
The cipher text will be; PHHW PH DW WKH EDU EHIRUH BRX
OHDYH.
20
SUBSTITUTION CIPHER
Consider the key to be 5 cyclic shift to the left.
The cipher text to be decrypted is
To decrypt the message sent, simply take each letter in the message and
shift it five letters up the alphabet. Thus j in the ciphertext becomes e in the
plaintext.
The place text will be;
21
SUBSTITUTION CIPHER
• This is a simple monoalphabetic substitution cipher where each character
in an alphabet is replaced by another alphabet or sometimes even by a
symbol of a different alphabet. A cipher wheel is used to implement a
generalized substitution cipher by using wraparound effect e.g y is
wrapped‐around to d.
22
SUBSTITUTION CIPHER
• A cipher wheel with an offset of five letters is as follows:
23
SUBSTITUTION CIPHER
• It is useful to keep track of the different alphabets by always writing your
plaintext in lowercase and your ciphertext in uppercase.
24
SUBSTITUTION CIPHER
• With an alphabet of 26 characters and the most general substitution table,
there exist 26! different keys. Assigning letter a to one of the 26 possible
ciphertext letters A – Z => 26 possibilities, assigning b => 25 possibilities
since b cannot be assigned to a
26 x 25 x 24 x . . . = 26!
However substitution ciphers are easy to break since the letters in the
English language are not random
25
SYMMETRIC CIPHER
• The symmetric cipher is divided into two types;
• Stream Cipher
• Block Cipher.
Stream Cipher: Individual characters (usually binary digits) of a plaintext
message are encrypted one at a time using an encryption transformation
which varies with time.
The simplest stream cipher is the one‐time pad defined by
𝐶𝐶𝑖𝑖 = 𝑚𝑚𝑖𝑖 ⊕ 𝑘𝑘𝑖𝑖 , for 𝑖𝑖 = 1,2,3 … ,
26
SYMMETRIC CIPHER
27
STREAM CIPHER
Where 𝑚𝑚1 , 𝑚𝑚2 , 𝑚𝑚3 … are plaintext digits, 𝑘𝑘1 , 𝑘𝑘2 , 𝑘𝑘3 , …(the key stream) are
the key digit, 𝑐𝑐1 , 𝑐𝑐2 , 𝑐𝑐3 , … are ciphertext digits and ⊕ is the XOR function
(bitwise addition modulo2).
The decryption is defined by 𝑚𝑚𝑖𝑖 = 𝑐𝑐𝑖𝑖 ⊕ 𝑘𝑘𝑖𝑖
The Vigenère Cipher
A key is repeatedly added to the plaintext in mod26 using convention that
A = 0, B = 1, ‐ ‐ ‐, Z = 25.
𝐶𝐶 = 𝑚𝑚 ⊕ 𝑘𝑘 𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚
28
STREAM CIPHER
Example:
Plaintext: FOMICUNIVERSITY
Key :keykeykeykeykey
Ciphertext:
29
STREAM CIPHER
• Ciphertext‐only attack, that is if the ciphertext and the distribution of
plaintext are known to the attacker;
• The ciphertext is arranged in rows with the same length as the key;
• Every column can be seen as encryption using substitution process
• Decipher based on frequency in plaintext
30