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

Chapter Three

Basic Concepts of Cryptography System

Instructor: Zufan W.

03/11/2024 Computer Security 1


Basic Concepts of Cryptography System

 Under this Chapter We Discuss about~~~


 Cryptology, Cryptography ,Cryptanalysis & Cryptosystem
 Cryptography: Symmetric-key and Asymmetric-key Cryptography
 Symmetric-key Cryptography: Modern and Classical Cryptography
 Modern Cryptography: Block, and Stream Cipher
 Classical Cryptography: Substitution and Transposition Cipher

 Substitution Cipher: One-Time Pad, Caesar,Mono-alphabetic,Poly-


alphabetic,Vignere
 Transposition Cipher: Rail Fence and Columnar Transposition
03/11/2024 Computer Security 2
Introduction of Cryptography System

 Cryptology is combination of two words Crypto


and logy.
 Crypto means” secret” and logy means “science”
 So, Cryptology is the science of secrets.
 Cryptology is a field /branch of mathematics which
deals with both cryptography & cryptanalysis
 Thus, Cryptology =Cryptography + Cryptanalysis

03/11/2024 Computer Security 3


Introduction of Cryptography System

Cryptography
 Cryptography is come from Greek Words Crypto
“secret”/ “hidden” and graphy “writing”.

 Thus, Cryptography Secret Writing

 Cryptography: Schemes for encryption &


decryption

 So Cryptography which deals with the actual


securing of digital data.

03/11/2024 Computer Security 4


Introduction of Cryptography System
 Cryptanalysis is an art and science of breaking the
cipher text.
 It is a science of recovering the plaintext from the
cipher text or art of breaking cryptosystems.

 Goal cryptanalysis to obtain plain text, key , both

A Cryptosystem/Cipher system is an
implementation of cryptographic techniques and
their supplementary infrastructure to provide
information security services.

03/11/2024 Computer Security 5


Introduction of Cryptography System
Why we the need for Cryptography/ Encryption
 Even If, If you have the best firewall, very tight security policies,
secure operating systems, virus scanners, intrusion-detection
software, antispyware, and every other computer security angle
covered but sending plain text, data then are not secure.
 B/c Encryption ensure the security of plain text data on the
communication
 Encryption is useful to protect messages from Intruders or
Eavesdropping (listening the message) …. (confidentiality)
 Modifying a plaintext is easy, but modifying encrypted messages
is difficult.
 Inserting new message into a cipher text is difficult ……
(integrity)
03/11/2024 Computer Security 6
Basic Components five (Ingredients) of a Cryptosystem

 Plaintext (P)- the original form of a message


 Cipher text (C)- the coded/encrypted form of a message

 Key(K) – is string of numbers or characters that used in


cipher known only by the sender/receiver.
 Larger key size means greater security but may decrease
the speed encryption/decryption

 Cipher (Encrypt/E) – an algorithm/ procedures used to


transform or converting plaintext to cipher text.

 Decipher(Decrypt/D):recovering plaintext from cipher


text !!!
03/11/2024 Computer Security 7
The r/ship Components of a Cryptosystem

03/11/2024 Computer Security 8


Cryptography System Categorized into Symmetric-
key and Asymmetric-key Cryptography.

03/11/2024 Computer Security 9


Symmetric Cryptography System
 Both the sender and receiver share a single key.  Symmetric-Key
 Secret-Key/
 The sender uses this key to encrypt plaintext and send the  Private Key /
cipher text to the receiver.  Single-Key
Cryptography:
 The receiver use this shared secret key for System

Decipher/Decrypt the cipher text .


Description
 A sender S wants to transmit message M to a receiver R
 To protect the message M, the sender first encrypts it into
an unintelligible message M’
 After receipt of M’, R decrypts the message to obtain M
 M is called the plaintext: what we want to encrypt
 M’ is called the ciphertext, the encrypted output

03/11/2024 Computer Security 10


Symmetric Cryptography System

03/11/2024 Computer Security 11


Symmetric Cryptography System

 Symmetric  The main disadvantage of a


cryptography system symmetric cryptosystem is
simple and faster, but less related to the exchange of keys.
secured.
03/11/2024 Computer Security 12
Asymmetric-key /Public-Key Cryptography System
 Used two related keys public and private
 Public key for encryption &
