Unit-I Notes
Unit-I Notes
Introduction to Cryptography
Cryptography is derived from the Greek word “Kryptos” which mean “Hidden secrets” It
is the practice and study of hiding information which is used to keep information Secret and
safe.
Example: Julyes Caeser
Cryptography
🠶 The art or science encompassing the principles and methods of transforming an
intelligible message into one that is unintelligible, and then retransforming that
message back to its original form
Why Cryptography?
🠶 Cryptography can reformat 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.
Basic Terms in Cryptography
🠶 Plaintext The original intelligible message
🠶 Cipher text The transformed message
🠶 Cipher An algorithm for transforming an intelligible message into one that is
unintelligible by transposition and/or substitution methods.
🠶 Key Some critical information used by the cipher, known only to the sender&
receiver
🠶 Encipher (encode) -The process of converting plaintext to cipher text using a cipher
and a key
🠶 Decipher (decode) the process of converting cipher text back into plaintext using a
cipher and a key
🠶 Cryptanalysis The study of principles and methods of transforming an unintelligible
message back into an intelligible message without knowledge of the key. Also called
code breaking
Cryptology Both cryptography and cryptanalysis
Network security
🠶 Network security is any action an organization takes to prevent malicious use or
accidental damage to the network’s private data, its users, or their devices.
🠶 The goal of network security is to keep the network running and safe for all
legitimate users.
🠶 Network security consists of the policies and practices adopted to prevent and
monitor unauthorized access, misuse, modification, or denial of a computer network
and network-accessible resources
🠶 There are so many ways that a network can be vulnerable.
🠶 Hackers, leave private data exposed, including trade secrets and customers’ private
details.
🠶 But attackers can do more than steal data
🠶 Competent network security procedures keep data secure and block vulnerable
systems from outside interference.
Computer data often travels from one computer to another, leaving the safety of its
protected physical surroundings. Once the data is out of hand, people with bad intention
could modify or forge your data, either for amusement or for their own benefit.
Cryptography can reformat 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.
🠶 Computer Security - generic name for the collection of tools designed to protect data
and to thwart hackers
🠶 Network Security - measures to protect data during their transmission
🠶 Internet Security - measures to protect data during their transmission over a
collection of interconnected networksour focus is on
🠶 Internet Security which consists of measures to deter, prevent, detect, and correct
security violations that involve the transmission & storage of information
OSI SECURITY ARCHITECTURE:
Its a sort of standard which was proposed by ITU-T, ITU stands for ie International
Telecommunication unit and T is one of the sector of this telecommunication unit. X.800, is a
standard that specifies security Architecture for OSI. OSI security architecture is simply a
standard, which provides various services, requirements, mechanisms and attacks that helps
the managers, industries, computer communication vendors, in such a way, that they can
develop the security features for their products and services based on the definition of
services and mechanisms of OSI.
Security architecture for OSI describes network security in 3 aspects.
⮚ Security attack
⮚ Security service
⮚ Security Mechanism
🠶 Security attack – Any action that compromises the security of information owned by
an organization.
🠶 Security mechanism – A mechanism that is designed to detect, prevent or recover
from asecurity attack.
🠶 Security service – A 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.
SECURITY ATTACKS
🠶 Any action that compromises the security of information owned by an organization
information security is about how to prevent attacks, or failing that, to detect attacks
on information-based systems often threat & attack used to mean same thing have a
wide range of attacks
SECURITY ATTACKS
-Interruption
-Interception
-Modification
-Fabrication
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.
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., wire tapping to
capture data in the network, illicit copying of files
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.
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
Cryptographic Attacks
🠶 Passive Attacks
🠶 Active attacks
Passive Attacks
🠶 Passive attacks are in the nature of eavesdropping on, or monitoring of, transmissions.
🠶 The goal of the opponent is to obtain information that is being transmitted.
Passive attacks are of two types:
🠶 Release of message contents
🠶 Traffic analysis
Masquerade
Masquerade is caused when an unauthorized entity pretends to be another entity. To clear this
lets have an example. Alice and Bob are legal and legitimate users. Here comes the Tom and
he masquerades or disguises himself as Alice and communicate with Bob on behalf of Alice.
Now due to poor lack of authentication by chance Bob releases some confidential
information like acc no and password.so that tom get access to those credentials again tom is
going to get rich.
Replay
In replay attacks user captures a sequence of events or some data units and resends them. Lets
have a look how replay attack work. Here we can see 3 entities Alice,Tom and Bank. Now
Alice want to transfer 100$ to Tom.She initiates the transaction with the bank.Tom captures
ths transaction and reinitiates another transaction in her name and this results in earning
200$.Here the bank doesn’t know that the second transaction was initiated by Tom but not
Alice.
Modification of messages
simply means that some portion of a legitimate message is altered, or that messages are
delayed or reordered, to produce an unauthorized effect (Figure 1.6c). For example, a
message meaning “Allow John Smith to read confidential file accounts” is modified to mean
“Allow Fred Brown to read confidential file account.
Denial of service
X.800 defines a security service which is implemented in a protocol layer so that it ensures
adequate security of the systems or of data transfers.
Role of Network Security Services
🠶 It enhance security of Data processing systems and information transforms of an
organization
🠶 It is mainly intended to counter security attacks
X.800 divides these services into five categories
● Authentication
● Access Control
● Availability
● Confidentiality
● Integrity
● Non-Repudiation
Authentication:
Authentication assures recipient that the message is from, the intended source .it identifies
who is sender and who is receiver also it verifies whether the user is an authorized user.
It is categorized into two
Peer entity authentication
Data Origin Authentication
Peer entity authentication: used in association with a logical connection .It Verifies the
identities of the peer entities involved in communication.ie both communication agent from
source and destination .they can prove that we are the one communicating. Also it provides
the confirmation of the identity of a peer entity in an association.
Data Origin Authentication:
Is useful where there is no connection. Provides the confirmation of the source of a data unit.
Access Control: access control is the ability to limit and control the access to host systems
and applications via communications links. We need to ensure that only the authorized users
are able to access the content. To achieve this, each entity trying to gain access must first be
identified, or authenticated, so that access rights can be given to the individual.
Availability: Resources/applications must be available to authentic users all the time. For eg
if I am logging in my account, I must be able to access my email services, my file services
or even my network. And it is possible that someone can take out the connection, or can
delete some authenticated data or even destroy the system. This is called the denial of service
attack. This must not happen. Resources must be made available to legitimate users.
Confidentiality: It states that only the sender and the receiver should have an access to the
information. It is also known as privacy or secrecy of information.
Data Integrity: assures that messages are received as sent with no duplication, insertion,
modification, reordering, or replays.
Origin Nonrepudiation: Proof that the message was sent by the specified party.
Destination Nonrepudiation: Proof that the message was received by the specified party
SECURITY MECHANISMS
Specific Security Mechanisms:
Incorporated into the appropriate protocol layer in order to provide some of the OSI security
services, Encipherment: It refers to the process of applying mathematical algorithms for
converting data into a form that is not intelligible. This depends on algorithm used and
encryption keys.
Digital Signature: The appended data or a cryptographic transformation applied to any data
unit allowing to prove the source and integrity of the data unit and protect against forgery.
Access Control: A variety of techniques used for enforcing access permissions to the system
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 once a breach of security is suspected.
Notarization: The use of a trusted third party to assure cert in properties of a data exchange
Another type attack is unwanted access 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. This type of attack is called software attack
Programs can present two kinds of threats:
o Information access threats intercept or modify data on behalf of users who should
not have access to that data.
o Service threats exploit service flaws in computers to inhibit/prevent 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. For eg, A logic bomb is a piece of code intentionally inserted into
a software system that will set off a malicious function when specified conditions are met.
For example, a programmer may hide a piece of code that starts deleting files (such as a
salary database trigger), should they ever be terminated from the company. 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 (see Figure 1.6).
The first category might be termed a gatekeeper function. It includes password-based
login procedures that are designed to deny access to all but authorized users and screening
logic that is designed to detect and reject worms, viruses, and other similar attacks. Once
either an unwanted user or unwanted software gains access, the second line of defense
consists of a variety of internal controls that monitor activity and analyze stored information
in an attempt to detect the presence of unwanted intruders.
Using this model requires us to:
– select appropriate gatekeeper functions to identify users
– implement security controls to ensure only authorized users access designated
information or resources
• Trusted computer systems can be used to implement this model
•Plaintext: This is the original intelligible message or data that is fed into the algorithm as
input.
• Encryption algorithm: The encryption algorithm performs various substitu-tions and
transformations on the plaintext.
• Secret key: The secret key is also input to the encryption algorithm. The key is a value
independent of the plaintext and of the algorithm. The algorithm will produce a different
output depending on the specific key being used at the time. The exact substitutions and
transformations performed by the algorithm depend on the key.
• Decryption algorithm: This is essentially the encryption algorithm run in reverse. It takes
the ciphertext and the secret key and produces the original plaintext.
Y = E(K, X)
The intended receiver, in possession of the key, is able to invert the transformation:
X = D(K, Y)
(E) and decryption (D) algorithms. If the opponent is interested in only this particular
N.
message, then the focus of the effort is to recover X by generating a plaintext estimate X
Often, however, the opponent is interested in being able to read future messages as N well,
in which case an attempt is made to recover K by generating an estimate K.
Cryptography
Cryptographic systems are characterized along three independent dimensions:
1. The type of operations used for transforming plaintext to
ciphertext. All encryption algorithms are based on two general principles: substitution, in
which each element in the plaintext (bit, letter, group of bits or letters) is mapped into
another element, and transposition, in which elements in the plaintext are rearranged. The
fundamental requirement is that no informa-tion be lost (that is, that all operations are
reversible). Most systems, referred to as product systems, involve multiple stages of
substitutions and transpositions.
2. The number of keys used. If both sender and receiver use the same key, the system is
referred to as symmetric, single-key, secret-key, or conventional encryp-tion. If the sender
and receiver use different keys, the system is referred to as asymmetric, two-key, or
public-key encryption.
3. The way in which the plaintext is processed. A block cipher processes the input one
block of elements at a time, producing an output block for each input block. A stream
cipher processes the input elements continuously, producing output one element at a time, as
it goes along.
Cryptanalysis and Brute-Force Attack
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 gen-eral approaches
to attacking a conventional encryption scheme:
Cryptanalysis: Cryptanalytic attacks rely on the nature of the algorithm plus perhaps some
knowledge of the general characteristics of the plaintext or even some sample
plaintext–ciphertext pairs. This type of attack exploits the characteristics of the algorithm to
attempt to deduce a specific plaintext or to deduce the key being used. Cryptanalysis is the
art of breaking codes and ciphers
• Brute-force attack: The attacker tries every possible key on a piece of cipher-text until an
intelligible translation into plaintext is obtained. On average, half of all possible keys must
be tried to achieve success.
If either type of attack succeeds in deducing the key, the effect is catastrophic: All future and
past messages encrypted with that key are compromised.
🠶 Rather than just shifting the alphabet could shuffle (jumble) the letters arbitrarily.
🠶 Each plaintext letter maps to a different random ciphertext letter
🠶 Hence key is 26 letters long
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
Plaintext: i f w e w i s h t o r e p l a c e l e t t e r s
Ciphertext: w i r f r w a j u h y f t s d v f s f u u f y a
As a first step, the relative frequency of the letters can be determined and compared to a
standard frequency distribution for English, such as is shown in Figure 1.9. If the message
were long enough, this technique alone might be sufficient, but because this is a relatively
short message, we cannot expect an exact match. In any case, the relative frequencies of the
letters in the ciphertext (in percentages) are as follows:
English Letter Frequencies
🠶 Compare the relative frequency of letters with the standard distribution of English
each letter can be replaced
🠶 The Cipher text P and Z are the equivalents of plain letters e and t, but it is not sure.
🠶 A powerful tool is to look at the frequency of two-letter combinations, known as
digrams. The most common such digram is th. In our ciphertext, the most common
digram is ZW, which appears three times. So we make the correspondence of Z with t
and W with h. Then, by our earlier hypothesis, we can equate P with e. Now notice
that the sequence ZWP appears in the ciphertext, and we can translate that sequence
as “the.” This is the most frequent trigram (three- letter combination). Next, notice the
sequence ZWSZ in the first line.
Z W -> t h
Z W P -> t h e
Z W S Z -> t h a t
Playfair cipher
The best known multiple letter encryption cipher is the playfair, which treats digrams
in the plaintext as single units and translates these units into cipher text digrams. The playfair
algorithm is based on the use of 5x5 matrix of letters constructed using a keyword. Let the
keyword be „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 ofthe matrix with the remaining letters in alphabetical order.The letter „i‟ and „j‟
count as one letter. Plaintext is encrypted two letters at a time
According to the following rules:
1. Repeating plaintext letters that would fall in the same pair are separated with a Filler letter
such as „x‟.
2. 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 following the last.
3. Plaintext letters that fall in the same column are replaced by the letter beneath, with the top
element of the column following the last.
4. Otherwise, each plaintext letter is replaced by the letter that lies in its own row and the
column occupied by the other plaintext letter.
VIGENERE CIPHER
In this scheme, the set of related monoalphabetic substitution rules consisting of
26 caesar ciphers with shifts of 0 through 25. Each cipher is denoted by a key letter. e.g.,
Caesarcipher with a shift of 3 is denoted by the key value 'd‟ (since a=0, b=1, c=2 and so on).
To aid in understanding the scheme, a matrix known as vigenere tableau is Constructed.
Figure:Vigenere Table
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 cipher text is at the intersection of the row
labeled x and the column labeled y; in this case, the ciphertext is V.
To encrypt a message, a key is needed that is as long as the message. Usually, the key is a
repeating keyword.
e.g., key = d e c e p t i v e d e c e p t i v e d e c e p t i v e
PT = w e a r e d i s c o v e r e d s av e y o u r s e l f
CT = ZICVTWQNGRZGVTWAVZHCQYGLMGJ
Decryption is equally simple. The key letter again identifies the row. The position of
thecipher text letter in that row determines the column, and the plaintext letter is at the top of
that column.
Strength of Vigenere cipher
o There are multiple cipher text letters for each plaintext letter.
o Letter frequency information is obscured
VERNAM CIPHER
🠶 Key as long as and indepedent of the plaintext
🠶 Works on binary data as opposed to letters
🠶 Ci = Pi (XOR) Ki
🠶 Where
🠶 Pi – ith binary digit of plaintext
🠶 Ki – ith digit of key
🠶 Ci – ith digit of ciphertext
🠶 Pi=Ci (XOR) Ki
🠶 Key needs to be long and random
Decryption
To decrypt a letter, user takes the key letter on the left and finds cipher text letter in
that row. The plain text letter is placed at the top of the column where the user can
find the cipher text letter.
HILL CIPHER
🠶 Another interesting multiletter cipher is Hill cipher
Hill Algorithm:
Hill algorithm encrypts group of letters like digram, trigram etc. Here key and plaintext
should be in the form of square matrix.
🠶 Perform Encryption and Decryption using Hill Cipher for the message “PAY MORE
MONEY”
K= (17 17 5 21 18 21 2 2 19 )
Encryption:
C=P*K mod26
The first three letters are represented by the vectors (15 0 24)
C= (15 0 4) (17 17 5 21 18 21 2 2 19 )mod 26
= (17 17 11)
= (R R L)
Decryption:
P=C* K -1mod 26
−1 1
𝑘 = |𝐾|
𝑎𝑑𝑗(𝑘)
This sort of thing would be trivial to cryptanalyze. 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 the columns then becomes the key to the
algorithm. For example,
Thus, in this example, the key is 4312567. To encrypt, start with the column that is labeled 1,
in this case column 3. Write down all the letters in that column. Proceed to column 4, which
is labeled 2, then column 2, then column 1, then columns 5, 6, and 7.
STEGANOGRAPHY
Steganography is the practice of concealing a file, message, image, or video within
another file,
The word steganography comes from Greek steganographia, which combines the words
steganós (στεγανός), meaning "covered or concealed", and -graphia (γραφή) meaning
"writing"
🠶 Steganography is the technique of hiding secret data within an ordinary file or a
message in order to avoid detection of data so that the secret data will be extracted
only at its destination.
🠶 The concept of steganography can be combined with encryption as an extra step for
hiding or protecting data.
🠶 A plaintext message may be hidden in one of two ways.
🠶 Steganography
🠶 cryptography
🠶 The methods of steganography conceal (hide) the existence of the message, whereas
the methods of cryptography render (provide/furnish)the message in non-readable
format to outsiders by various transformations of the text.
🠶 A simple form of steganography is an arrangement of words or letters within a text,
spells out the real message. But is time-consuming to construct.
🠶 For example, the sequence of first letters of each word of the overall message spells
out the hidden message
🠶 The War On
🠶 Over Four
Apart from these two techniques, various techniques are used in Steganography to
maintain secure communication.
🠶 Character marking: to hide the information the chosen letters are overwritten in
pencil. The marked content is ordinarily not visible unless the paper is held at an
angle to bright light.
🠶 Invisible ink: A chemical or substances can be used for writing. but the actual
content is invisible until heat or some chemical is applied to the paper.
🠶 Pin punctures: In order to hide the information Small pin punctures are done over
each character and is not visible unless the paper is held up in front of a light.
🠶 Typewriter correction ribbon: Here the information is hidden between lines typed
with a black ribbon. The results of typing with the correction tape are visible only
under a strong light.
For making cipher text, manipulation is done in the For making cipher text operations are performed
characters of the plain text on binary bit sequence.
The whole of the ecosystem is required to Here only the parties who want to execute secure
communicate confidentially communication possess the secret key
These are weaker as compared to modern The encryption algorithm formed by this
encryption encryption technique is stronger as compared to
traditional encryption algorithm.
It believes in the concept of security through The security depends on the publicly known
obscurity mathematical algorithm
🠶 Confidentiality: It states that only the sender and the receiver should have an access
Authentication:
Authentication assures the recipient that the message is from, the intended source .it
identifies who is sender and who is receiver also it verifies whether the user is an authorized
user.
Non-Repudiation: When you have sent something you can’t tell that you didn’t sent and
when you have receive some message you can’t tell that you didn’t receive anything.
Availability: Resources/applications must be available to authentic users all the time
Cryptography Primitives
🠶 Cryptography primitives are the tools and techniques in cryptography that can be
selectively used to provide a set of desired security services like Encryption, Hash
Function ,Message Authentication Code(MAC) and Digital Signatures
🠶 Encryption
The process of converting information or data into a code, especially to prevent
unauthorized access.
🠶 Hash Function
A hash function is a mathematical algorithm that takes an arbitrary amount of data as
input and produces a fixed-size output of enciphered text .
The values returned by a hash function are called hash values, hash codes, digests, or
simply hashes.
In general, the hash is much smaller than the input data.
For eg.it takes 512 bit as input and produces 128 bit hash code as output
🠶 Message Authentication Code(MAC)
In cryptography, a message authentication code (MAC), sometimes known as a tag,
is a short piece of information used to authenticate a message—in other words, to
confirm that the message came from the stated sender (its authenticity) and has not
been changed.
🠶 Digital Signatures
A digital signature is a mathematical scheme, for verifying the authenticity of digital
messages or documents. Here the message is encrypted by means of senders private
key and this becomes the signature where in attached with the message. At the
receiving end the the signature can only be decrypted by the senders public key, so
that the receiver may able to verify the authenticity of message.
PERFECT SECURITY
🠶 Perfect Secrecy(or information-theoretic secure)means that the cipher text conveys no
information about the content of the plain text. However, part of being provable
secure is that you need as much key material as you have plain text to encrypt.
.i.e if intruder gets my cipher text and he uses many techniques to get into it, even
though he couldn’t able to break the code. If this happens I can tell that my data is
perfect data.i.e he is not able to get back my plaintext at any cost.
INFORMATION THEORY
🠶 Mainly focus on the amount of data to be transmitted, how the data is transmitted,
whether the data is transmitted through wired channel or wireless channel, how far it
is secure? This field is the intersection of mathematics, statistics, computer science,
physics, neurobiology, information engineering and electrical engineering,, natural
language processing ,cryptography , neurobiology, human vision , the evaluation and
function of molecular codes(bioinformatics),model selection in statistics , thermal
physics , quantum computing , linguistics , plagiarism detection , pattern recognition
and anomaly detection. Actually it is a database or its similar to encyclopedia
PRODUCT CRYPTOSYSTEMS
A product cipher combines two or more transformations in a plaintext so that the
resulting cipher is more secure than the individual components to make an resistant to
cryptanalysis. The product cipher combines a sequence of simple transformations
such as substitution(s-box), permutation(p-box) and modular arithmetic operations.In
Caesar ciper, plafar cipher and so on we applied substitution technique’s where as in
Rail fence and row col technique permutation concepts were applied .Instead of
applying a single technique alone, the combination could yield a system more
powerful by applying substitution and permutation transformation .In Data Encryption
Standard and the Advanced Encryption Standard product cipher technique is used
.we will see them in the next unit.
CRYPTANALYSIS
Cryptanalysis is the art of trying to decrypt the encrypted messages, without the use of
key. Various attacks are
🠶 Brute force attack: This type of attack uses algorithms that try to guess all possible
logical combinations of the plain text which are then ciphered and compared against
the original cipher.
🠶 Dictionary attack: This type of attack uses a wordlist in order to find a match of
either the plaintext or key. In word list the data will be in the form of Jumbled words
.Now the attacker may rearrange to get the original data. It is mainly used when trying
to crack encrypted passwords.
🠶 Rainbow table attack: Previously the computed hash values will be stored in the
hash table. This type of attack compares the cipher text against precomputed hashes to
find matches.
Other attacks using Cryptanalysis
🠶 Known-Plaintext Analysis (KPA): Attacker decrypt ciphertext with known partial
plain text.
🠶 Chosen-Plaintext Analysis (CPA): Attacker arbitrarily selecting plaintext and
generating some cipher text via the same algorithm technique.
🠶 Man-in-the-Middle Attack(MITM) : Attack occurs when two parties use message
or key sharing for communication via a channel that appears secure but is actually
compromised