0% found this document useful (0 votes)
52 views

Cns Unit 1 Cryptography and Network Security

CNS chapter 1

Uploaded by

Yashrajsinh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Cns Unit 1 Cryptography and Network Security

CNS chapter 1

Uploaded by

Yashrajsinh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

lOMoARcPSD|35901186

CNS Unit-1 - Cryptography and network security

Cryptography and Network Security (Gujarat Technological University)

Scan to open on Studocu


UNIT I - INTRODUCTION & NUMBER THEORY

INTRODUCTION:

Computer security, cybersecurity or information technology security (IT security) is the


protection of computer systems and networks from the theft of or damage to
their hardware, software, or electronic data, as well as from the disruption or misdirection of the
services they provide.

Computer and network security is essentially a battle of wits between a culprit who tries to
find holes and the designer or administrator who tries to close them.

Computer security is a series of protocols that a company or an individual follows to ensure


information maintains its “ICA” – integrity, confidentiality and availability.

CRYPTOGRAPHY:

Cryptography is the art and science of making a cryptosystem that is capable of providing
information security. Cryptography deals with the actual securing of digital data. It refers to
the design of mechanisms based on mathematical algorithms that provide fundamental
information security services.

CRYPTOSYSTEM

A cryptosystem is an implementation of cryptographic techniques and their accompanying


infrastructure to provide information security services. A cryptosystem is also referred to as a
cipher system.

Figure.1. Cryptosystem
Cryptosystem shown in fig.1, is th study of secure communications techniques that allow
only the sender and intended recipient of a message to view its contents. When transmitting
electronic data, the most common use of cryptography is to encrypt and decrypt email and
other plain-text messages. It reformats and transform our data, making it safer on its trip
between computers. The technology is based on the essentials of secret codes, augmented by
modern mathematics that protects our data in powerful ways.
Network Security - measures to protect data during their transmission
Internet Security - measures to protect data during their transmission over a collection of
interconnected networks
Computer Security: The protection afforded to an automated information system in order to
attain the applicable objectives of preserving the integrity, availability, and confidentiality of
information system resources (includes hardware, software, firmware, information/data, and
telecommunications).
This definition introduces three key objectives that are at the heart of computer security:
Confidentiality (C): Preserving authorized restrictions on information access and disclosure,
including means for protecting personal privacy and proprietary information. A loss of
confidentiality is the unauthorized disclosure of information.
Integrity(I): Guarding against improper information modification or destruction, including
ensuring information nonrepudiation and authenticity. A loss of integrity is the unauthorized
modification or destruction of information.
Availability (A): Ensuring timely and reliable access to and use of information. A loss of
availability is the disruption of access to or use of information or an information system.
These three concepts form what is often referred to as the CIA triad. The three concepts
embody the fundamental security objectives for both data and for information and computing
services.
Confidentiality: This term covers two related concepts:
Data1 confidentiality: Assures that private or confidential information is not made available
or disclosed to unauthorized individuals.
Privacy: Assures that individual’s control or influence what information related to them may
be collected and stored and by whom and to whom that information may be disclosed.
Integrity: This term covers two related concepts:
Data integrity: Assures that information and programs are changed only in a specified and
authorized manner.
System integrity: Assures that a system performs its intended function in an unimpaired
manner, free from deliberate or inadvertent unauthorized manipulation of the system.
Availability: Assures that systems work promptly and service is not denied to authorized
users. Although the use of the CIA triad to define security objectives is well established,
some in the security field feel that additional concepts are needed to present a complete
picture. Two of the most commonly mentioned are as follows:
Authenticity: The property of being genuine and being able to be verified and trusted;
confidence in the validity of a transmission, a message, or message originator. This means
verifying that users are who they say they are and that each input arriving at the system came
from a trusted source.
Accountability: The security goal that generates the requirement for actions of an entity to
be traced uniquely to that entity. This supports nonrepudiation, deterrence, fault isolation,
intrusion detection and prevention, and after-action recovery and legal action.
THE OSI SECURITY ARCHITECTURE:
The OSI security architecture was developed in the context of the OSI protocol architecture
by ITU-T.
ITU-T: The International Telecommunication Union (ITU) Telecommunication
Standardization Sector (ITU-T) is a United Nations sponsored agency that develops
standards, called Recommendations, relating to telecommunications and to open systems
interconnection (OSI).
Recommendation X.800, Security Architecture for OSI, defines a systematic
approach. The OSI security architecture is useful to managers as a way of organizing the task
of providing security.
The OSI security architecture focuses on security attacks, mechanisms, and services. These
can be defined
briefly as

❖ Security attack

❖ Security mechanism.

❖ Security service