Asymmetric-key
Cryptography System  Private key for decryption respectively.
 Public key may be freely distributed as public, but
does not imply that the key is accessible to any
subject rather, it means availability to authorized
subject, while its paired private key, remains a
secret.
 Asymmetric-key is more secure and relatively

03/11/2024
complex. Computer Security 13
Asymmetric-key /Public-Key Cryptography System

03/11/2024 Computer Security 14


Symmetric Cryptography System
Symmetric
Cryptography

Classical Modern
Cryptography Cryptograph

Transposition Substitution Stream Block


Cipher Cipher Cipher Cipher

03/11/2024 Computer Security 15


Modern Ciphers

Modern Ciphers
The modern ciphers or encryption could
be conducted in to either Block Ciphers or
Stream Cipher -----XOR

Stream Cipher
A stream cipher is one that encrypts a
digital data stream one bit or one byte at
a time.

03/11/2024 Computer Security 16


Modern Ciphers

Stream Ciphers :commonly work as follows:


 Encrypt data one bit or one byte at a time.
 A single character of plaintext is combined with XOR
a single character of a keystream to produce a 000
single character of cipher text. 110
011
101
 The cipher text character from step 1 is sent to
the receiver.
 Steps 1 and 2 are repeated until the entire
message has been sent.

03/11/2024 Computer Security 17


Modern Ciphers

We use XOR Operator


Plain Text 1 0 1 0 0 1 1 1

XOR
Key 0 1 0 1 0 1 0 1
000
110
Cipher Text 1 1 1 1 0 0 1 0
011
101

Key 0 1 0 1 0 1 0 1

Cipher Text 1 1 1 1 0 0 1 0

Plain Text 1 0 1 0 0 1 1 1

03/11/2024 Computer Security 18


Modern Ciphers

Block Ciphers
 In block cipher, a block of plaintext characters of a
fixed size is encrypted at once to produce a cipher
text block of equal length and sent to the receiver.

 Typically, a block size of 64 or 128 bits is used.

 The process is repeated until the entire plaintext


message has been sent.

03/11/2024 Computer Security 19


Block Ciphers

 Plain Text= 100010010011010 0101011101111001 1001101110111100 1101111111110001


 Key= 0101 0101 0110 0110
 XOR

P TXT 1010 1001 0011 0100 0101 0111 0111 1001 1001 1011 1011 1100 1101 1111 1111 0001

Key 0101 0101 0110 0110 0101 0101 0110 0110 0101 0101 0110 0110 0101 0101 0110 0110

Block 1111 1100 0101 0010


Cipher
Key 0101 0101 0110 0110
Block 1111 1100 0101 0010
Cipher
P TXT

03/11/2024 Computer Security 20


Block Ciphers

 Let us assign a numerical equivalent to each letter

 Class Activity
Plain text: YOUR NAME TSEGGAYE
Key: ETHIOPIA

03/11/2024 Computer Security 21


Classical Cryptography
Classical Cryptography can be
 Substitution Ciphers or
 Transposition Ciphers /cryptography

 Substitution cryptography is one of classical


cryptography which have series of steps to
convert plaintext to cipher text.

 Substitution cryptography is a technique in


which each letter or bit of plaintext is
substituted or replaced by some other letter,
number or symbols to produce cipher text. E.g.
ABCXYZ
03/11/2024 Computer Security 22
Classical Cryptography
Type of Substitution Ciphers
One-time Pad Cipher ----- +
Caesar Cipher
Mono-alphabetic substitution
Poly-alphabetic substitutions
Vignere Cipher

03/11/2024 Computer Security 23


Classical Cryptography
Type of Substitution Ciphers
One-Time Pad Ciphers
It is one of the Substitution techniques which
converts plain text into cipher text.
It is a method of encrypting alphabetic plain text.
In this mechanism, we assign a number to each
character of the Plain-Text.
Each new message requires a new key of the
same length as the new message.
Such a scheme, known as a one-time pad, it is
unbreakable
03/11/2024 Computer Security 24
Classical Cryptography
Type of Substitution Ciphers
One-Time Pad Ciphers
 Since for any plain text and any cipher text
there exists a key mapping one to other.

 The key should be randomly generated as long


as the size of the message.

 The cipher text generated by the One-Time pad


is random, so it does not have any statistical
relation with the plain text.

 The length of the output cipher text is equal to


