UNIT 1 CRYPTOGRAPHY INTRODUCTION
Cryptography is the science and practice of securing communication and information through the
use of mathematical techniques and algorithms. Its primary goal is to ensure the confidentiality,
integrity, and authenticity of data. Cryptography has been used for centuries to protect sensitive
information from unauthorized access and tampering.
the objectives of cryptography include:
Confidentiality: Maintain data confidential, so that it can’t be understood by anyone unintended.
Authentication: Confirm the origin and destination of the information being sent, as well as the
identity of the message’s sender and receiver.
Integrity: Ensure that data can’t be altered when stored or in movement, and detect if any alteration
has occurred.
Non-repudiation: Demonstrate the involvement of the creator/sender in the transmission of data.
security trends in cryptography:
Digital signatures: Digital signatures are electronically-encrypted signatures, they are a key
component of blockchain, and public key encryption uses digital signatures to sign documents.
Some types of digital signatures in cryptography include ECDSA (used by Bitcoin), the Schnorr
signature, and BLS signature.
Digital certificates: A digital certificate proves the authenticity of a device, server, or user, and
organisations are managing shorter digital certificate schedules. With expiration and automation in
play, encryption and key management will play key roles.
Blockchain: Banks, governments, hospitals, and other organisations that manage high-volume,
sensitive data are experimenting with Blockchain for cyber security. Challenges include high cost,
tough implementation, challenges in encryption key management.
Cloud-based security: There is broader acceptance of cloud-based encryption and key management,
especially in finance. Financial services and payment processing are being performed in the cloud,
providing advances in data access, retention, key management, and vendor choice.
Homomorphic encryption: A technique that enables data owners or a third party to apply functions
on encrypted data without needing to reveal the values of the data. However, homomorphic
encryption requires significant computing power and is costly.
Quantum computing: Large-scale quantum computing poses a threat to current cryptography
encryption methods (public-key encryption and PKI, the core of secure data exchange and
transactions). Not protecting against advances in quantum computing will affect every sector.
Future-proofing: Organisations are reviewing their critical infrastructure (PKI, digital certificates,
HSMs, roots of trust, etc), taking inventory, and putting security processes in place to reduce risks.
The more we learn about the weaknesses of classical cryptography, the better we can build new
cryptographic systems strong enough to resist future attacks.
OSI Security Architecture
The security of an organization is the greatest concern of the people working at the organization.
Safety and security are the pillars of cyber technology. It is hard to imagine the cyber world without
thinking about security. The architecture of security is thus a very important aspect of the
organization. The OSI (Open Systems Interconnection) Security Architecture defines a systematic
approach to providing security at each layer. It defines security services and security mechanisms
that can be used at each of the seven layers of the OSI model to provide security for data transmitted
over a network. These security services and mechanisms help to ensure the confidentiality,
integrity, and availability of the data.
OSI Security Architecture is categorized into three broad categories namely Security Attacks,
Security mechanisms, and Security Services.
Security Attacks
A security attack is an attempt by a person or entity to gain unauthorized access to disrupt or
compromise the security of a system, network, or device. These are defined as the actions that put
at risk an organization’s safety. They are further classified into 2 sub-categories:
1.Passive Attack
2.Active Attacks
Passive Attack
Attacks in which a third-party intruder tries to access the message/ content/ data being shared by
the sender and receiver by keeping a close watch on the transmission or eave-dropping the
transmission is called Passive Attacks. These types of attacks involve the attacker observing or
monitoring system, network, or device activity without actively disrupting or altering it. Passive
attacks are typically focused on gathering information or intelligence, rather than causing damage
or disruption.
Here, both the sender and receiver have no clue that their message/ data is accessible to some
third-party intruder. The message/ data transmitted remains in its usual form without any
deviation from its usual behavior. This makes passive attacks very risky as there is no information
provided about the attack happening in the communication process. One way to prevent passive
attacks is to encrypt the message/data that needs to be transmitted, this will prevent third-party
intruders to use the information though it would be accessible to them.
Passive attacks are further divided into two parts based on their behavior:
Eavesdropping: This involves the attacker intercepting and listening to communications between
two or more parties without their knowledge or consent. Eavesdropping can be performed using a
variety of techniques, such as packet sniffing, or man-in-the-middle attacks.
Traffic analysis: This involves the attacker analyzing network traffic patterns and metadata to
gather information about the system, network, or device. Here the intruder can’t read the message
but only understand the pattern and length of encryption. Traffic analysis can be performed using a
variety of techniques, such as network flow analysis, or protocol analysis.
Active attacks
In active attacks, the attacker intercepts the connection and efforts to modify the message's content.
It is dangerous for integrity and availability of the message. Active attacks involve Masquerade,
Modification of message, Repudiation, Replay, and Denial of service. The system resources can be
changed due to active attacks. So, the damage done with active attacks can be harmful to the system
and its resources.
Masquerade: It is a type of attack in which the attacker pretends to be an authentic sender in order
to gain unauthorized access to a system. This type of attack can involve the attacker using stolen or
forged credentials, or manipulating authentication or authorization controls in some other way.
Replay: It is a type of active attack in which the attacker intercepts a transmitted message through a
passive channel and then maliciously or fraudulently replays or delays it at a later time.
Modification of Message : It involves the attacker modifying the transmitted message and making
the final message received by the receiver look like it’s not safe or non-meaningful. This type of
attack can be used to manipulate the content of the message or to disrupt the communication
process.
Denial of service (DoS) attacks :It involve the attacker sending a large volume of traffic to a system,
network, or device in an attempt to overwhelm it and make it unavailable to legitimate users.
Security Mechanism
The mechanism that is built to identify any breach of security or attack on the organization, is called
a security mechanism. Security Mechanisms are also responsible for protecting a system, network,
or device against unauthorized access, tampering, or other security threats. Security mechanisms
can be implemented at various levels within a system or network and can be used to provide
different types of security, such as confidentiality, integrity, or availability.
Some examples of security mechanisms include:
Encipherment (Encryption) :It involves the use of algorithms to transform data into a form that can
only be read by someone with the appropriate decryption key. Encryption can be used to protect
data it is transmitted over a network, or to protect data when it is stored on a device.
Digital signature : It is a security mechanism that involves the use of cryptographic techniques to
create a unique, verifiable identifier for a digital document or message, which can be used to ensure
the authenticity and integrity of the document or message.
Traffic padding : It is a technique used to add extra data to a network traffic stream in an attempt to
obscure the true content of the traffic and make it more difficult to analyze.
Routing control :It allows the selection of specific physically secure routes for specific data
transmission and enables routing changes, particularly when a gap in security is suspected.
Security Services:
Security services refer to the different services available for maintaining the security and safety of
an organization. They help in preventing any potential risks to security. Security services are
divided into 5 types:
Authentication: It is the process of verifying the identity of a user or device in order to grant or deny
access to a system or device.
Access control: It involves the use of policies and procedures to determine who is allowed to access
specific resources within a system.
Data Confidentiality: It is responsible for the protection of information from being accessed or
disclosed to unauthorized parties.
Data integrity: It is a security mechanism that involves the use of techniques to ensure that data has
not been tampered with or altered in any way during transmission or storage.
Non- repudiation: It involves the use of techniques to create a verifiable record of the origin and
transmission of a message, which can be used to prevent the sender from denying that they sent the
message.
A Model for Network Security
All the techniques for providing security have two components:
A security-related transformation on the information to be sent.
Some secret information is shared by the two principals and, it is hoped, unknown to the opponent.
A trusted third party may be needed to achieve secure transmission. For example, a third party may
be responsible for distributing the secret information to the two principals while keeping it from
any opponent. Or a third party may be needed to arbitrate disputes between the two principals
concerning the authenticity of a message transmission. This model shows that there are four basic
tasks in designing a particular security service:
1.Design an algorithm for performing the security-related transformation.
2.Generate the secret information to be used with the algorithm.
3.Develop methods for the distribution and sharing of secret information.
4.Specify a protocol to be used by the two principals that make use of the security algorithm and the
secret information to achieve a particular security service.
CLASSICAL ENCRYPTION TECHNIQUES
· The Process of converting from plaintext to ciphertext is known as enciphering or encryption.
· Restoring the plaintext from the ciphetext is deciphering or decryption.
· The many schemes used for encryption constitute the area of study known as cryptography.
· Techniques used for deciphering a message without any knowledge of the enciphering details is
known as cryptanalysis. It also known as "Breaking the Code".
· The areas of cryptography and cryptanalysis together are called cryptology.
· A cryptanalyst develops mathematical methods and codes that protect data from computer
hackers.
This involves the decryption of a cipher text into plain text in order to transmit a message over
insecure channels.
Symmetric cipher model
Ø Symmetric encryption is a form of cryptosystem in which encryption and decryption are
performed using the
same key.
Ø It is also known as conventional encryption.
Ø Symmetric encryption transforms plaintext into cipher text using a secret key and an encryption
algorithm.
Ø Using the same key and a decryption algorithm, the plaintext is recovered from the cipher text.
Ø A symmetric encryption scheme has five ingredients
o Plaintext: This is the original intelligible message or data that is fed into the algorithm as input.
o Encryption algorithm: The encryption algorithm performs various substitutions and
transformations
on the plaintext.
o 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.
o Ciphertext: This is the scrambled message produced as output. It depends on the plaintext and the
secret key. The ciphertext is an apparently random stream of data and, as it stands, is unintelligible.
o Decryption algorithm: This is essentially the encryption algorithm run in reverse. It takes the
ciphertext and the secret key and produces the original plaintext
Substitution Techniques
It is one in which the letters of plaintext are replaced by other letters or by numbers or symbols.
Caesar cipher
· The encryption rule is simple; replace each letter of the alphabet with the letter standing 3 places
further down the alphabet.
· The alphabet is wrapped around so that Z follows A.
· Generally Plain text is in lower case and Cipher text is Upper Case.
· Example:
Plaintext: meet me after the party
Ciphertext: PHHW PH DIWHU WKH SDUWB
· Here, the key is 3. If different key is used, differentsubstitution will be obtained.
· Mathematically,starting from a=0, b=1 and so on, Caesar cipher can be written as:
E(𝑝) = (𝑝 + 𝑘) mod (26)
D(C) = (C – 𝑘) mod (26)
This cipher can be broken
o If we know one plaintext-cipher text pair since the difference will be same.
o By applying Brute Force attack as there are only 26 possible keys.
Monoalphabetic Substitution Cipher
Instead of shifting alphabets by fixed amount as in Caesar cipher, any random permutation is
assigned to
the alphabets. This type of encryption is called monoalphabetic substitution cipher.
· For example, A is replaced by Q, B by D, C by T etc. then it will be comparatively stronger than
Caesar
cipher.
· The number of alternative keys possible now becomes 26!.
· Thus, Brute Force attack is impractical in this case.
· However, another attack is possible. Human languages are redundant i.e. certain characters are
used
more frequently than others. This fact can be exploited.
· In English ‘e’ is the most common letter followed by ‘t’, ‘r’, ‘n’, ’o’, ‘a’ etc. Letters like ‘q’, ‘x’, ‘j’ are less
frequently used.
· Moreover, digrams like ‘th’ and trigrams like ‘the’ are also more frequent.
· Tables of frequency of these letters exist. These can be used to guess the plaintext if the plaintext is
in
uncompressed English language.
· The most common two letter combinations are called as digrams. e.g. th, in, er, re and an.
· The most common three letter combinations are called as trigrams. e.g. the, ing, and, and ion
Playfair Cipher
In this technique multiple (2) letters are encrypted at a time.
· This technique uses a 5 X 5 matrix which is also called key matrix
The plaintext is encrypted two letters at a time:
o Break the plaintext into pairs of two consecutive letters.
o If a pair is a repeated letter, insert a filler like ‘X‘in the plaintext, eg. "Balloon" is treated as "ba lx lo
on".
o If both letters fall in the same row of the key matrix, replace each with the letter to its right
(wrapping back to start from end), eg. “AR" encrypts as "RM".
o If both letters fall in the same column, replace each with the letter below it (again wrapping to top
from bottom), eg. “MU" encrypts to "CM".
o Otherwise each letter is replaced by the one in its row in the column of the other letter of the
pair, eg. “HS" encrypts to "BP", and “EA" to "IM" or "JM" (as desired)
· Security is much improved over monoalphabetic as here two letters are encrypted at a time and
hence there are 26 X 26 =676 diagrams and hence it needs a 676 entry frequency table.
However, it can be broken even if a few hundred letters are known as much of plaintext structure
isretained in
cipher text.
Example 2: PlainText: "instruments" keyword: monarchy
After Split: 'in' 'st' 'ru' 'me' 'nt' 'sz'
cipher text : ga tl mz cl rq tx
For both encryption and decryption, the same key is to be used.
Strength of playfair cipher Playfair cipher is a great advance over simple mono alphabetic ciphers.
Since there are 26
letters, 26x26 = 676 diagrams are possible, so identification of individual diagram is more difficult.
Hill Cipher:
This cipher is based on linear algebra.
· Each letter is represented by numbers from 0 to 25 and calculations are done
modulo 26.
· This encryption algorithm takes m successive plaintext letters and substitutes them with m cipher
text
letters.
· The substitution is determined by m linear equations. For m = 3, the system can be described as:
𝑐1 = (𝑘11𝑝1 + 𝑘12𝑝2 + 𝑘13𝑝3
) 𝑚o𝑑 26
𝑐2 = (𝑘21𝑝1 + 𝑘22𝑝2 + 𝑘23𝑝3
) 𝑚o𝑑 26
𝑐3 = (𝑘31𝑝1 + 𝑘32𝑝2 + 𝑘33𝑝3
) 𝑚o𝑑 26
· This can also be expressed in terms of row vectors and matrices.
𝑘11 𝑘12 𝑘13
(𝑐1 𝑐2 𝑐3
) = (𝑝1 𝑝2 𝑝3
) (𝑘21 𝑘22 𝑘23) 𝑚o𝑑 26
𝑘31 𝑘32 𝑘33
Where C and P are row vectors of length 3 representing the plaintext and cipher text, and K is a 3 X
3
matrix representing the encryption key
· Key is an invertible matrix K modulo 26, of size m. For example:
17 17 5 4 19 15
𝐾 = (21 18 21) 𝐾−1 = (15 17 6 )
2 2 19 24 0 17
· Encryption and decryption can be given by the following formulae:
Encryption: 𝐶 = 𝑃𝐾 𝑚o𝑑 26
Decryption: 𝑃 = 𝐶𝐾−1 𝑚o𝑑 26
One-Time Pad
· In this scheme, a random key that is as long as the message is used.
· The key is used to encrypt and decrypt a single message, and then is discarded. Each new message
requires a new key of the same length as the new message.
· This scheme is unbreakable.
· It produces random output that bears no statistical relationship to the plaintext.
· Because the ciphertext contains no information whatsoever about the plaintext, there is simply no
way
to break the code.
· For any plaintext of equal length to the ciphertext, there is a key that produces that plaintext.
· Therefore, if you did an exhaustive search of all possible keys, you would e
plaintexts, with no way of knowing which the intended plaintext was.
· Therefore, the code is unbreakable.
· The security of the one-time pad is entirely due to the randomness of the key.
d up with many legible
· The one-time pad offers complete security but, in practice, hastwo fundamental difficulties:
o There is the practical problem of making large quantities of random keys. Any heavily used system
might require millions of random characters on a regular basis. Supplying truly random characters
in
this volume is a significant task.
o Another problem is that of key distribution and protection. For every message to be sent, a key of
equal length is needed by both sender and receiver.
· Because of these difficulties, the one-time pad is used where very high security is required.
· The one-time pad is the only cryptosystem that exhibits perfect secrecy.
Transposition Technique:
In the transposition technique, the characters' identities are kept the same, but their positions are
altered to produce the ciphertext. A transposition cipher in cryptography is a type of encryption
that scrambles the locations of characters without altering the characters themselves. Transposition
ciphers produce a ciphertext that is a permutation of the plaintext by rearranging the components
of the plaintext in accordance with a regular method. It is distinct from substitution ciphers, which
don't replace the unit's positions of plaintext but instead substitute the units themselves. A bijective
function is utilized to the character locations to encrypt data, and an inverse function is employed to
decode data. It is not a very secure technique.
Rail Fence encryption is a sort of transposition cipher that acquires its name from how it is
encrypted the data. The plaintext is written down and diagonally on successive "rail" of an artificial
fence in the rail fence and then pushed up when you get to the bottom. After that, the message is
read aloud in a row-by-row fashion.
The Rail Fence Cipher is based on an old Greek mechanical device for building a transposition
cipher that follows a fairytale-like pattern. The mechanism consisted of a cylinder with a ribbon
wrapped around it. The encrypted message was written on the coiled ribbon. The characters of the
original message were rearranged when the ribbon was uncoiled from the cylinder. The message
was decrypted when the ribbon was wrapped in a cylinder with a similar diameter to the
encrypting cylinder.