threat and attack are commonly used to mean more or less the same thing. The definitions
taken from RFC 4949, Internet Security Glossary.
Threat
A potential for violation of security, which exists when there is a circumstance, capability,
action, or event that could breach security and cause harm. That is, a threat is a possible
danger that might exploit a vulnerability.
Attack
An attack on system security that derives from an intelligent threat; that is, an intelligent act
that is a deliberate attempt (especially in the sense of a method or technique) to evade
security services and violate the security policy of a system.
SECURITY ATTACK:
Any action that compromises the security of information owned by an organization. There are
four general categories of attack which are listed below.
Interruption
An asset of the system is destroyed or becomes unavailable or unusable. This is an attack on
availability.
e.g., destruction of piece of hardware, cutting of a communication line or disabling of file
management system.

Figure.2a
Interception
An unauthorized party gains access to an asset. This is an attack on confidentiality.
Unauthorized party could be a person, a program or a computer. e.g., wiretapping to capture
data in the network, illicit copying of files.

Figure. 2b
Modification
An unauthorized party not only gains access to but tampers with an asset. This is an attack on
integrity.
e.g., changing values in data file, altering a program, modifying the contents of messages being
transmitted in a network.

Figure. 2c
Fabrication
An unauthorized party inserts counterfeit objects into the system. This is an attack on
authenticity.
e.g., insertion of spurious message in a network or addition of records to a file.

Figure.2d
The attack is majorly classified into two types:
● Active attack
● Passive Attack
PASSIVE ATTACK:
Passive attacks (Fig.3) are in the nature of eavesdropping on, or monitoring of, transmissions.
The goal of the opponent is to obtain information that is being transmitted.

Downloaded by Yashrajsinh Chavada ([email protected])


lOMoARcPSD|35901186

Figure.3
Passive attacks are of two types:
Release of message contents: A telephone conversation, an e-mail message and a transferred
file may contain sensitive or confidential information. We would like to prevent the opponent
from learning the contents of these transmissions.
Traffic analysis: If we had encryption protection in place, an opponent might still be able to
observe the pattern of the message. The opponent could determine the location and identity of
communication hosts and could observe the frequency and length of messages being
exchanged. This information might be useful in guessing the nature of communication that
was taking place.
Passive attacks are very difficult to detect because they do not involve any alteration of data.
However, it is feasible to prevent the success of these attacks.
ACTIVE ATTACKS:
These attacks involve some modification of the data stream or the creation of a false stream.

Figure.4 These
attacks can be classified in to four categories:
Masquerade – One entity pretends to be a different entity.
Replay – involves passive capture of a data unit and its subsequent transmission to produce
an unauthorized effect.
Modification of messages – Some portion of message is altered or the messages are delayed
or recorded, to produce an unauthorized effect.

Denial of service – Prevents or inhibits the normal use or management of communication


facilities. Another form of service denial is the disruption of an entire network, either by
disabling the network or overloading it with messages so as to degrade performance. It is
quite difficult to prevent active attacks absolutely, because to do so would require physical
protection of all communication facilities and paths at all times. Instead, the goal is to detect
them and to recover from any disruption or delays caused by them.

SECURITY SERVICE:

A processing or communication service that enhances the security of the data processing
systems and the information transfers of an organization. The services are intended to counter
security attacks, and they make use of one or more security mechanisms to provide the
service.
X.800 defines a security service as a service that is provided by a protocol layer of
communicating open systems and that ensures adequate security of the systems or of data
transfers. X.800 divides these services into five categories

AUTHENTICATION:
The authentication service is concerned with assuring that a communication is Authentic, the
function of the authentication service is to assure the recipient that the message is from the
source that it claims to be from. In the case of an ongoing interaction, such as the connection
of a terminal to a host, two aspects are involved. Two specific authentication services are
defined in X.800:
Peer Entity Authentication
Used in association with a logical connection to provide confidence in the identity of the
entities connected.
Data Origin Authentication
In a connectionless transfer, provides assurance that the source of received data is as claimed.
ACCESS CONTROL
The prevention of unauthorized use of a resource (i.e., this service controls who can have
access to a resource, under what conditions access can occur, and what those accessing the
resource is allowed to do).

DATA CONFIDENTIALITY
The protection of data from unauthorized disclosure. Confidentiality is the protection of
transmitted data from passive attacks. With respect to the content of a data transmission,
several levels of protection can be identified.
Connection Confidentiality: The protection of all user data on a connection.
Connectionless Confidentiality: The protection of all user data in a single data block

AUTHENTICATION
The confidentiality of selected fields within the user data on a connection or in a single data
block.
Traffic Flow Confidentiality: The protection of the information that might be derived from
observation of traffic flows.

DATA INTEGRITY
The assurance that data received are exactly as sent by an authorized entity (i.e., contain no
modification, insertion, deletion, or replay).
Connection Integrity with Recovery
Provides for the integrity of all user data on a connection and detects any modification,
insertion, deletion, or replay of any data within an entire data sequence, with recovery
attempted.
Connection Integrity without Recovery: As above, but provides only detection without
recovery.
Selective-Field Connection Integrity: Provides for the integrity of selected fields within the
user data of a data block transferred over a connection and takes the form of determination of
whether the selected fields have been modified, inserted, deleted, or replayed.
Connectionless Integrity: Provides for the integrity of a single connectionless data block
and may take the form of detection of data modification. Additionally, a limited form of
replay detection may be provided.
Selective-Field Connectionless Integrity: Provides for the integrity of selected fields within
a single connectionless data block; takes the form of determination of whether the selected
fields have been modified.