the length of the original plain text of input.
03/11/2024 Computer Security 25
Classical Cryptography
Type of Substitution Ciphers
One-Time Pad Ciphers
The two requirements for the One-Time pad are:
 The key should be randomly generated as
long as the same size of the message.

 The key is to be used to encrypt and decrypt


a single message, and then it is discarded.

03/11/2024 Computer Security 26


Classical Cryptography
Type of Substitution Ciphers
One-time-pad Algorithm description
1. Treat each plain text alphabet as a number in increasing
sequence like (A= 0, B=1, C=2 . . .Z=25)

2. Do the same for each character of the input cipher text.

3. Add each number corresponding to the plain text alphabet


to the corresponding output cipher text alphabet number.

4. If the sum thus produced is greater than 26, subtract 26


from it.
5.Translate each number of the sum back to the
corresponding alphabet.
03/11/2024 Computer Security 27
Modern Ciphers

One-time-pad Algorithm Example


 Apply the One-time-pad encryption algorithm,
 Plain text: HOW ARE YOU
 One-time-pad key : NCBTZQARX
 Cipher text message: C= UQXTRUYFR
 Let us assign a numerical equivalent to each letter

03/11/2024 Computer Security 28


Modern Ciphers

One-time-pad Algorithm Example


 Plain text: HOW ARE YOU
 One-time-pad key : NCBTZQARX
 Cipher text message: C= UQXTRUYFR
Plain Text
H O W A R E Y O U
7 14 22 0 17 4 24 14 20
One-time pad key
N C B T Z Q A R X
13 2 1 19 25 16 0 17 23
Cipher Text
20 16 23 19 42=16 20 24 31=5 43=17
U Q X T Q U Y F R

03/11/2024 Computer Security 29


Type of Substitution Ciphers
Caesar Cipher
Caesar Cipher is cryptosystem technique of each
letter in the plaintext message is replaced by the
letter three following it.

Means replacing each letter of the alphabet with


the letter standing three places further down the
alphabet.
E.g. in each letter A->D, B->E,….Z->C.(26).

03/11/2024 Computer Security 30


Caesar Cipher

Caesar Cipher can be transformation as:


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

Example: in each word…phrase


meet me after the toga party
PHHW PH DIWHU WKH WRJD SDUWB

Plain text: ARE YOU READY


Cipher text: DUH BRX UHDGB

03/11/2024 Computer Security 31


Caesar Cipher
 Let us assign a numerical equivalent to each letter

 If the Caesar Cipher Key 1 ≤ K ≤ 25

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
if k>25 character Z does not able to encrypt it self thus k can not >25 but k
can be
K<1 thus negative k+26 mod 26 we can get the value
03/11/2024 Computer Security 32
Caesar Cipher

Encrypt plaintext to cipher text by Caesar cipher technique


have the following formula
C=E(P,K)=(P+K) mod (26)
If Key = 3
P=D(C,K)=(C-K ) mod (26) Plain text YOU becomes Cipher text--- BRX
K secret key.
E and D stand for Encryption and Decryption respectively
P and C stand for Plaintext and Cipher text respectively.
P= CRYPTOGRAPHY becomes: by the Caesar Cipher
Ek (p) = FUBSXRJUDSKB

03/11/2024 Computer Security 33


Caesar Cipher

Class Activity quiz :Encrypt and Decrypt the given plain text use the following formula
Plain Text: MY NAME IS
Key=6

C=E(P,K)=(P+K) mod (26)


P=D(C,K)=(C-K) mod (26)
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

03/11/2024 Computer Security 34


Caesar Cipher

Class Activity quiz : If the Caesar Cipher Key 1 ≤ K ≤ 25 all alphabet character
can have the following numerical value

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

03/11/2024 Computer Security 35


Weakness of Caesar cipher

The major weakness of Caesar cipher is it's


predictability.

B/c once we decide to replace an alphabet in


plain text message with an alphabet that is k
position up or down the order.

03/11/2024 Computer Security 36


Mono alphabetic Substitution

The monoalphabetic substitution cipher, is technique that in a


given plain text message each letter can be replaced by any
other random single alphabet per message.

There is no relation between the replacement of a given plain


text message letter and replacement of letter.

03/11/2024 Computer Security 37


Mono alphabetic Substitution

If A is a given plain text message letter, it is replaced by any


other random single letter, B through Z.

