Screenshot 2022-04-05 at 4.10.21 PM
Screenshot 2022-04-05 at 4.10.21 PM
By far the most important automated tool for network and communications security
is encryption. Two forms of encryption are in common use: conventional, or symmetric
encryption and public-key, or asymmetric, encryption.
Cryptography:
It is the study of mathematical techniques related to aspects of information security
such as:-
Classification of Cryptography
block / stream
Symmetric Ciphers
In Symmetric cryptography ciphers the enciphering and deciphering keys are the
same, as shown in figure 1-2:
Security of computers and networks Fourth stage
Plaintext: This is the original intelligible message or data that is fed into the algorithm as
input.
Secret key: The secret key is also input to the encryption algorithm. The key is a value
independent of the plaintext and 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.
1. Block Cipher: processes the input one block of elements at a time, producing an
output block for each input block.
2. Stream Cipher: processes that encrypt a digital data stream one bit or one byte at
a time.
Secret key shared by sender & recipient Secret key shared by sender & recipient
Decryption
Encryption
Algorithm
Ciphertext Algorithm
(reverse of
encryption
algorithm)
Plaintext Plaintext
Figure 1-3: Simplified Model of Conventional Encryption
Security of computers and networks Fourth stage
Note: Enciphering
Deciphering
An algorithm for performing encryption (and the reverse, decryption): a series of well-
defined steps that can be followed as a procedure. It works at the level of individual
letters, or small groups of letters.
Cryptosystem: The package of all processes, formulae, and instructions for encoding
and decoding messages using cryptography
Digram: Sequence of two consecutive characters
Key: A relatively small amount of information that is used by an algorithm to customize
the transformation of plaintext into ciphertext (during encryption) or vice versa
(during decryption)
Key length: The size of the key - how many values comprise the key
Monoalphabetic: Using one alphabet - refers to a cryptosystem where each alphabetic
character is mapped to a unique alphabetic character
Security of computers and networks Fourth stage
Security aspects come into play when it is necessary or desirable to protect the
information transmission from an opponent who may present a threat to confidentiality,
authenticity, and so on. All the techniques for providing security have two components:
Secret information to the two principals while keeping it from any opponent. Or a
third party may be needed to arbitrate disputes between the two principals concerning the
authenticity of a message transmission.
This general model shows that there are four basic tasks in designing a particular
security service:
3. Develop methods for the distribution and sharing of the secret information.
4. Specify a protocol to be used by the two principals that makes use of the security
algorithm and the secret information to achieve a particular security service.
However, there are other security-related situations of interest that do not neatly fit
this model. A general model of these other situations is illustrated by Figure 1-5, which
reflects a concern for protecting an information system from unwanted access. Most
readers are familiar with the concerns caused by the existence of hackers, who attempt to
penetrate systems that can be accessed over a network. The hacker can be someone who,
with no malign intent, simply gets satisfaction from breaking and entering a computer
system. Or, the intruder can be a disgruntled employee who wishes to do damage, or a
criminal who seeks to exploit computer assets for financial gain (e.g., obtaining credit
card numbers or performing illegal money transfers).
Another type of unwanted access is the placement in a computer system of logic that
exploits vulnerabilities in the system and that can affect application programs as well as
utility programs, such as editors and compilers. Programs can present two kinds of
threats:
Information access threats intercept or modify data on behalf of users who should
not have access to that data.
Service threats exploit service flaws in computers to inhibit use by legitimate users.
Viruses and worms are two examples of software attacks. Such attacks can be
introduced into a system by means of a disk that contains the unwanted logic concealed
in otherwise useful software. They can also be inserted into a system across a network;
this latter mechanism is of more concern in network security.
The security mechanisms needed to cope with unwanted access fall into two broad
categories:
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 the letter
standing three places further down the alphabet. For example:
Note that the alphabet is wrapped around, so that the letter following Z is A. We
can define the transformation by listing all possibilities, as follows:
Plain: 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
Cipher: 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
A B C D E F G H I J K L M
0 1 2 3 4 5 6 7 8 9 10 11 12
N O P Q R S T U V W X Y Z
13 14 15 16 17 18 19 20 21 22 23 24 25
Then the algorithm can be expressed as follows. For each plaintext letter p,
substitute the ciphertext letter C:
C = E(3, p) = (p + 3) mod 26
C = E(k, p) = (p + k) mod 26
where k takes on a value in the range 1 to 25. The decryption algorithm is simply
p = D(k, C) = (C - k) mod 26
Security of computers and networks Fourth stage
C = (p + k) mod 26
...
cipertexe: VKLSHTXLSPHQWZLOOUHDFKRQWKHIRXUWKRIMXOB
p = (C - k) mod 26
The two basic building blocks of all encryption techniques are substitution and
transposition:
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 ciphertext bit patterns. There
are a number of different types of substitution cipher:
1. Monoalphabetic: Using one alphabet - refers to a cryptosystem where each
alphabetic character is mapped to a unique alphabetic character.
2. Polyalphabetic: Using many alphabets - refers to a cipher where each alphabetic
character can be mapped to one of many possible alphabetic characters.
Cryptosystem: The package of all processes, formulae, and instructions for encoding
and decoding messages using cryptography.
The simple substitution cipher is a cipher that has been in use for many hundreds
of years. It basically consists of substituting every plaintext character for a different
ciphertext character. It differs from the Caesar cipher in that the cipher alphabet is not
simply the alphabet shifted, it is completely jumbled.
Example : Encrypt the following text: "defend the east wall of the castle".
Keys for the simple substitution cipher usually consist of 26 letters (compared to
the caeser cipher's single number). An example key is:
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
Security of computers and networks Fourth stage
P H Q G I U M E A Y L N O F D X J K R C V S T Z W B
Ciphertext: GIUIFGCEIIPRCTPNNDUCEIQPRCNI
Example 2:
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
H W U G C T V A E K D Y Q P B R J L F I X M S O Z N
Hill cipher
The Hill cipher uses matrix multiplication, mod 26. In particular, the encryption
key is an nxn matrix with an inverse mod 26, where n is the block size. System can be
described as follows:
C = KP mod 26
For example, we will illustrate the cipher with n=2. Consider the following key:
3 1
6 5
To encrypt a plaintext, group the plaintext in pairs: "math", for example. Convert
each letter to its numerical equivalent, mod 26, and write it in a nx1 matrix as follows:
12
0 stands for "ma"
Now, multiply the encryption key by the plaintext and reduce mod 26 to get the
ciphertext:
3 1 12 36 10
mod 26 mod 26 , which corresponds to the ciphertext KU.
6 5 0 72 20
3 1 19 64 12
mod 26 mod 26 , which corresponds to the ciphertext MT.
6 5 7 149 19
Ciphertext: KUMT
Security of computers and networks Fourth stage
Example: consider the plaintext "paymoremoney" and use the encryption key:
The first three letters of the plaintext are represented by the vector
The ciphertext for the entire plaintext is: LNS HDL EWM TRW.
Decryption:
Decryption requires using the inverse of the matrix K. The inverse K-1 of a matrix
K is defined by the equation KK-1 = K-1K = I, where I is the matrix that is all zeros except
for ones along the main diagonal from upper left to lower right. The inverse of a matrix
does not always exist, but when it does, it satisfies the preceding equation.
P = K-1 C mod 26
To find K-1 it needs to use a bit of math. It turns out that K-1 above can be
calculated from our key. The important things to know are inverses (mod m),
determinants of matrices and matrix adjugates.
Let K be the key matrix. Let d be the determinant of K. We wish to find K-1 (the
inverse of K), such that K × K-1 = I (mod 26), where I is the identity matrix. The
following formula tells us how to find K-1 given K:
Determinant 1 3 5 7 9 11 15 17 19 21 23 25
Reciprocal Modulo 26 1 9 21 15 3 19 7 23 11 5 17 25
Example: decrypt the following ciphertext " KUMT" if you know it is encrypted using
Hill cipher by key
3 1
6 5
Solution:
d= 3*5 (1*6) = 9
d-1 = 3
5 1
adj(k) =
6 3
15 23
k-1 =d-1 * adj(k) =
8 9
Now, we can corroborate that this is the case by decrypting the example above.
Security of computers and networks Fourth stage
15 23 10 610 12
mod 26 mod 26
8 9 20 260 0
15 23 12 617 19
mod 26 mod 26
8 9 19 267 7
Plaintext: math
(K*K-1) mod 26 =
3 1 15 23 53 78 1 0
mod 26 mod 26
6 5 8 9 130 183 0 1
Example of decryption 3x3 key: decrypt the following ciphertext "LNS HDL EWM
TRW " if you know it is encrypted using Hill cipher key
Solution:
p=k-1*C mod 26
(23)-1=17
And repeat the same function to the next three letters until end the ciphertext
Example: Suppose that the plaintext "friday" is encrypted using a 2 x 2 Hill cipher to
Solution:
So:
Polyalphabetic Ciphers
Vigenère cipher
The best known polyalphabetic substitution cipher, and one of the simplest, such
algorithm is referred to as the Vigenère cipher. In this scheme, the set of related
monoalphabetic substitution rules consists of the 26 Caesar ciphers, with shifts of 0
through 25. Each cipher is denoted by a key letter.
To aid in understanding the scheme and to aid in its use, a matrix known as the
Vigenère tableau is constructed. Each of the 26 ciphers is laid out horizontally, with the
key letter for each cipher to its left. A normal alphabet for the plaintext runs across the
top. The process of encryption is simple: Given a key letter x and a plaintext letter y, the
ciphertext letter is at the intersection of the row labeled x and the column labeled y; in
this case the ciphertext is V.
For example to encrypt a message, a key is needed that is as long as the message.
Usually, the key is a repeating keyword. For example, if the keyword is deceptive, the
message "we are discovered save yourself" is encrypted as follows:
key: deceptivedeceptivedeceptive
plaintext: wearediscoveredsaveyourself
ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ
Security of computers and networks Fourth stage
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
A 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
B 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 A
C C 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
D 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
E 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 D
F F G H I J K L M N O P Q R S T U V W X Y Z A B C D E
G G H I J K L M N O P Q R S T U V W X Y Z A B C D E F
H H I J K L M N O P Q R S T U V W X Y Z A B C D E F G
I I J K L M N O P Q R S T U V W X Y Z A B C D E F G H
J J K L M N O P Q R S T U V W X Y Z A B C D E F G H I
K K L M N O P Q R S T U V W X Y Z A B C D E F G H I G
L L M N O P Q R S T U V W X Y Z A B C D E F G H I J K
M M N O P Q R S T U V W X Y Z A B C D E F G H I J K L
N N O P Q R S T U V W X Y Z A B C D E F G H I J K L M
O O P Q R S T U V W X Y Z A B C D E F G H I J K L M N
P P Q R S T U V W X Y Z A B C D E F G H I J K L M N O
Q Q R S T U V W X Y Z A B C D E F G H I J K L M N O P
R R S T U V W X Y Z A B C D E F G H I J K L M N O P Q
S S T U V W X Y Z A B C D E F G H I J K L M N O P Q R
T T U V W X Y Z A B C D E F G H I J K L M N O P Q R S
U U V W X Y Z A B C D E F G H I J K L M N O P Q R S T
V V W X Y Z A B C D E F G H I J K L M N O P Q R S T U
W W X Y Z A B C D E F G H I J K L M N O P Q R S T U V
X X Y Z A B C D E F G H I J K L M N O P Q R S T U V W
Y Y Z A B C D E F G H I J K L M N O P Q R S T U V W X
Z Z 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
Security of computers and networks Fourth stage
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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Example
QUESTION", using the keyword SUBSTITUTION?
C=p+k mod 26
Keyword:
S U B S T I T U T I O N S U B S T I T U T I O N S U B S T I
As integer
2 1 1 1 2 1 1 1 1 2 1 1 1 2 1 1 1 1 1
18 1 8 8 1 8 19 8 1 18 8
0 8 9 9 0 9 4 3 8 0 8 9 9 0 4 3 8 9 9
Plaintext:
t o b e o r n o t t o b e t h a t i s t h e q U e s t i o n
As integer
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1
19 1 4 19 1 4 7 0 8 7 4 4 8
4 4 7 3 4 9 4 9 9 8 9 6 0 8 9 4 3
Addition
2 2 1 1 2 1 1 1 1 1 1 1 2 1 2 2
11 8 2 7 6 8 1 2 8 0 4 7 0 7
2 5 2 4 3 3 8 2 6 1 3 2 3 2 0 1
Cipher text:
L I C W H Z G I M B C O W N I S M Q L N A M E H W M U A H V
Security of computers and networks Fourth stage
Decryption is equally simple. The key letter again identifies the row. The position of
the ciphertext letter in that row determines the column, and the plaintext letter is at the
top of that column.
Example: using vigenere cipher, encrypt and decrypt the word (instruction) with the key
(key)
plaintext i n s t r u c t i o n
P 8 13 18 19 17 20 2 19 8 14 13
key k e y k e y k e y k e
k 10 4 24 10 4 24 10 4 24 10 4
P+k 18 17 42 29 21 44 12 23 32 24 17
(P+k)mod26 18 17 16 3 21 18 12 23 6 24 17
ciphertext S R Q D V S M X G Y R
ciphertext S R Q D V S M X G Y R
C 18 17 16 3 21 18 12 23 6 24 17
key k e y k e y k e y k e
k 10 4 24 10 4 24 10 4 24 10 4
C-k 8 13 -8 -7 17 -6 2 19 -18 14 13
(C-k)mod26 8 13 18 19 17 20 2 19 8 14 13
plaintext i n s t r u c t i o n
Security of computers and networks Fourth stage
Transposition Techniques
The following Figure (A) shows the key and Fig. (B) Shows the encryption
process of the previously described transposition cipher.
It can be noticed that the random string "X" was appended to the end of message to
enforce a massage length, which is a multiple of the block size.
Security of computers and networks Fourth stage
1 2 3 4 5 6 7
4 1 3 5 7 6 2
b r e a k i n
a b e k n i r
g t r a n s p Encryption
a g r n p s t
o s i t i o n
t o i i n o s
c i p h e r x
h c p e x r i
(A) (B)
Decryption:
4 1 3 5 7 6 2
a b e k n i r 1 2 3 4 5 6 7
a g r n p s t b r e a k i n
Decryption
t o i i n o s n g t r a n s p
h c p e x r i o s i t i o n
c i p h e r x
The plaintext is breaking transposition cipher
Security of computers and networks Fourth stage
Playfair Cipher
M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
1. Repeating plaintext letters that are in the same pair are separated with a filler letter,
such as x, so that balloon would be treated as ba lx lo on.
2. Two plaintext letters that fall in the same row of the matrix are each replaced by the
letter to the right, with the first element of the row circularly following the last. For
example, ar is encrypted as RM.
3. Two plaintext letters that fall in the same column are each replaced by the letter
beneath, with the top element of the column circularly following the last. For
example, mu is encrypted as CM.
4. Otherwise, each plaintext letter in a pair is replaced by the letter that lies in its own
row and the column occupied by the other plaintext letter. Thus, hs becomes BP and
ea becomes IM (or JM, as the encipherer wishes).
Security of computers and networks Fourth stage
K E Y W O
R D A B C
F G H I/ J L
M N P Q S
T U V X Z
wh yd on ty ou
YJ EA ES VK EZ
Example: Decrypt the message (PH GK CN HR FA NY) using playfair cipher with the
key=encrypt.
GK fi f g h i/j k
l m o q s
CN ne
u v w x z
RH ci
AF ph
Affine cipher
The affine cipher is a type of monoalphabetic substitution cipher. The 'key' for the
Affine cipher consists of 2 numbers, we'll call them a and b, a should be chosen to be
relatively prime to m (i.e. a should have no factors in common with m). For example 15
and 26 have no factors in common, so 15 is an acceptable value for a, however 12 and 26
have factors in common (e.g. 2) so 12 cannot be used for a value of a. When encrypting,
we first convert all the letters to numbers ('a'=0, 'b'=1, ..., 'z'=25). The ciphertext letter c,
for any given letter p is (remember p is the number representing a letter):
a 1 3 5 7 9 11 15 17 19 21 23 25
a-1 1 9 21 15 3 19 7 23 11 5 17 25
ciphertext: YEQLUNMZMXAOXMMZOXA
Security of computers and networks Fourth stage
Example 2: Encipher (war lost) Using an affine transformation with the ordinary
alphabet. Use 7 as the multiplier, and 10 as the shift. Then recover the plaintext. The
ordinary alphabet associations are shown in
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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
The plaintext message, when the letters are converted to their numerical equivalents, and
then compute the following:
C = 7P + 10 = 7 . 22 + 10 8 (mod 26)
C = 7P + 10= 7 . 0 + 10 10 (mod 26)
C = 7P + 10 = 7 . 17 + 10 25 (mod 26)
C = 7P + 10 = 7 . 11 + 10 9 (mod 26)
C = 7P + 10 = 7 .14 + 10 = 4 (mod 26)
C = 7P + 10 = 7 . 18 + 10 = 6 (mod 26)
C = 7P + 10 = 7 . 19 + 10 = 13 (mod 26)
To recover the plaintext, Since 7 is relatively prime to 26, an inverse of it exists modulo
26, and it can be found solving the congruence
7x 1 (mod 26) for x. Quick calculations using the extended Euclidean algorithm yield
x 15 (mod 26).
This value for x is an inverse of 7 modulo 26, and this is easily verified:
7x = 7(15) = 105 (mod 26) = 1.
Thus, to recover the plaintext from the ciphertext, we crank it through the deciphering
transformations:
p 15(c 10) 15 . (8 - 10) 15 . (-2) 22 (mod 26)
p 15(c 10) 15 . (10 - 10) 15 . 0 0 (mod 26)
p 15(c 10) 15 . (25 - 10) 15 . 15 17 (mod 26)
p 15(c 10) 15 . (9 -10) 15 . (-1) 11 (mod 26)
p 15(c 10) 15 . (4 -10) 15 . (-6) 14 (mod 26)
p 15(c 10) 15 . (6 -10) 15 . (-4) 18 (mod 26)
p 15(c 10) 15 . (13 - 10) 15 . 3 19 (mod 26)
Encryption function:
Y = a x+b mod 26
The possible values that a could be are 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, and 25.
Decryption function :
X = inv(a) (y-b) mod 26
Example: the plaintext to be encrypted is "affine cipher" a=5 b=8
-
- - - - -
-
Security of computers and networks Fourth stage
Example: Decrypt the message (SXGNDKL) using affine cipher with key is
(11, 5)
P1=19*(18-5) mod 26 = 14 n
P2=19*(23-5) mod 26 = 4 e
P3=19*(6-5) mod 26 = 19 t
P4=19*(13-5) mod 26 = 22 w
P5=19*(3-5) mod 26 = 14 o
P6=19*(10-5) mod 26 = 17 r
P7=19*(11-5) mod 26 = 10 k
One-Time Pad
The key
o a truly random sequence of 0 s and 1 s
o the same length as the message
o use one time only
The encryption
o adding the key to the message modulo 2, bit by bit.
The Decryption
Example
Encryption:
1001001 1000110 plaintext
1010110 0110001 key
0011111 1110110 ciphertext
Decryption:
0011111 1110110 ciphertext
1010110 0110001 key
1001001 1000110 plaintext
Security of computers and networks Fourth stage
Solution :
Stream Ciphers
Key-stream is generated in pseudo-random fashion
Key generator
-
Use a Pseudo-Random Number Generator (PRNG)
PRNG takes a short, truly random secret seed and expands it into a long
-
-
This polynomial is primitive polynomial
Security of computers and networks Fourth stage
Cryptanalysis
Typically, the objective of attacking an encryption system is to recover the key in
use rather than simply to recover the plaintext of a single ciphertext. There are two
general approaches to attacking a conventional encryption scheme:
There are basically two types of attack. One is on system and other is on data shown
in Figure below.
System Attacks:
In general there is a flow of information from a source to a destination. The attacks which
are on the flow of information are known as system attacks. The main security threats are
listed below:
Data Attacks:
An attempted crypto analysis is known as an attack. The level of information that
decoder is able to extract from the cryptosystem and can be divided into five ways of
decryption which are as follows:
Cipher text only attack: The crypto analyst has cipher text of several messages
and all of which were encrypted using the same encryption algorithm. Then job is
to recover the plain text or the key used to encrypt the messages. So, to decrypt
other part of messages encrypted with the help of same keys.
Known Plaintext attack: Crypto analysts seek the possession of pairs of known
plain text and cipher text. Then job is to hold the key used to encrypt the messages
or an algorithm to decrypt messages.
Chosen Plaintext Attack (CPA): Crypto analyst not only hold the cipher text but
also some parts of chosen plain text. Intruder is identified to be placed at encryption site
to do the attack.
Chosen cipher text attack (CCA): In this crypto analyst hold the possession of
chosen cipher text and plain text being decrypted from the private key. However,
it only has access to an encryption machine.
Security of computers and networks Fourth stage
Euclidean algorithm
One of the basic techniques of number theory is the Euclidean algorithm, which is
a simple procedure for determining the greatest common divisor of two positive integers.
Let a and b be integers, not both zero. Recall that GCD (a, b) is the greatest common
divisor of a and b. The best general algorithm for computing GCD (a, b) (and the only
practical algorithm, unless the prime factorizations of a and b are known) is due to
Euclid. This algorithm (known as Eucl Algorithm)
involves repeated application of the Division Algorithm. In another word, given any
positive integer n and any positive integer a, if we divide a by b, we get an integer q
quotient and an integer r remainder that obey the following relationship:
Ex1: find the Greatest Common Divisor (GCD) between 132 and 55 by using
132 = 55 * 2 + 22
55 = 22 * 2 + 11
22 = 11 * 2 + 0
252 = 198 * 1 + 54
198 = 54 * 3 + 36
54 = 36 * 1 + 18
36 = 18 * 2 + 0
Example Compute the greatest common divisor (GCD) between the numbers (831,
366 .
Solution:
831 = 2 × 366 + 99
366 = 3 × 99 + 69
99 = 1 × 69 + 30
69 = 2 × 30 +9
30 = 3×9 +3
9 = 3×3 +0
The answer is revealed as the last nonzero remainder: gcd (831, 366) = 3
Note: Because we require that the greatest common divisor be positive GCD (a, b)
= GCD (a, -b) = GCD (-a, b) = GCD(-a,-b). In general, GCD(a, b)
= GCD( / a / , / b ).
Solution:
321805575 = 1620 * 198645 + 675
198645 = 294 * 675 + 195
675 = 3 * 195 + 90
195 = 2 * 90 + 15
90 = 6 * 15 +0
The answer is revealed as the last nonzero remainder: GCD (321805575, 198645) = 15
H.W.
Security of computers and networks Fourth stage
Any positive integer that is less than n and relatively prime to n has a
multiplicative inverse modulo n. This is a consequence of the Euclidean algorithm. We
will see in the example below why this must be so. Any positive integer that is less than n
and not relatively prime to n does not have a multiplicative inverse modulo n.
Solution: First, do the "forward part" of the Euclidean algorithm finding the GCD.
26 1 15 11
15 1 11 4
11 2 4 3
4 1 3 1
So, GCD (15, 26) = 1.
1 4 1 3
1 4 1 (11 2 4)
1 3 4 1 11
1 3 (15 1 11) 1 11
1 3 15 4 11
1 3 15 4 (26 1 15)
1 7 15 4 26
So, 1 7 15 4 26 .
Finally, "go mod 26." Because 26 0 mod 26 , when we "go mod 26," the equation 1
7 15 4 26 becomes the congruence1 7 15mod 26 . So, the inverse of 15
modulo 26 is 7 (and the inverse of 7 modulo 26 is 15).
Security of computers and networks Fourth stage
26 = 19 * 1 + 7
19 = 7 * 2 + 5
7=5*1+2
5=2*2+1
2=2*1+0
Now, do the "backward part" of the algorithm
1 = 5 - 2*2
1 = 5 - 2(7 - 5*1)
1 = 5*3 - 2*7
1 = (19 - 7*2)*3 - 2*7
1 = 3*19 - 8*7
1 = 3*19 - 8(26 - 19*1)
1 = 11*19 - 8*26
1 = 11*19 mod 26
So, we conclude that 11 is the multiplicative inverse of 19 modulo 26.
Security of computers and networks Fourth stage
Security of computers and networks Fourth stage
Security of computers and networks Fourth stage
Security of computers and networks Fourth stage
Security of computers and networks Fourth stage
Security of computers and networks Fourth stage
Security of computers and networks Fourth stage
H.W
1. Determine each of the following greatest common divisors. Which of the pairs
are relatively prime?
gcd(6, 15)
gcd(8, 17).
gcd(24, 138).
gcd(12378, 3054).
Feistel cipher
Feistel proposed the use of a cipher that alternates substitutions and permutations,
as Diffusion and Confusion.
Diffusion: the statistical structure of the plaintext is dissipated into long-range statistics
of the ciphertext. This is achieved by having each plaintext digit affect the value of many
ciphertext digits; generally, this is equivalent to having each ciphertext digit be affected
by Many plaintext digits, in other words diffusion hides the relationship between the
ciphertext and the plaintext in way that each symbol (character or bit) in the ciphrtext is
dependent on some or all symbols in the plaintext, so if one symbol in the plaintext
changed several or all symbols in the ciphertext will also be changed Diffusion can be
achieved by repeatedly performing some permutation on the data followed by applying a
function to that permutation.
Confusion: seeks to make the relationship between the statistics of the ciphertext and the
value of the encryption key as complex as possible, again to thwart attempts to discover
the key. In other words confusion hides the relationship between the ciphertext and the
encryption key this done if a single bit in the key is changed then most or all bits in the
ciphertext will also be changed Thus, even if the attacker can get some handle on the
statistics of the ciphertext, the way in which the key was used to produce that ciphertext
is so complex as to make it difficult to deduce the key. This is achieved by the use of a
complex substitution algorithm. In contrast, a simple linear substitution function would
add little confusion.
Security of computers and networks Fourth stage
Looking at the left-hand side of the figure, we can see that the processing of the
plaintext proceeds in three phases. First, the 64-bit plaintext passes through an initial
permutation (IP) that rearranges the bits to produce the permuted input. This is followed
by a phase consisting of 16 rounds of the same function, which involves both
permutation and substitution functions. The output of the last (sixteenth) round consists
of 64 bits that are a function of the input plaintext and the key. The left and right halves
of the output are swapped to produce the preoutput. Finally, the preoutput is passed
through a permutation (IP-1) that is the inverse of the initial permutation function, to
produce the 64-bit ciphertext. With the exception of the initial and final permutations,
DES has the exact structure of a Feistel cipher.
The right-hand portion of the previous figure shows the way in which the 56-bit key
is used. Initially, the key is passed through a permutation function. Then, for each of the
16 rounds, a subkey (Ki) is produced by the combination of a left circular shift and a
permutation. The permutation function is the same for each round, but a different subkey
is produced because of the repeated shifts of the key bits.
Initial Permutation
The initial permutation and its inverse are defined by tables, as shown in Tables 3.2a and
3.2b, respectively. The tables are to be interpreted as follows. The input to a table
consists of 64 bits numbered from 1 to 64. The 64 entries in the permutation table contain
a permutation of the numbers from 1 to 64. Each entry in the permutation table indicates
the position of a numbered input bit in the output, which also consists of 64 bits.
Security of computers and networks Fourth stage
Security of computers and networks Fourth stage
Security of computers and networks Fourth stage
The round key Ki is 48 bits. The R input is 32 bits. This R input is first expanded to 48
bits by using a table that defines a permutation plus an expansion that involves
duplication of 16 of the R bits (Table 3.2c). The resulting 48 bits are XORed with Ki.
Security of computers and networks Fourth stage
This 48-bit result passes through a substitution function that produces a 32-bit output,
which is permuted as defined by Table 3.2d.
The role of the S-boxes in the function F is illustrated in Figure 1.14. The
substitution consists of a set of eight S-boxes, each of which accepts 6 bits as input and
produces 4 bits as output. These transformations are defined in Table 3.3, which is
interpreted as follows: The first and last bits of the input to box Si form a 2-bit binary
number to select one of four substitutions defined by the four rows in the table for Si. The
middle four bits select one of the sixteen columns. The decimal value in the cell selected
by the row and column is then converted to its 4-bit representation to produce the output.
For example, in S1 for input 011001, the row is 01 (row 1) and the column is 1100
(column 12). The value in row 1, column 12 is 9, so the output is 1001.
Each row of an S-box defines a general reversible substitution. Figure 3.1 may be
useful in understanding the mapping. The figure shows the substitution for row 0 of box
S1.
The operation of the S-boxes is worth further comment. Ignore for the moment the
contribution of the key (Ki). If you examine the expansion table, you see that the 32 bits
of input are split into groups of 4 bits, and then become groups of 6 bits by taking the
outer bits from the two adjacent groups. For example, if part of the input word is
M = 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100
1101 1110 1111
L = 0000 0001 0010 0011 0100 0101 0110 0111
R = 1000 1001 1010 1011 1100 1101 1110 1111
The first bit of M is "0". The last bit is "1". We read from left to right.
DES operates on the 64-bit blocks using key sizes of 56- bits. The keys are
actually stored as being 64 bits long, but every 8th bit in the key is not used
(i.e. bits numbered 8, 16, 24, 32, 40, 48, 56, and 64). However, we will
nevertheless number the bits from 1 to 64, going left to right, in the following
calculations. But, as you will see, the eight bits just mentioned get eliminated
when we create subkeys.
The 64-bit key is permuted according to the following table, PC-1. Since the
first entry in the table is "57", this means that the 57th bit of the original key
K becomes the first bit of the permuted key K+. The 49th bit of the original
key becomes the second bit of the permuted key. The 4th bit of the original
key is the last bit of the permuted key. Note only 56 bits of the original key
appear in the permuted key.
Security of computers and networks Fourth stage
PC-1
57 49 41 33 25 17 9
1 58 50 42 34 26 18
10 2 59 51 43 35 27
19 11 3 60 52 44 36
63 55 47 39 31 23 15
7 62 54 46 38 30 22
14 6 61 53 45 37 29
21 13 5 28 20 12 4
Next, split this key into left and right halves, C0 and D0, where each half has 28 bits.
With C0 and D0 defined, we now create sixteen blocks Cn and Dn, 1<=n<=16. Each pair
of blocks Cn and Dn is formed from the previous pair Cn-1 and Dn-1, respectively, for n =
1, 2, ..., 16, using the following schedule of "left shifts" of the previous block. To do a
left shift, move each bit one place to the left, except for the first bit, which is cycled to
the end of the block.
Iteration Number of
Number Left Shifts
1 1
2 1
3 2
4 2
5 2
6 2
7 2
8 2
9 1
10 2
11 2
12 2
13 2
14 2
15 2
16 1
Security of computers and networks Fourth stage
This means, for example, C3 and D3 are obtained from C2 and D2, respectively, by two
left shifts, and C16 and D16 are obtained from C15 and D15, respectively, by one left shift.
In all cases, by a single left shift is meant a rotation of the bits one place to the left, so
that after one left shift the bits in the 28 positions are the bits that were previously in
positions 2, 3,..., 28, 1.
C0 = 1111000011001100101010101111
D0 = 0101010101100110011110001111
C1 = 1110000110011001010101011111
D1 = 1010101011001100111100011110
C2 = 1100001100110010101010111111
D2 = 0101010110011001111000111101
C3 = 0000110011001010101011111111
D3 = 0101011001100111100011110101
C4 = 0011001100101010101111111100
D4 = 0101100110011110001111010101
C5 = 1100110010101010111111110000
D5 = 0110011001111000111101010101
C6 = 0011001010101011111111000011
D6 = 1001100111100011110101010101
C7 = 1100101010101111111100001100
D7 = 0110011110001111010101010110
C8 = 0010101010111111110000110011
D8 = 1001111000111101010101011001
C9 = 0101010101111111100001100110
D9 = 0011110001111010101010110011
C10 = 0101010111111110000110011001
D10 = 1111000111101010101011001100
C11 = 0101011111111000011001100101
D11 = 1100011110101010101100110011
C12 = 0101111111100001100110010101
D12 = 0001111010101010110011001111
Security of computers and networks Fourth stage
C13 = 0111111110000110011001010101
D13 = 0111101010101011001100111100
C14 = 1111111000011001100101010101
D14 = 1110101010101100110011110001
C15 = 1111100001100110010101010111
D15 = 1010101010110011001111000111
C16 = 1111000011001100101010101111
D16 = 0101010101100110011110001111
We now form the keys Kn, for 1<=n<=16, by applying the following permutation table to
each of the concatenated pairs CnDn. Each pair has 56 bits, but PC-2 only uses 48 of
these. PC-2
14 17 11 24 1 5
3 28 15 6 21 10
23 19 12 4 26 8
16 7 27 20 13 2
41 52 31 37 47 55
30 40 51 45 33 48
44 49 39 56 34 53
46 42 50 36 29 32
Therefore, the first bit of Kn is the 14th bit of CnDn, the second bit the 17th, and so on,
ending with the 48th bit of Kn being the 32th bit of CnDn.
Example: For the first key we have C1D1 = 1110000 1100110 0101010 1011111
1010101 0110011 0011110 0011110
There is an initial permutation IP of the 64 bits of the message data M. This rearranges
the bits according to the following table, where the entries in the table show the new
arrangement of the bits from their initial order. The 58th bit of M becomes the first bit of
IP. The 50th bit of M becomes the second bit of IP. The 7th bit of M is the last bit of IP.
IP
58 50 42 34 26 18 10 2
60 52 44 36 28 20 12 4
62 54 46 38 30 22 14 6
64 56 48 40 32 24 16 8
57 49 41 33 25 17 9 1
59 51 43 35 27 19 11 3
61 53 45 37 29 21 13 5
63 55 47 39 31 23 15 7
Example: Applying the initial permutation to the block of text M, given previously, we
get
M = 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110
1111
IP = 1100 1100 0000 0000 1100 1100 1111 1111 1111 0000 1010 1010 1111 0000 1010
1010
Here the 58th bit of M is "1", which becomes the first bit of IP. The 50th bit of M is "1",
which becomes the second bit of IP. The 7th bit of M is "0", which becomes the last bit
of IP.
Next divide the permuted block IP into a left half L0 of 32 bits, and a right half R0 of 32
bits.
We now proceed through 16 iterations, for 1<=n<=16, using a function f which operates
on two blocks--a data block of 32 bits and a key Kn of 48 bits--to produce a block of 32
bits. Let + denote XOR addition, (bit-by-bit addition modulo 2). Then for n going
from 1 to 16 we calculate
Ln= Rn-1
Rn = Ln-1 + f(Rn-1,Kn)
This results in a final block, for n = 16, of L16R16. That is, in each iteration, we take the
right 32 bits of the previous result and make them the left 32 bits of the current step. For
the right 32 bits in the current step, we XOR the left 32 bits of the previous step with the
calculation f .
It remains to explain how the function f works. To calculate f, we first expand each block
Rn-1 from 32 bits to 48 bits. This is done by using a selection table that repeats some of
the bits in Rn-1 . We'll call the use of this selection table the function E. Thus E(Rn-1) has
a 32 bit input block, and a 48 bit output block.
Let E be such that the 48 bits of its output, written as 8 blocks of 6 bits each, are obtained
by selecting the bits in its inputs in order according to the following table:
E BIT-SELECTION TABLE
32 1 2 3 4 5
4 5 6 7 8 9
8 9 10 11 12 13
12 13 14 15 16 17
16 17 18 19 20 21
20 21 22 23 24 25
24 25 26 27 28 29
28 29 30 31 32 1
Thus the first three bits of E(Rn-1) are the bits in positions 32, 1 and 2 of Rn-1 while the
last 2 bits of E(Rn-1) are the bits in positions 32 and 1.
(Note that each block of 4 original bits has been expanded to a block of 6 output bits.)
Security of computers and networks Fourth stage
Next in the f calculation, we XOR the output E(Rn-1) with the key Kn:
Kn + E(Rn-1).
We have not yet finished calculating the function f . To this point we have expanded Rn-1
from 32 bits to 48 bits, using the selection table, and XORed the result with the key Kn .
We now have 48 bits, or eight groups of six bits. We now do something strange with
each group of six bits: we use them as addresses in tables called "S boxes". Each group
of six bits will give us an address in a different S box. Located at that address will be a 4
bit number. This 4 bit number will replace the original 6 bits. The net result is that the
eight groups of 6 bits are transformed into eight groups of 4 bits (the 4-bit outputs from
the S boxes) for 32 bits total.
Kn + E(Rn-1) =B1B2B3B4B5B6B7B8,
S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8)
To repeat, each of the functions S1, S2,..., S8, takes a 6-bit block as input and yields a 4-
bit block as output. The table to determine S1 is shown and explained below:
S1
Column Number
Row
No. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7
1 0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8
2 4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0
3 15 12 8 2 4 9 1 7 5 11 3 14 10 0 6 13
If S1 is the function defined in this table and B is a block of 6 bits, then S1(B) is
determined as follows: The first and last bits of B represent in base 2 a number in the
decimal range 0 to 3 (or binary 00 to 11). Let that number be i. The middle 4 bits of B
represent in base 2 a number in the decimal range 0 to 15 (binary 0000 to 1111). Let that
Security of computers and networks Fourth stage
number be j. Look up in the table the number in the i-th row and j-th column. It is a
number in the range 0 to 15 and is uniquely represented by a 4 bit block. That block is the
output S1(B) of S1 for the input B. For example, for input block B = 011011 the first bit is
"0" and the last bit "1" giving 01 as the row. This is row 1. The middle four bits are
"1101". This is the binary equivalent of decimal 13, so the column is column number 13.
In row 1, column 13 appears 5. This determines the output; 5 is binary 0101, so that the
output is 0101. Hence S1(011011) = 0101.
14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7
0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8
4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0
15 12 8 2 4 9 1 7 5 11 3 14 10 0 6 13
S2
15 1 8 14 6 11 3 4 9 7 2 13 12 0 5 10
3 13 4 7 15 2 8 14 12 0 1 10 6 9 11 5
0 14 7 11 10 4 13 1 5 8 12 6 9 3 2 15
13 8 10 1 3 15 4 2 11 6 7 12 0 5 14 9
S3
10 0 9 14 6 3 15 5 1 13 12 7 11 4 2 8
13 7 0 9 3 4 6 10 2 8 5 14 12 11 15 1
13 6 4 9 8 15 3 0 11 1 2 12 5 10 14 7
1 10 13 0 6 9 8 7 4 15 14 3 11 5 2 12
S4
7 13 14 3 0 6 9 10 1 2 8 5 11 12 4 15
13 8 11 5 6 15 0 3 4 7 2 12 1 10 14 9
10 6 9 0 12 11 7 13 15 1 3 14 5 2 8 4
3 15 0 6 10 1 13 8 9 4 5 11 12 7 2 14
S5
2 12 4 1 7 10 11 6 8 5 3 15 13 0 14 9
14 11 2 12 4 7 13 1 5 0 15 10 3 9 8 6
4 2 1 11 10 13 7 8 15 9 12 5 6 3 0 14
11 8 12 7 1 14 2 13 6 15 0 9 10 4 5 3
S6
12 1 10 15 9 2 6 8 0 13 3 4 14 7 5 11
10 15 4 2 7 12 9 5 6 1 13 14 0 11 3 8
9 14 15 5 2 8 12 3 7 0 4 10 1 13 11 6
4 3 2 12 9 5 15 10 11 14 1 7 6 0 8 13
Security of computers and networks Fourth stage
S7
4 11 2 14 15 0 8 13 3 12 9 7 5 10 6 1
13 0 11 7 4 9 1 10 14 3 5 12 2 15 8 6
1 4 11 13 12 3 7 14 10 15 6 8 0 5 9 2
6 11 13 8 1 4 10 7 9 5 0 15 14 2 3 12
S8
13 2 8 4 6 15 11 1 10 9 3 14 5 0 12 7
1 15 13 8 10 3 7 4 12 5 6 11 0 14 9 2
7 11 4 1 9 12 14 2 0 6 10 13 15 3 5 8
2 1 14 7 4 10 8 13 15 12 9 0 3 5 6 11
Example: For the first round, we obtain as the output of the eight S boxes:
f = P(S1(B1)S2(B2)...S8(B8))
The permutation P is defined in the following table. P yields a 32-bit output from a 32-bit
input by permuting the bits of the input block.
P
16 7 20 21
29 12 28 17
1 15 23 26
5 18 31 10
2 8 24 14
32 27 3 9
19 13 30 6
22 11 4 25
R1 = L0 + f(R0 , K1 )
Security of computers and networks Fourth stage
In the next round, we will have L2 = R1, which is the block we just calculated, and then
we must calculate R2 =L1 + f(R1, K2), and so on for 16 rounds. At the end of the sixteenth
round we have the blocks L16 and R16. We then reverse the order of the two blocks into
the 64-bit block R16L16
40 8 48 16 56 24 64 32
39 7 47 15 55 23 63 31
38 6 46 14 54 22 62 30
37 5 45 13 53 21 61 29
36 4 44 12 52 20 60 28
35 3 43 11 51 19 59 27
34 2 42 10 50 18 58 26
33 1 41 9 49 17 57 25
That is, the output of the algorithm has bit 40 of the preoutput block as its first
bit, bit 8 as its second bit, and so on, until bit 25 of the preoutput block is the
last bit of the output.
Example: If we process all 16 blocks using the method defined previously, we get, on
the 16th round,
We reverse the order of these two blocks and apply the final permutation to
Decryption is simply the inverse of encryption, follwing the same steps as above, but
reversing the order in which the subkeys are applied.
Security of computers and networks Fourth stage
the encryption is not the same as the key for the decryption. Each user has 2 keys: a
Public Key, which is known to all, and a Private Key, which is kept secret (private).
Public-key cryptography provides a radical departure from all that has gone before. For
one thing, public-key algorithms are based on mathematical functions rather than on
substitution and permutation. More important, public-key cryptography is asymmetric,
involving the use of two separate keys, in contrast to symmetric encryption, which uses
only one key. The use of two keys has profound consequences in the areas of
confidentiality, key distribution, and authentication
The concept of public-key cryptography evolved from an attempt to attack two
of the most difficult problems associated with symmetric encryption. The first
problem is that of key distribution. Key distribution under symmetric encryption
requires either (1) that two communicants already share a key, which somehow
has been distributed to them; or (2) the use of a key distribution center.
The second is the authentication the way that identifies the sender.
The first use of public key cryptography is for encrypting messages to Bob. Anyone who
wishes to send an encrypt
(M).
Message Message
Yes/No, Message
Verification (M) , Authentication
The encryption (or verification) algorithm and the decryption (or authentication)
algorithms may or may not be the same.
The table below summarizes some of the important aspects of symmetric (Private-Key
Cryptography) and public-key encryption. To discriminate between the two, we refer
to the key used in symmetric encryption as a secret key (Private-Key Cryptography)
and asymmetric (Public-Key Cryptography)
RSA Algorithm
The algorithm was developed 1977 by Ron Rivest, Adi Shamir, and Len Adleman at
MIT and first published in 1978. The RSA scheme has since that time reigned supreme as
the most widely accepted and implemented general-purpose approach to public-key
encryption.
It is a block cipher in which the plaintext and ciphertext are integers between 0 and n 1
for some n.
- Calculate
- Select integer e where:
- Calculate where:
- Public Key
- Private Key
Example:
Suppose p=17, q=11. Using RSA to encrypt the message M=88
Solution:
- n=p*q 17*11 =
- -1)(q-1) = 16*10
=
- choose verifies
then
- choose verifies , then
- PU={7, 187}
- PR={23,17,11}
The decryption:
b
Example: what is the Result of the Fast Modular Exponentiation Algorithm for a mod n,
where a = 7, b = 560, n = 561.
Solution:
Note that the variable c is not needed; it is included for explanatory purposes. The final
value of c is the value of the exponent. Note: The integer b is expressed as a binary
number bk bk-1 ... b0. The value of b should convert to binary scheme, so b=
1000110000. Table below shows the result of algorithm application
Security of computers and networks Fourth stage
Assignment:
1. If p=61, q= 53, e=17 and the encrypted message C= 855. What is the original
message m?
2. The ciphertext C =10 sent to a user whose public key is e=5, n=35. What is the
plaintext M?
A . Direct authentication
1.Based on a shared secret master key
2.Based on a public-key system
3.Diffie-Hellman
B . Mediated authentication
1.Based on key distribution centers
.kerberos.
In this chapter we examined the problem of the distribution of secret keys. One of the
major roles of public-key encryption has been to address the problem of key distribution.
There are actually two distinct aspects to the use of public-key cryptography in this
regard:
1. The distribution of public keys
2. The use of public-key encryption to distribute secret keys
We examine each of these areas in turn.
send his or her public key to any other participant or broadcast the key to the community
at large
Although this approach is convenient, it has a major weakness. Anyone can forge such a
public announcement. That is, some user could pretend to be user A and send a public
key to another participant or broadcast such a public key. Until such time as user A
discovers the forgery and alerts other participants, the forger is able to read all encrypted
messages intended for A and can use the forged keys for authentication.
Public-Key Publication
Security of computers and networks Fourth stage
This scheme is clearly more secure than individual public announcements but still has
vulnerabilities. If an adversary succeeds in obtaining or computing the private key of the
directory authority, the adversary could authoritatively pass out counterfeit public keys
and subsequently impersonate any participant and eavesdrop on messages sent to any
participant. Another way to achieve the same end is for the adversary to tamper with the
records kept by the authority.
Public-Key Authority
Stronger security for public-key distribution can be achieved by providing tighter control
over the distribution of public keys from the directory. A typical scenario is illustrated as
in Figure below. As before, the scenario assumes that a central authority maintains a
dynamic directory of public keys of all participants. In addition, each participant reliably
knows a public key for the authority, with only the authority knowing the corresponding
private key. The following steps (matched by number to Figure below) occur:
1. A sends a time stamped message to the public-key authority containing a request for
the current public key of B.
2. The authority responds with a message that is encrypted using the authority's private
key, PRauth Thus, A is able to decrypt the message using the authority's public key.
Therefore, A is assured that the message originated with the authority. The message
includes the following:
B's public key, PUb which A can use to encrypt messages destined for B
The original request, to enable A to match this response with the corresponding
earlier request and to verify that the original request was not altered before
reception by the authority
The original timestamp, so A can determine that this is not an old message
from the authority containing a key other than B's current public key
3. A stores B's public key and also uses it to encrypt a message to B containing an
identifier of A (IDA) and a nonce (N1), which is used to identify this transaction
uniquely.
4, B retrieves A's public key from the authority in the same manner as A retrieved B's
public key.
5. At this point, public keys have been securely delivered to A and B, and they may
begin their protected exchange. However, two additional steps are desirable:
6. B sends a message to A encrypted with PUa and containing A's nonce (N1) as well as
a new nonce generated by B (N2) Because only B could have decrypted message, the
presence of N1 in message assures A that the correspondent is B.
7. A returns N2, encrypted using B's public key, to assure B that its correspondent is A.
Security of computers and networks Fourth stage
Thus, a total of seven messages are required. However, the initial four messages need be
used only infrequently because both A and B can save the other's public key for future
use, a technique known as caching. Periodically, a user should request fresh copies of the
public keys of its correspondents to ensure currency.
Public-Key Certificates
The scenario of above Figure is attractive, yet it has some drawbacks. The public-key
authority could be somewhat of a bottleneck in the system, for a user must appeal to the
authority for a public key for every other user that it wishes to contact. As before, the
directory of names and public keys maintained by the authority is vulnerable to
tampering.
In essence, a certificate consists of a public key plus an identifier of the key owner, with
the whole block signed by a trusted third party. Typically, the third party is a certificate
authority, such as a government agency or a financial institution, that is trusted by the
user community. A user can present his or her public key to the authority in a secure
manner, and obtain a certificate. The user can then publish the certificate. Anyone needed
this user's public key can obtain the certificate and verify that it is valid by way of the
attached trusted signature. A participant can also convey its key information to another
by transmitting its certificate. Other participants can verify that the certificate was created
by the authority. We can place the following requirements on this scheme:
1. Any participant can read a certificate to determine the name and public key of the
certificate's owner.
2. Any participant can verify that the certificate originated from the certificate
authority and is not counterfeit.
3. Only the certificate authority can create and update certificates.
4. Any participant can verify the currency of the certificate.
Security of computers and networks Fourth stage
A certificate scheme is illustrated in the following Figure. Each participant applies to the
certificate authority, supplying a public key and requesting a certificate.
A and B can now securely communicate using conventional encryption and the session
key Ks. At the completion of the exchange, both A and B discard K s. Despite its
simplicity, this is an attractive protocol. No keys exist before the start of the
communication and none exist after the completion of communication. Thus, the risk of
compromise of the keys is minimal. At the same time, the communication is secure from
eavesdropping.
Security of computers and networks Fourth stage
The protocol depicted in the above Figure is insecure against an adversary who can
intercept messages and then either relay the intercepted message or substitute another
message.
2. B sends a message to A encrypted with PUa and containing A's nonce (N1) as well as
a new nonce generated by B (N2) Because only B could have decrypted message (1),
the presence of N1 in message (2) assures A that the correspondent is B.
3. A returns N2 encrypted using B's public key, to assure B that its correspondent is A.
4. A selects a secret key Ks and sends M = E(PUb, E(PRa, Ks)) to B. Encryption of this
message with B's public key ensures that only B can read it; encryption with A's
private key ensures that only A could have sent it.
5. B computes D(PUa, D(PRb, M)) to recover the secret key.
Notice that the first three steps of this scheme are the same as the last three steps of the
above Figure. The result is that this scheme ensures both confidentiality and
authentication in the exchange of a secret key.
following way. First, we define a primitive root of a prime number p as one whose
powers modulo p generate all the integers from 1 to p 1. That is, if a is a primitive root of
the prime number p, then the numbers
a mod p, a2 mod p,..., ap-1 mod p
are distinct and consist of the integers from 1 through p 1 in some permutation.
For any integer b and a primitive root a of prime number p, we can find a unique
exponent i such that
b ai (mod p i p - 1)
The exponent i is referred to as the discrete logarithm of b for the base a, mod p.
The Algorithm
The Diffie-Hellman key exchange algorithm. For this scheme, there are two publicly
known numbers: a prime number q and an integer that is a primitive root of q.
Security of computers and networks Fourth stage
The result is that the two sides have exchanged a secret value as shown in Figure below.
The security of the Diffie-Hellman key exchange lies in the fact that, while it is relatively
easy to calculate exponentials modulo a prime, it is very difficult to calculate discrete
logarithms. For large primes, the latter task is considered infeasible.
Here is an example. Key exchange is based on the use of the prime number q = 353 and a
A = 97 and XB =
233, respectively. Each computes its public key:
A computes YA = 397 mod 353 = 40.
B computes YB = 3233 mod 353 = 248.
After they exchange public keys, each can compute the common secret key:
A computes K = (YB)XA mod 353 = 24897 mod 353 =160.
B computes K = (YA)XB mod 353 = 40233 mod 353 = 160.
Security of computers and networks Fourth stage
2. AS verifies user's access right in database, creates ticket-granting ticket and session
key. Results are encrypted using key derived from user's password.
3. User Alice uses password to decrypt incoming message, then sends ticket and
authenticator that contains user's name, network address, and time to Ticket Granting
Server (TGS).
4. TGS decrypts ticket and authenticator, verifies request, then creates ticket for
requested server (Bob).
6. Server verifies that ticket and authenticator match, then grants access to service.
Security of computers and networks Fourth stage
Text:
Network Security: The Complete Reference, Bragg, Rhodes-Ousley, Strassberg et al.
Extranet: Enables two or more companies to share common information & resources by extending the
intranet
Accommodates business-to-business communication (B2B): post orders, share projects, share pricing,
communicate collaboratively.
Extranets can introduce weaknesses in security.
Virtual Private Network (VPN): A means of carrying private traffic over a public network
Uses link encryption to give users sense that they are operating on a private network when they are
actually transmitting over a public network
Communications pass through an encrypted tunnel
Intranet VPN: Connects two or more private networks within the same company
Extranet VPN: Connects two or more private networks between different companies (for B2B or
business-to-business communications).
Remote Access VPN: A roaming user has access to a private network via wireless, hotel room, etc.
Security of computers and networks Fourth stage
End-to-End Encryption
Link Encryption
Comparison:
Link End-to-End
Purpose Link itself is vulnerable: Intermediate nodes may be
Packet sniffers & compromised
eavesdroppers
Encryption coverage Link-Specific: All packets Connection-Specific: A
transmitted on the single connection is encrypted
link are encrypted across all its links
Protocol header security Encrypted for all protocol Encrypted for upper layer
layers (at or above layers 1 protocols only
or 2)
Network device exposure Intermediate nodes decrypt Intermediate nodes cannot
decrypt
Authentication Provides node Provides user authentication
authentication
Ease of use Transparent to user, Not user-transparent,
One key per link One key per connection
User Selectivity of One algorithm for all users User selects encryption
algorithm algorithm
Implementation Encryption done in Encryption done in
hardware hardware or software
Applications Virtual Private Network Secure Shell (SSH)
(VPN) SSL
Pretty Good Privacy (PGP)
Security of computers and networks Fourth stage
- -
Encryption by Application
Applications are encrypted on a case by case basis.
Secure Shell (SSH): Provides an authenticated and encrypted remote login and file transfer capability.
Can tunnel XWindows, ftp, POP-3, IMAP-
Authenticates before allowing connection
Generates a public/private key pair; notifies partner systems of public key
SSH protocol negotiates the encryption algorithm: DES, IDEA, AES and the authentication algorithm:
public key & Kerberos.
SSH2: Can negotiate between 3DES, IDEA, Blowfish, Twofish, Arcfour, Cast
SSHv2 is more secure than SSHv1, which has numerous exploits
Uses port 22 for all applications
SSH is free or minimal cost for commercial version
Secure Sockets Layer (SSL): Protects communication above the transport level: Web
Certificate-based system created by Netscape to protect web page communications
Implemented by Netscape & Microsoft Explorer and other browsers widely available
When SSL & HTTP used together is called HTTPS
Standardized in IETF as Transport Layer Security (TLS) which is nearly equal to SSLv3 but
incompatible (RFC 2246)
URL name starts as https:// - also key or lock icon displays at bottom corner.
Client initiates negotiation of security parms. However server may negotiate to lesser security
Client authenticates server certificate using public key encryption and possibly vice versa
Secure Hypertext Transport Protocol (SHTTP): Extends HTTP protocol to protect each message
sent between 2 computers.
Summarize the difference between HTTP and HTTPS
Secure Multipurpose Internet Mail Extensions (S/MIME): An Internet standard for secure email
attachments
MIME: Protocol specification dictates how multimedia data and email attachments are transferred: E.g.,
Header=Image, subtype=jpeg.
Used for encryption and digital signatures
Encrypts many types of attachments: spreadsheets, graphics, presentations, movies, sound.
Uses public key certificates, in X.509 format, for authentication and key exchange
Can negotiate from a set of encryption algorithms: DES, AES, RC2
Integrated into many commercial email packages, including sendmail.
Security of computers and networks Fourth stage
Secure Electronic Transaction (SET): Protects credit card transactions on the Internet
Requested by MasterCard and Visa in 1996
Provides trust by use of X.509 digital certificates
Ensures privacy & secure communications
Discussion: What info is visible (unencrypted) in the SSL packets? In the PGP or S/MIME packets?