NONREPUDIATION
Provides protection against denial by one of the entities involved in a communication of
having participated in all or part of the communication.
Nonrepudiation, Origin: Proof that the message was sent by the specified party.
Nonrepudiation, Destination: Proof that the message was received by the specified party.
Summary:

Confidentiality: Ensures that the information in a computer system and transmitted


information are accessible only for reading by authorized parties.
Eg., printing, displaying and other forms of disclosure.
Authentication: Ensures that the origin of a message or electronic document is correctly
identified, with an assurance that the identity is not false.
Integrity: Ensures that only authorized parties are able to modify computer system assets
and transmitted information. Modification includes writing, changing status, deleting,
creating and delaying or replaying of transmitted messages.
Non repudiation: Requires that neither the sender nor the receiver of a message be able
to deny the transmission.
Access control: Requires that access to information resources may be controlled by or the
target system.
Availability: Requires that computer system assets be available to authorized parties
when needed.
SECURITY MECHANISMS
One of the most specific security mechanisms in use is cryptographic techniques. Encryption
or encryption-like transformations of information are the most common means of providing
security.

SPECIFIC SECURITY MECHANISMS


May be incorporated into the appropriate protocol layer in order to provide some of the OSI
security services.
Encipherment: The use of mathematical algorithms to transform data into a form that is not
readily intelligible. The transformation and subsequent recovery of the data depend on an
algorithm and zero or more encryption keys.
Digital Signature: Data appended to, or a cryptographic transformation of, a data unit that
allows a recipient of the data unit to prove the source and integrity of the data unit and protect
against forgery (e.g., by the recipient).
Access Control: A variety of mechanisms that enforce access rights to resources

Data Integrity: A variety of mechanisms used to assure the integrity of a data unit or stream of
data units
Authentication Exchange: A mechanism intended to ensure the identity of an entity by
means of information exchange.
Traffic Padding: The insertion of bits into gaps in a data stream to frustrate traffic analysis
attempts.
Routing Control: Enables selection of particular physically secure routes for certain data and
allows routing changes, especially when a breach of security is suspected.
Notarization: The use of a trusted third party to assure certain properties of a data exchange.

Cryptography is the study of conversion of plain text(readable format) to


ciphertext(non-readable format) i.e. encryption. It is also called the study of encryption.

Cryptology, on the other hand, is the study of the conversion of plain text to ciphertext and vice
versa. It is also called the study of encryption and decryption.
One major difference is that Cryptology is the parent of Cryptography.

● Cryptanalysis: Cryptanalysis is the study of methods for obtaining the meaning of


encrypted information, without access to the secret information that is typically
required to do so. Typically, this involves knowing how the system works and finding a
secret key. Cryptanalysis is also referred to as code breaking or cracking the code.
Depending on the type of cryptographic system in place and the information
available to the attacker, these attacks can be broadly classified into six types:

1. Brute force attack


Public and private(secret) keys play a significant role in encrypting and decrypting the
data in a cryptographic system. In a brute force attack, the cybercriminal tries various
private keys to decipher an encrypted message or data. If the key size is 8-bit, the
possible keys will be 256 (i.e., 28). The cybercriminal must know the algorithm (usually
found as open-source programs) to try all the 256 possible keys in this attack technique.
2. Ciphertext-only attack
In this attack vector, the attacker gains access to a collection of ciphertext. Although the
attacker cannot access the plaintext, they can successfully determine the ciphertext from
the collection. Through this attack technique, the attacker can occasionally determine the
key.

For example: David finds an encrypted message (ciphertext) in a dead drop, but has no
idea what the message means.

3. Chosen plaintext attack


In this attack model, the cybercriminal can choose arbitrary plaintext data to obtain the
ciphertext. It simplifies the attacker's task of resolving the encryption key. One
well-known example of this type of attack is the differential cryptanalysis performed on
block ciphers.

For example: David finds an enemy spy's hiding place and interrupts him while he is
sending an encrypted message. The spy is silly enough to have fled, leaving both the
plaintext message and its associated ciphertext written down.

4. Chosen ciphertext attack


In this attack model, the cybercriminal analyzes a chosen ciphertext corresponding to its
plaintext. The attacker tries to obtain a secret key or the details about the system. By
analyzing the chosen ciphertext and relating it to the plaintext, the attacker attempts to
guess the key. Older versions of RSA encryption were prone to this attack.

For example: David finds an enemy spy's hiding place and interrupts him while he is
sending an encrypted message. The spy is silly enough to have fled, leaving both the
plaintext message and its associated ciphertext written down.

5. Known plaintext attack