Possible keys (Possible of decryption) is the first element can be


chosen in one of n ways, second in n - 1 ways, the third in n – 2
ways, and so on, b/c it can be a permutation of ( all the elements
of) plain text message.

03/11/2024 Computer Security 38


Mono alphabetic Substitution

A permutation of a finite set of elements S is an ordered


sequence of all the elements of S, with each element
appearing exactly once.

For example, if S = {a, b, c}, there are six permutations of


S: abc, acb, bac, bca, cab, cba

03/11/2024 Computer Security 39


Mono alphabetic Substitution

Example: Mono alphabetic Substitution

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 K V Q F I B J W P E S C X H T M Y A U O L R G Z N

Plain: i f w e w i s h t o r e p l a c e l e t t e r s
Cipher: W I R F R W A J U H Y F T S D V F S F U U F Y A

03/11/2024 Computer Security 40


Polyalphabetic Substitutions Cipher
 Polyalphabetic is an advanced substitution
ciphers.
The initial key of polyalphabetic is Three (Caesar
cipher) and sequential multiple key by natural
number (1,2,3,….)= x+2x+3x
Is x is an initial key
E.g. initial key =3=1*3 the next key 3*2,3*3,3*4…

 Sample is the Plaintext is TEXT when it is


decrypted into cipher text WKGF.
03/11/2024 Computer Security 41
Polyalphabetic Substitutions Cipher

Class Activity: Encrypt and Decrypt the given plain text use the following formula
Plain Text: Plaintext is TEXT
Initial Key=3
Initial Key=3 Plaintext is TEXT C=E(P+K)mod 26
Initial Key=3*1=3 Plain Text=T=19 C=19+3=22%26=22=W
 C=E(P,K)=(P+K) mod (26) Next Key=3*2=6 Next Text=E=4 C=4+6=10%26=10=K
 P=D(C,K)=(C-K) mod (26) Next Key=3*3=9 Next Text=X=23 C=23+9=32%26=6=G
Next Key=3*4=12 Next Text=T=19 C=19+12=31%26=5=F
Next Key=…. Cipher is Text=WKGF

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

03/11/2024 Computer Security 42


Polyalphabetic Substitutions Cipher
Example let us see how the word TEXT is changed.
 Plaintext: ABCDEFGHIJKLMNOPQRSTUVWXYZ
 Substitution cipher 1
DEFGHIJKLMNOPQRSTUVWXYZABC T- kaz-W
 Substitution cipher 2
GHIJKLMNOPQRSTUVWXYZABCDEF E-kaz-H-H kaz-K
 Substitution cipher 3
JKLMNOPQRSTUVWXYZABCDEFGHI X- kaz-A-A-kaz-D-D-kaz-G
 Substitution cipher 4
MNOPQRSTUVWXYZABCDEFGHIJKL T-kaz-W-W kaz-Z- kaz –C-C-kaz-F

03/11/2024 Computer Security 43


Vignere Substitution Cipher

The keyword in conjunction with a lookuptable to


encrypt a message.

Note that keyword and lookuptable is used to encrypt a


message.
 Example: Plaintext message: BIG SECRET
Keyword: Lock

Keyword extended to match length of message


Loc klockl
BIG SECRET
BIG SECRET becomes mwicpqvoe………
03/11/2024 Computer Security 44
Lookuptable
03/11/2024 Computer Security 45
Transposition Ciphers

Transposition Ciphers is a technique there is not simply


replace one alphabet with another or number occurrence
instead their position are changed or reordering of
position of plain text is done to produce cipher text.
Can be
Rail Fence Transposition
Columnar Transposition

03/11/2024 Computer Security 46


Rail-Fence Transposition
 Rail-Fence Transposition
The rail-fence transposition is an encryption technique
the plaintext message is transposed into several rows.

The rail-fence transposition cipher text is produced by


reading the resulting columns in sequence.

03/11/2024 Computer Security 47


Rail-Fence Transposition

Rule of Rail-Fence Transposition


R1. Write down the plain-text message as a sequence of
diagonals.
R2. Read the plain-text written in step1 as a sequence of rows.
Eg. Plain-text message: come home tomorrow

Cipher text message using the RFT is c m h m t m r o o e o e o o r w

03/11/2024 Computer Security 48


Columnar Transposition Cipher
The columnar transposition cipher is a form of transposition
cipher in which plain text represent in matrix form.

Columnar transposition involves writing the plaintext out in


rows, & then reading the cipher text off in columns 1 by 1.

Cipher text is produced by reading the resulting rows in


sequence of column.
03/11/2024 Computer Security 49
Columnar Transposition Cipher

Encryption Process
Example: Plain Text: TREE IS GREEN
Keyword: HACK

Width of the rows and permutation of the columns are defined by a key.

Number of Columns = Number of Key Char.LZ

Number of Rows-Cell = Permutation of key Char.LZ .4!


 Permutation of 4=4!=1*2*3*4=24=Rows-Cell
03/11/2024 Computer Security 50
Columnar Transposition Cipher

Assign numerical value for key char. order sequentially


based on alphabet "3 1 2 4".

The plaintext msge is written out in row of a fixed length.

If any spare (extra, unused) spaces are filled with null or left
blank or placed by a character(Example: _ ).

03/11/2024 Computer Security 51


Columnar Transposition Cipher

 Finally the message is read off in columns in the order


specified by keyword.
 Plain Text: THREE IS GREEN, Keyword: HACK, Length of
keyword=4, order of alphabet in HACK: 3 1 2 4.

 Create 4 column and 4 row then put the plain text in the cell sequential
next the cipher is the sequential alphabet order of key. Thus

 Cipher text: R I R _ E S E _ T_ G N E_ E_
03/11/2024 Computer Security 52
Columnar Transposition Cipher

Then write the cipher text in columns again, then reorder the
columns by reforming the keyword.

Read row matrix wise to get plaintext: TREE IS GREEN

Plaintext: TREE IS GREEN

03/11/2024 Computer Security 53


Columnar Transposition Cipher

Columnar Transposition
The number of columns is the key information.
To encipher: Plaintext is written horizontally in k
columns, and is then transcribed vertically column -
by-column.

03/11/2024 Information Assurance and Security 54


Columnar Transposition Cipher
Columnar Transposition

Example: Encrypt NOTHING IN THE WORLD


IS MORE DANGEROUS THAN SINCERE
IGNORANCE AND CONSCIENTIOUS
STUPIDITY with a key of k = 9 columns.

03/11/2024 Information Assurance and Security 55


Columnar Transposition Cipher

Columnar Transposition
Solution: We write the plaintext horizontally in 9 columns as
follows:
NOTHINGIN
THEWORLDI
SMOREDANG
EROUSTHAN
SINCEREIG
NORANCEAN
DCONSCIEN
TIOUSSTUP
IDITY
03/11/2024 Information Assurance and Security 56
Columnar Transposition Cipher
Columnar Transposition Cipher

The cipher text is therefore: NTSES NDTIO HMRIO


CIDTE OONRO OIHWR UCANU TIOES ENSSY
NRDTR CCSGL AHEEI TIDNA IAEUN IGNGN NP.

03/11/2024 Information Assurance and Security 57


Columnar Transposition Cipher

 Example: Suppose the cipher text is:


 GPSDO AILTI VRVAA WETEC NITHM EDLHE TALEA ONME.
 If it is known that the key is k = 7, find the plaintext.
 Solution: There are 39 letters in the ciphertext which means that there are 39

DIV 7 = 5 full rows and one partial row with 39 MOD 7 = 4 letters.

03/11/2024 Information Assurance and Security 58


Columnar Transposition Cipher

Decryption Progresses
Put the cipher text in table format based on the key
sequential alphabet order of keyword then collate the
character from 1st row to the last row.
To decipher it the recipient has to work out the column
lengths by dividing the message length by the key length.
Keyword: HACK, Length of keyword:4,
Cipher text: R I R _ E S E _ T_ G N E_ E_
 The message length: 16
 The key length:4
03/11/2024 So, Length Computer
of columnSecurityis 16/4 = 4 59
Product Ciphers

Product ciphers are known as combination ciphers, such as


substitution and transposition ciphers, or multiple iteration of the
same cipher. Eg. Product cipher algorithm:
Encrypt message with substitution cipher using key 1
Encrypt result of step 1 with transposition cipher
Encrypt result of step 2 with substitution cipher and key 2
 Repeat step 1-3 several times, this iteration produces product
ciphers.
03/11/2024 Computer Security 60
03/11/2024 Computer Security

You might also like