In this attack technique, the cybercriminal finds or knows the plaintext of some portions
of the ciphertext using information gathering techniques. Linear cryptanalysis in block
cipher is one such example.

For example: David finds an enemy spy's hiding place and interrupts him while he is
sending an encrypted message. The spy is silly enough to have fled, leaving both the
plaintext message and its associated ciphertext written down.
NETWORK SECURITY MODEL:
A model for a network security is shown in the below figure. 5

Figure.5 Network Security Model


A message is to be transferred from one party to another across some sort of Internet service.
The two parties, who are the principals in this transaction, must cooperate for the exchange
to take place. A logical information channel is established by defining a route through the
Internet from source to destination and by the cooperative use of communication protocols
(e.g., TCP/IP) by the two principals.
This general model shows that there are four basic tasks in designing a particular security
service:
1. Design an algorithm for performing the security-related transformation. The
algorithm should be such that an opponent cannot defeat its purpose.
2. Generate the secret information to be used with the algorithm.
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
but are considered. A general model of these other situations is illustrated in Figure.6 which
reflects a concern for protecting an information system from unwanted access.

Figure. Network Access Security Model

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.

Classical Encryption Techniques: A SYMMETRIC CIPHER MODEL:


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.
Some basic terminologies used:
ciphertext - the coded message
cipher - algorithm for transforming plaintext to ciphertext
key - info used in cipher known only to sender/receiver
encipher (encrypt) - converting plaintext to ciphertext
decipher (decrypt) - recovering ciphertext from plaintext
cryptography - study of encryption principles/methods
cryptanalysis (codebreaking) - the study of principles/ methods of deciphering
ciphertext without knowing key
cryptology - the field of both cryptography and cryptanalysis
Fig. Simplified Model of Symmetric Encryption

A symmetric encryption scheme has five ingredients


1. Here the original message, referred to as plaintext, is converted into apparently random
nonsense, referred to as cipher text.
2. The encryption process consists of an algorithm and a key.
3. The key is a value independent of the plaintext. Changing the key changes, the output
of the algorithm.
4. Once the cipher text is produced, it may be transmitted.
5. Upon reception, the cipher text can be transformed back to the original plaintext by
using a decryption algorithm and the same key that was used for encryption.
6. The security depends on several factors. First, the encryption algorithm must be
powerful enough that it is impractical to decrypt a message on the basis of cipher text
alone. Beyond that, the security depends on the secrecy of the key, not the secrecy of
the algorithm.

Two requirements for secure use of symmetric encryption:

A strong encryption algorithm

A secret key known only to sender / receiver

Y = EK(X)

X = DK(Y)

assume encryption algorithm is known implies a secure channel to distribute key


conventional cryptosystem

A source produces a message in plaintext, X = [X1, X2, …, XM] where M are the number of
letters in the message. A key of the form K = [K1, K2, …, KJ] is generated. If the key is
generated at the source, then it must be provided to the destination by means of some secure
channel. With the message X and the encryption key K as input, the encryption algorithm
forms
the cipher text Y = [Y1, Y2, …, YN]. This can be expressed as Y = EK(X)
The intended receiver, in possession of the key, is able to invert the transformation: X =
DK(Y) An opponent, observing Y but not having access to K or X, may attempt to recover X
or K or both. It is assumed that the opponent knows the encryption and decryption
algorithms. If the opponent is interested in only this particular message, then the focus of
effort is to recover X by generating a plaintext estimate. Often if the opponent is interested in
being able to read future messages as well, in which case an attempt is made to recover K by
generating an estimate.
Substitution Encryption Techniques:
Substitution encryption technique is one type of classic encryption technique, 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 ciphertext bit patterns.

Monoalphabetic Cipher:

1. Caesar cipher (or) shift cipher

● The earliest known use of a substitution cipher and the simplest was by Julius Caesar.
● The Caesar Cipher is a type of shift cipher.
● Shift Ciphers work by using the modulo operator to encrypt and decrypt messages. The
Shift Cipher has a key K, which is an integer from 0 to 25.

e.g.,K=3 Plain text: pay more mone Cipher text: SDB PRUH PRQHB
Let us assign a numerical equivalent to each letter:

● For Encrypt each plaintext letter p, substitute the cipher text letter c such that
C = E(p) = (p+3) mod 26, a shift may be any amount, so that general Caesar algorithm is
C = E (p) = (p+k) mod 26, where k takes on a value in the range 1 to 25.

The decryption algorithm is simply


P = D(C) = (C-k) mod 26
Example:
By using the Shift Cipher with key K=19 for our message. We
encrypt the message "KHAN", as follows

So, after applying the Shift Cipher with key K=19 our message text "KHAN" gave us

cipher text "DATG".


For every letter in the cipher text C, convert the letter into the number that matches its
order in the alphabet starting from 0, and call this number Y.
If it is known that a given ciphertext is a Caesar cipher, then a brute-force cryptanalysis
is easily performed: Simply try all the 25 possible keys.

2. Monoalphabetic Ciphers:

● It is an improvement to the Caesar Cipher.


● Instead of shifting the alphabets by some number, this scheme uses some permutation
of the letters in alphabet.
● The sender and the receiver decide on a randomly selected
● permutation of the letters of the alphabet.
● With 26 letters in alphabet, the possible permutations are
26! which is equal to 4x1026.
Example:
If Key is,
● 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: y n l k x b s h m i w d p j r o q v f e a u g t z c
Encrypt===>Plain text: Cryptography
Ciphertext: Lq_______?
Polyaphabetic Cipher:
A polyalphabetic cipher is any cipher based on substitution, using multiple substitution
alphabets. The Vigenère cipher is probably the best-known example of a polyalphabetic
cipher.

Difference between monoalphabetic cipher and polyalphabetic cipher:


● A monoalphabetic cipher is a substitution cipher in which the cipher alphabet is fixed
through the encryption process
● A polyalphabetic cipher is a substitution cipher in which the cipher alphabet changes
during the encryption process.

Playfair Cipher:

● The best-known multiple-letter encryption cipher is the Playfair, which treats diagrams in
the plaintext as single units and translates these units into cipher text diagrams
● The Playfair algorithm is based on the use of a 5 * 5 matrix of letters constructed
using a keyword.

Step1:

In this case, the keyword is monarchy. The matrix is constructed by filling in the letters of
the keyword (minus duplicates) from left to right and from top to bottom, and then filling in
the remainder of the matrix with the remaining letters in alphabetic order. The letters I and J
count as one letter.
Step 2:
● 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.
Step 3:

● 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.
● 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.
● 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

The Playfair cipher is a great advance over simple monoalphabetic ciphers. For one thing,
whereas there are only 26 letters, there are 26 * 26 = 676 digrams, so that identification
of individual digrams is more difficult. Furthermore, the relative frequencies of individual
letters exhibit a much greater range than that of digrams, making frequency analysis
much more difficult.

For these reasons, the Playfair cipher was for a long time considered unbreakable. It was
used as the standard field system by the British Army in World War I and still enjoyed
considerable use by the U.S. Army and other Allied forces during World War II.

Hill Cipher:

● Another interesting multi letter cipher is the Hill cipher, developed by the mathematician
Lester Hill in 1929.

The Hill Algorithm

In hill cipher algorithm every letter (A-Z) is represented by a number moduli 26. Usually, the
simple substitution scheme is used where A = 0, B = 1, C = 2…Z = 25 in order to use 2x2 key
matrix.
Encryption
To encrypt the text using hill cipher, we need to perform the following operation.
E(K, P) = (K * P) mod 26
Where K is the key matrix and P is plain text in vector form. Matrix multiplication of K and P
generates the encrypted ciphertext.
Steps For Encryption
Step 1:
Let's say our key text (2x2) is DDCF. Convert this key using a substitution scheme into a 2x2
key matrix as shown below:

Step 2:
Now, we will convert our plain text into vector form. Since the key matrix is 2x2, the vector
must be 2x1 for matrix multiplication. (Suppose the key matrix is 3x3, a vector will be a 3x1
matrix.)
In our case, plain text is TEXT that is four letters long word; thus we can put in a 2x1 vector
and then substitute as:

Step 3:
Multiply the key matrix with each 2x1 plain text vector, and take the modulo of result (2x1
vectors) by 26. Then concatenate the results, and we get the encrypted or ciphertext as RGWL.

Decryption
To encrypt the text using hill cipher, we need to perform the following operation.
D(K, C) = (K-1 * C) mod 26
Where K is the key matrix and C is the ciphertext in vector form. Matrix multiplication of
inverse of key matrix K and ciphertext C generates the decrypted plain text.
Steps For Decryption
Step 1:
Calculate the inverse of the key matrix. First, we need to find the determinant of the key matrix
(must be between 0-25). Here the Extended Euclidean algorithm is used to get modulo
multiplicative inverse of key matrix determinant

Step 2:
Now, we multiply the 2x1 blocks of ciphertext and the inverse of the key matrix. The resultant
block after concatenation is the plain text that we have encrypted i.e., TEXT.

Vigenere cipher:
฀ Vigenere Cipher is a method of encrypting alphabetic text. It uses a simple form of
polyalphabetic substitution. A polyalphabetic cipher is any cipher based on
substitution, using multiple substitution alphabets .The encryption of the original text
is done using the Vigenère square or Vigenère table.
• The table consists of the alphabets written out 26 times in different rows, each
alphabet shifted cyclically to the left compared to the previous alphabet,
corresponding to the 26 possible Caesar Ciphers.
• At different points in the encryption process, the cipher uses a different alphabet from
one of the rows.
• The alphabet used at each point depends on a repeating keyword
The Vigenère cipher can be expressed in the following manner. Assume a sequence of
plaintext letters P = p0, p1, p2, ,p n-1 and a key consisting of the sequence of letters K = k0,
k1, k2, , k m-1, where typically m <n. The sequence of ciphertext letters C = C0, C1, C2,
……, C n-1 is calculated as follows:

C = C0, C1, C2, …..,C n-1 = E(K, P) = E[(k0, k1, k2, ….., k m-1), (p0, p1, p2…., p n-1)]= (p0 + k0) mod
26, (p1 + k1) mod 26, ……, (p m-1 + k m-1) mod 26, (pm+ k0) mod 26, (p m+1 +
k1) mod 26, ……. , (p 2m-1 + k m-1) mod 26,…..

Thus, the first letter of the key is added to the first letter of the plaintext, mod 26, the second
letters are added, and so on through the first m letters of the plaintext. For the next m letters
of the plaintext, the key letters are repeated. This process continues until all of the plaintext
sequence is encrypted. A general equation of the encryption process is

The encryption formula is:

Ei = (Pi + Ki) mod 26

The decryption formula is:

Di = (Ei – Ki) mod 26

Where E is the encipher, D is the decipher, P is the plaintext, and K is the key.

To encrypt a message, a key is needed that is as long as the message. Usually, the key is a
repeating keyword.

For example, let us take our plaintext to be CYBER SECURITY.

The key can be BEST.

Encryption: Ei = (Pi + Ki) mod 26

Decryption: Di = (Ei – Ki) mod 26


Remember, if the value of Di is ever negative, 26 is added to that value.

The strength of this cipher is that there are multiple ciphertext letters for each plaintext letter,
one for each unique letter of the keyword. Thus, the letter frequency information is obscured.
However, not all knowledge of the plaintext structure is lost.

Vernam Cipher

The ultimate defense against such a cryptanalysis is to choose a keyword that is as long as the
plaintext and has no statistical relationship to it. Such a system was introduced by an AT&T
engineer named Gilbert Vernam in 1918.

• The system can be expressed as:

where
pi= ith binary digit of plaintext
ki= ith binary digit of key
ci= ith binary digit of ciphertext
= exclusive-or (XOR) operation
Thus, the ciphertext is generated by performing the bitwise XOR of the plaintext and the key.
Because of the properties of the XOR, decryption simply involves the same bitwise operation

One Time Pad Cipher


It is an unbreakable cryptosystem. It represents the message as a sequence of 0s and 1s. this can
be accomplished by writing all numbers in binary, for example, or by using ASCII. The key is a
random sequence of 0‟s and 1‟s of same length as the message. Once a key is used, it is
discarded and never used again. The system can be expressed as follows:
Ci = Pi Ki
Ci - ith binary digit of cipher text Pi - ith binary digit of plaintext
Ki - ith binary digit of key – exclusive OR opearaiton
Thus, the cipher text is generated by performing the bitwise XOR of the plaintext and the key.
Decryption uses the same key. Because of the properties of XOR, decryption simply involves
the same bitwise operation:
Pi = Ci Ki
Advantage:
Encryption method is completely unbreakable for a ciphertext only attack.
Disadvantages
It requires a very long key which is expensive to produce and expensive to transmit.
Once a key is used, it is dangerous to reuse it for a second message; any knowledge on the
first message would give knowledge of the second.

STEGANOGRAPHY:
฀ Steganography is the technique of hiding secret data within an ordinary, non-secret, file
or message in order to avoid detection; the secret data is then extracted at its
destination.
The use of steganography can be combined with encryption as an extra step for hiding
or protecting data.
฀ Itstems from two Greek words, which are steganos, means covered
and graphia, means writing
฀ Examples,
1. Playing an audio track backwards to reveal a secret message
2. Playing a video at a faster frame rate (FPS) to reveal a hidden image
3. Embedding a message in the red, green, or blue channel of an RGB image
4. Hiding information within a file header or metadata
5. Embedding an image or message within a photo through the addition of digital noise

• As the image depicts, both cover file(X) and secret message(M) are fed into
steganographic encoder as input.
• Steganographic Encoder function, f(X,M,K) embeds the secret message into a cover
file.
• Resulting Stego Object looks very similar to your cover file, with no visible changes.
• This completes encoding. To retrieve the secret message, Stego Object is fed into .

TRANSPOSITION TECHNIQUES:
All the techniques examined so far involve the substitution of a cipher text symbol for a
plaintext symbol. A very different kind of mapping is achieved by performing some sort of
permutation on the plaintext letters. This technique is referred to as a transposition cipher.
Rail fence is simplest of such cipher, in which the plaintext is written down as a sequence of
diagonals and then read off as a sequence of rows.
Plaintext = meet at the school house
To encipher this message with a rail fence of depth 2, we write the message as
follows:
meatecolos
etthsHohue
The encrypted message is MEATECOLOSETTHSHOHUE

Row Transposition Ciphers-A more complex scheme is to write the message in a rectangle,
row by row, and read the message off, column by column, but permute the order of the
columns. The order of columns then becomes the key of the algorithm.
e.g.,

Cipher Text : eatitnihmexnetmgmedt

Try yourself:
plaintext = meet at the school house
Key = 4 3 1 2 5 6 7

CT = ESOTCUEEHMHLAHSTOETO
A pure transposition cipher is easily recognized because it has the same letter frequencies as the
original plaintext. The transposition cipher can be made significantly more secure by
performing more than one stage of transposition. The result is more complex permutation that is
not easily reconstructed.
FINITE FIELDS AND NUMBER THEORY:
● Finite fields have become increasingly important in cryptography.
● A number of cryptographic algorithms rely heavily on properties of finite fields,
notably the Advanced Encryption Standard (AES) and elliptic curve cryptography.
● Other examples include the message authentication code CMAC and the authenticated
encryption scheme GCM
○ Groups, Rings, Fields, Modular arithmetic, Euclid’s algorithm
○ Finite fields Euclid’s algorithm
○ Polynomial Arithmetic
○ Prime numbers-Fermat’s and Euler’s theorem
○ Testing for primality
● Widely used in cryptography to perform large calculations
● Prime Number: a number that is divisible only by itself and 1 (e.g. 2, 3, 5, 7, 11)
● Relative Prime Number: Two integers are relatively prime (or coprime) if there is no
integer greater than one that divides them both (that is, their greatest common divisor
is one).

○ For example, 12 and 13, GCD (12,13) = 1,12 and 13 are relatively prime, but

12 and 14 are not.,

Modular Congruent Modulo


● Modular : When we divide two integers we will have an equation that looks like the
following:
A/B=Q remainder R
● A is the dividend ,B is the divisor ,Q is the quotient,R is the remainder
● Sometimes, we are only interested in what the remainder is when we divide A by B. For
these cases there is an operator called the modulo operator (abbreviated as mod).
● Using the same A, B, Q, and R as above, we would have: A mod B=R
● We would say this as A modulo B is equal to R. Where B is referred to as the modulus.
Ex. 13/5= 2 remainder of 3 then, 13 mod 5 = 3
CONGRUENT MODULO:

❑ Consider two integers a and b

❑ a and b said to be congruent to n for

❑ a (mod n) = b (mod n) then

❑ a ≡ b (mod n) (OR) a (mod n) = b

❑ example:
❑ let a=73, b=4 and n=23

❑ find a mod n, 73 mod 23 =4 (reminder of 73/23)


❑ find b mod n since 23 is larger than 4 then,4 mod 23 = 4
❑ here 73 mod 23 = 4 and 4 mod 23=4, this can be written as
73 ≡ 4 (mod 23) ==> a ≡ b (mod n)
Properties of Congruences

Congruences have the following properties:

Property 1: a ≡ b (mod n) if n is multiple of (a-b)


● Example: let a=30, b=10 and n=5
● a-b = 30-10 = 20
● Since 20 is multiple of 5 then 30 ≡ 10 (mod 5)
Property 2: a (mod n) = b (mod n) ==> a ≡ b (mod n)

Property 3: a mod n=b and b mod n=c, ฀ b = c (mod n) sub it in a mod n then a mod n= c
mod n and a ≡ c (mod n)

฀ Arithmetic Property: ((a mod n) + (b mod n))mod n= (a+b) mod n [same for -,*,/]
฀ Commutative Property: (a+b) mod n = (b+a) mod n [same for *]
฀ Associative Property: ((a + b)+c) mod n = (a+(b + c)) mod n
฀ Identity Property: (0+a) mod n = a mod n, (1 * a) mod n = a mod n

Modular Arithmetic Operations


The (mod n) operator maps all integers into the set of integers {0, 1, c, (n - 1)}. This
technique is known as modular arithmetic.

Modular arithmetic exhibits the following properties:

[(a mod n) + (b mod n)] mod n = (a + b) mod n

[(a mod n) - (b mod n)] mod n = (a - b) mod n

[(a mod n) (b mod n)] mod n = (ab) mod n

Examples of the three properties:

11 mod 8 = 3; 15 mod 8 = 7
[(11 mod 8) + (15 mod 8)] mod 8 = 10 mod 8 =2
(11 + 15) mod 8 =26 mod 8 =2
[(11 mod 8) – (15 mod 8)] mod 8 = -4 mod 8 = 4

(11-15) mod 8 = -4 mod 8 = 4


[(11 mod 8)× (15 mod 8)] mod 8 = 21 mod 8 =5
(11 × 15) mod 8 = 165 mod 8 =5

Exponentiation is performed by repeated multiplication, as in ordinary arithmetic.

To find 117 mod 13,

112 = 121 = 4 ( mod 13)

114 =(112)2 = 42 = 3 ( mod 13)

117 = 11 × 4 × 3 = 132 = 2 (mod 13)

Thus, the rules for ordinary arithmetic involving addition, subtraction, and
multiplication carry over into modular arithmetic. The following table below provides
an illustration of modular addition and multiplication modulo 8

Both matrices are symmetric about the main diagonal in conformance to the
commutative property of addition and multiplication.
As in ordinary addition, there is an additive inverse, or negative, to each integer in modular
arithmetic.

In this case, the negative of an integer x is the integer y such that (x + y) mod 8 = 0.

To find the additive inverse of an integer in the left-hand column, scan across the
corresponding row of the matrix to find the value 0; the integer at the top of that column is
the additive inverse; thus, (2 + 6) mod 8 = 0. Similarly, the entries in the multiplication table
are straightforward.

In modular arithmetic mod 8, the multiplicative inverse of x is the integer y

such that (x y) mod 8 = 1 mod 8.

Euler’s Theorem
Euler‟s theorem states that for every a and n that are relatively prime:

FINITE FIELDS
Groups, Rings and Field:
Group: A set of elements that is closed with respect to some operation.
Closed-> The result of the operation is also in the set
The operation obeys:
Obeys associative law: (a.b).c = a.(b.c)
Has identity e: e.a = a.e = a
Has inverses a-1: a.a-1 = e
Abelian Group: The operation is commutative
a.b = b.a
Example: Z8, + modular addition, identity =0
Cyclic Group
Exponentiation: Repeated application of operator
example: a3 = a.a.a
Cyclic Group: Every element is a power of some fixed element, i.e., b = ak
for some a and every b in group a is said to be a generator of the group
Example: {1, 2, 4, 8} with mod 12 multiplication, the generator is 2.
20=1, 21=2, 22=4, 23=8, 24=4, 25=8
Ring:
A group with two operations: addition and multiplication
The group is abelian with respect to addition: a+b=b+a
Multiplication and additions are both associative:
a+(b+c)=(a+b)+c
a.(b.c)=(a.b).c
Multiplication distributes over addition, a.(b+c)=a.b+a.c

Commutative Ring: Multiplication is commutative, i.e., a.b = b.a


Integral Domain: Multiplication operation has an identity and no zero divisors
Field:
An integral domain in which each element has a multiplicative inverse.

Finite Field
In mathematics, a finite field is a field that contains a finite number of
elements. In other words, a finite field is a finite set on which the four basic
operations – addition, subtraction, multiplication and division (excluding
division by zero) – are defined and satisfy the field axioms/rules of the
arithmetic. Finite fields are an important area of mathematics and computer
science and are widely used in geometry, finite geometry, algebraic
geometry, number theory, coding theory and cryptography.

A finite field is also known as Galois field.

The Euclidean Algorithm

Recall that the Greatest Common Divisor (GCD) of two integers A and B is the largest integer
that divides both A and B .
The Euclidean Algorithm is a technique for quickly finding the GCD of two integers.
The Algorithm
The Euclidean Algorithm for finding GCD(A,B) is as follows:

● If A = 0 then GCD(A,B)=B, since the GCD(0,B)=B, and we can stop.


● If B = 0 then GCD(A,B)=A, since the GCD(A,0)=A, and we can stop.
● Write A in quotient remainder form (A = B⋅Q + R)
● Find GCD(B,R) using the Euclidean Algorithm since GCD(A,B) = GCD(B,R)

Example:

Find the GCD of 270 and 192

● A=270, B=192
● A ≠0
● B ≠0
● Use long division to find that 270/192 = 1 with a remainder of 78. We can write this as:
270 = 192 * 1 +78
● Find GCD(192,78), since GCD(270,192)=GCD(192,78)

A=192, B=78

● A ≠0
● B ≠0
● Use long division to find that 192/78 = 2 with a remainder of 36. We can write this as:
● 192 = 78 * 2 + 36
● Find GCD(78,36), since GCD(192,78)=GCD(78,36)

A=78, B=36

● A ≠0
● B ≠0
● Use long division to find that 78/36 = 2 with a remainder of 6. We can write this as:
● 78 = 36 * 2 + 6
● Find GCD(36,6), since GCD(78,36)=GCD(36,6)

A=36, B=6
● A ≠0
● B ≠0
● Use long division to find that 36/6 = 6 with a remainder of 0. We can write this as:
● 36 = 6 * 6 + 0
● Find GCD(6,0), since GCD(36,6)=GCD(6,0)

A=6, B=0

● A ≠0
● B =0, GCD(6,0)=6

So we have shown:

GCD(270,192) = GCD(192,78) = GCD(78,36) = GCD(36,6) = GCD(6,0) = 6

GCD(270,192) = 6

References

1. William Stallings, Cryptography and Network Security, 6th Edition, Pearson


Education, March 2013.
2. Behrouz A. Ferouzan, “Cryptography & Network Security”, Tata McGraw Hill, 2007.
3. Man Young Rhee, “Internet Security: Cryptographic Principles”, “Algorithms and
Protocols”, Wiley Publications, 2003.
4. Charles Pfleeger, “Security in Computing”, 4th Edition, Prentice Hall of India, 2006.

You might also like