Cryptography1 113832
Cryptography1 113832
Computer networks were primarily used by university researchers for sending email and
by corporate employees for sharing printers. Under these conditions, security did not get a lot of
attention. But now, as millions of ordinary citizens are using networks for banking, shopping, and
filing their tax returns, and weakness after weakness has been found, network security has
become a problem of massive proportions.
Security is a broad topic and covers a multitude of sins. In its simplest form, it is concerned
with making sure that curious people cannot read, or worse yet, secretly modify messages
intended for other recipients. It is concerned with people trying to access remote services that
they are not authorized to use.
Security also deals with the problems of legitimate messages being captured and replayed,
and with people later trying to deny that they sent certain messages. Most security problems are
intentionally caused by malicious people trying to gain some benefit, get attention, or harm
someone.
Network security problems can be divided roughly into four closely intertwined areas: secrecy,
authentication, nonrepudiation, and integrity control.
A Model for Network Security
A model for much of what we will be discussing is captured, in very general terms. A
message is to be transferred from one party to another across some sort of internet. 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.
Security aspects come into play when it is necessary or desirable to protect the information
transmission from an opponent who may present a threat to confidentiality, authenticity, and so
on. All the techniques for providing security have two components:
● A security-related transformation on the information to be sent. Examples include the
encryption of the message, which scrambles the message so that it is unreadable by the opponent,
and the addition of a code based on the contents of the message, which can be used to verify the
identity of the sender.
● Some secret information shared by the two principals and, it is hoped, unknown to the
opponent. An example is an encryption key used in conjunction with the transformation to
scramble the message before transmission and unscramble it on reception.
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 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.
The hacker can be someone who, with no malign intent, simply gets satisfaction from breaking
and entering a computer system. Or, the intruder can be a disgruntled employee who wishes to do
damage, or a criminal who seeks to exploit computer assets for financial gain (e.g., obtaining credit
card numbers or performing illegal money transfers). Another type of unwanted access is the
placement in a computer system of logic that exploits vulnerabilities in the system and that can
affect application programs as well as utility programs, such as editors and compilers. Programs
can present two kinds of threats:
● Information access threats intercept or modify data on behalf of users who should not have
access to that data.
● Service threats exploit service flaws in computers to inhibit use by legitimate users.
Viruses and worms are two examples of software attacks. Such attacks can be introduced into a
system by means of a disk that contains the unwanted logic concealed in otherwise useful
software. They can also be inserted into a system across a network; this latter mechanism is of
more concern in network security.
The security mechanisms needed to cope with unwanted access fall into two broad categories.
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.
CRYPTOGRAPHY
Cryptography comes from the Greek words for ‘‘secret writing.’’ Cryptography is the study
of techniques for secure communication in the presence of third parties. It involves the use of
mathematical algorithms and protocols to secure the confidentiality, integrity, and authenticity of
communication. Cryptography is used in a wide range of applications, including securing
communication over the internet, protecting sensitive data, and authenticating the identity of
users.
There are two main types of cryptography − symmetric cryptography and asymmetric
cryptography. In symmetric cryptography, the same key is used for both encryption and
decryption. This is suitable for situations where the sender and receiver of a message have a
shared secret key. In asymmetric cryptography, also known as public-key cryptography, different
keys are used for encryption and decryption. This is suitable for situations where the sender and
receiver of a message do not have a shared secret key, as it allows them to exchange messages
securely without needing to share a secret key.
Cryptography generally deals with the study and practice of techniques for ensuring secure
communication between two parties in the presence of a third party called adversaries.
The messages to be encrypted, known as the plaintext, are transformed by a function that
is parameterized by a key. The output of the encryption process, known as the ciphertext, is then
transmitted, often by messenger or radio. We assume that the enemy, or intruder, hears and
accurately copies down the complete ciphertext. However, unlike the intended recipient, he does
not know what the decryption key is and so cannot decrypt the ciphertext easily. Sometimes the
intruder can not only listen to the communication channel (passive intruder) but can also record
messages and play them back later, inject his own messages, or modify legitimate messages before
they get to the receiver (active intruder).
It will often be useful to have a notation for relating plaintext, ciphertext, and keys. We will
use C = EK(P) to mean that the encryption of the plaintext P using key K gives the ciphertext C.
Similarly, P = DK(C) represents the decryption of C to get the plaintext again. It then follows that
DK(EK(P)) = P
Cryptographic Principles
Cryptographic principles are the fundamental concepts and techniques that are used in the
field of cryptography to secure communication and protect data. These principles include
confidentiality, integrity, authentication, non-repudiation, and key management.
There are several fundamental principles that are important in the field of cryptography,
including −
Confidentiality − Confidentiality refers to the ability to keep information private and
secure. Cryptographic techniques, such as encryption, can be used to protect the
confidentiality of information by making it unreadable to anyone who does not have the
proper decryption key.
Integrity − Integrity refers to the ability to ensure that information has not been altered or
tampered with. Cryptographic techniques, such as hash functions, can be used to ensure the
integrity of information by providing a way to detect any changes to the data.
Authentication − Authentication refers to the process of verifying the identity of a user or
device. Cryptographic techniques, such as digital signatures, can be used to authenticate the
identity of a user or device in a secure manner.
Non-repudiation − Non-repudiation refers to the ability to prevent someone from denying
that they performed a particular action. Cryptographic techniques, such as digital
signatures, can be used to provide non-repudiation by allowing the sender of a message to
prove that they sent the message and the receiver to prove that they received the message.
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. Two types of passive
attacks are release of message contents and traffic analysis.
The release of message contents is easily understood. A telephone conversation, an
electronic mail message, and a transferred file may contain sensitive or confidential
information. We would like to prevent an opponent from learning the contents of these
transmissions.
A second type of passive attack, traffic analysis, is subtler. Suppose that we had a way of
masking the contents of messages or other information traffic so that opponents, even if
they captured the message, could not extract the information from the message. The
common technique for masking contents is encryption. If we had encryption protection in
place, an opponent might still be able to observe the pattern of these messages. The
opponent could determine the location and identity of communicating hosts and could
observe the frequency and length of messages being exchanged. This information might be
useful in guessing the nature of the communication that was taking place.
Passive attacks are very difficult to detect because they do not involve any alteration of
the data. Typically, the message traffic is sent and received in an apparently normal fashion and
neither the sender nor receiver is aware that a third party has read the messages or observed the
traffic pattern. However, it is feasible to prevent the success of these attacks, usually by means of
encryption. Thus, the emphasis in dealing with passive attacks is on prevention rather than
detection.
Active Attacks:
Active attacks involve some modification of the data stream or the creation of a false
stream andcan be subdivided into four categories:
1. masquerade,
2. replay,
3. modification of messages, and
4. denial of service.
A masquerade takes place when one entity pretends to be a different entity. A masquerade attack
usually includes one of the other forms of active attack. For example, authentication sequences
can be captured and replayed after a valid authentication sequence has taken place, thus enabling
an authorized entity with few privileges to obtain extra privileges by impersonating an entity that
has those privileges.
Replay involves the passive capture of a data unit and its subsequent retransmission to produce
an unauthorized effect.
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.
denial of service prevents or inhibits the normal use or management of communications
facilities. This attack may have a specific target; for example, an entity may suppress all messages
directed to a particular destination (e.g., the security audit service). Another form of service denial
is the disruption of an entire network, either by disabling the network or by overloading it with
messages so as to degrade performance.
Active attacks present the opposite characteristics of passive attacks. Whereas passive
attacks are difficult to detect, measures are available to prevent their success. On the other hand, it
is quite difficult to prevent active attacks absolutely, because of the wide variety of potential
physical, software, and network vulnerabilities. Instead, the goal is to detect active attacks and to
recover from any disruption or delays caused by them. If the detection has a deterrent effect, it
may also contribute to prevention.
Security Services
X.800 defines a security service as a service provided by a protocol layer of communicating
open systems, which ensures adequate security of the systems or of data transfers. Perhaps a
clearer definition is: a processing or communication service that is provided by a system to give a
specific kind of protection to system resources; security services implement security policies and are
implemented by security mechanisms.
Authentication
The authentication service is concerned with assuring that a communication is authentic.
In the case of a single message, such as a warning or alarm signal, 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. First, at the time of connection initiation, the service assures that the two
entities are authentic, that is, that each is the entity that it claims to be. Second, the service must
assure that the connection is not interfered with in such a way that a third party can masquerade as
one of the two legitimate parties for the purposes of unauthorized transmission or reception. Two
specific authentication services are defined in X.800:
● Peer entity authentication: Provides for the corroboration of the identity of a peer entity in
an association. It is provided for use at the establishment of, or at times during the data
transfer phase of, a connection. It attempts to provide confidence that an entity is not
performing either a masquerade or an unauthorized replay of a previous connection.
● Data origin authentication: Provides for the corroboration of the source of a data unit. It
does not provide protection against the duplication or modification of data units. This type of
service supports applications like electronic mail where there are no prior interactions
between the communicating entities.
Access Control
In the context of network security, access control is the ability to limit and control the access
to host systems and applications via communications links. To achieve this, each entity trying to
gain access must first be identified, or authenticated, so that access rights can be tailored to the
individual.
Data Confidentiality
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. The broadest service
protects all user data transmitted between two users over a period of time. For example, when a TCP
connection is set up between two systems, this broad protection prevents the release of any user
data transmitted over the TCP connection. Narrower forms of this service can also be defined,
including the protection of a single message or even specific fields within a message. These
refinements are less useful than the broad approach and may even be more complex and
expensive to implement.
The other aspect of confidentiality is the protection of traffic flow from analysis. This
requires that an attacker not be able to observe the source and destination, frequency, length, or
other characteristics of the traffic on a communications facility.
Data Integrity
As with confidentiality, integrity can apply to a stream of messages, a single message, or
selected fields within a message. Again, the most useful and straightforward approach is total
stream protection. A connection-oriented integrity service, one that deals with a stream of messages,
assures that messages are received as sent, with no duplication, insertion, modification, reordering,
or replays. The destruction of data is also covered under this service. Thus, the connection-
oriented integrity service addresses both message stream modification and denial of service. On
the other hand, a connectionless integrity service, one that deals with individual messages without
regard to any larger context, generally provides protection against message modification only.
We can make a distinction between the service with and without recovery. Because the
integrity service relates to active attacks, we are concerned with detection rather than
prevention. If a violation of integrity is detected, then the service may simply report this violation,
and some other portion of software or human intervention is required to recover from the
violation. Alternatively, there are mechanisms available to recover from the loss of integrity of
data, as we will review subsequently. The incorporation of automated recovery mechanisms is, in
general, the more attractive alternative.
Nonrepudiation
Nonrepudiation prevents either sender or receiver from denying a transmitted message.
Thus, when a message is sent, the receiver can prove that the alleged sender in fact sent the
message. Similarly, when a message is received, the sender can prove that the alleged receiver in
fact received the message.
Security Mechanisms
Following is the list of the security mechanisms defined in X.800. As can be seen the
mechanisms are divided into those that are implemented in a specific protocol layer and those that
are not specific to any particular protocol layer or security service.
X.800 distinguishes between reversible encipherment mechanisms and irreversible
encipherment mechanisms. A reversible encipherment mechanism is simply an encryption
algorithm that allows data to be encrypted and subsequently decrypted. Irreversible encipherment
mechanisms include hash algorithms and message authentication codes, which are used in digital
signature and message authentication applications.
Specific Security Mechanisms
May be incorporated into the appropriate protocol layer in order to provide some of the
OSIsecurity services.
1. 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
algorithmand zero or more encryption keys.
2. 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).
3. Access Control: A variety of mechanisms that enforce access rights to resources.
4. Data Integrity: A variety of mechanisms used to assure the integrity of a data unit or stream
of data units.
5. Authentication Exchange: A mechanism intended to ensure the identity of an entity by
means of information exchange.
6. Traffic Padding: The insertion of bits into gaps in a data stream to frustrate traffic analysis
attempts.
7. Routing Control: Enables selection of particular physically secure routes for certain data
andallows routing changes, especially when a breach of security is suspected.
8. Notarization: The use of a trusted third party to assure certain properties of a data exchange.
Substitution Technique
Substitution technique is a classical encryption technique where the characters present
in the original message are replaced by the other characters or numbers or by symbols. If the
plain text (original message) is considered as the string of bits, then the substitution technique
would replace bit pattern of plain text with the bit pattern of cipher text.
Some of the substitution techniques are as follows:
Caesar Cipher
Monoalphabetic Cipher
Playfair Cipher
Hill Cipher
Polyalphabetic Cipher
One-Time Pad
Caesar Cipher
This the simplest substitution cipher by Julius Caesar. In this substitution technique, to
encrypt the plain text, each alphabet of the plain text is replaced by the alphabet three places
further it. And to decrypt the cipher text each alphabet of cipher text is replaced by the alphabet
three places before it.
Let us take a simple example:
Plain Text: meet me tomorrow
Cipher Text: phhw ph wrpruurz
Look at the example above, we have replaced, ‘m’ with ‘p’ which occur three places after,
‘m’. Similarly, ‘e’ is replaced with ‘h’ which occurs in three places after ‘e’.
Note: If we have to replace the letter ‘z’ then the next three alphabets counted after ‘z’ will be ‘a’
‘b’ ‘c’. So, while counting further three alphabets if ‘z’ occurs it circularly follows ‘a’.
There are also some drawbacks of this simple substitution technique. If the hacker knows
that the Caesar cipher is used then to perform brute force cryptanalysis, he has only to try 25
possible keys to decrypt the plain text. The hacker is also aware of the encryption and decryption
algorithm.
Monoalphabetic Cipher
Monoalphabetic cipher is a substitution cipher, where the cipher alphabet for each plain
text alphabet is fixed, for the entire encryption.
In simple words, if the alphabet ‘p’ in the plain text is replaced by the cipher alphabet ‘d’.
Then in the entire plain text wherever alphabet ‘p’ is used, it will be replaced by the alphabet ‘d’ to
form the ciphertext.
Polyalphabetic Cipher
Polyalphabetic cipher is far more secure than a monoalphabetic cipher. As monoalphabetic
cipher maps a plain text symbol or alphabet to a ciphertext symbol and uses the same ciphertext
symbol wherever that plain text occurs in the message. But polyalphabetic cipher, each time
replaces the plain text with the different ciphertext.
Playfair Cipher
This technique involves creating a 5×5 matrix from keyword. Rules for generating
ciphertext in Playfair Cipher:
Firstly, create a 5×5 matrix from given keyword.
Secondly, create pairs of alphabets, if same letters are there in pair, add ‘x’ in between.
Thirdly, if pair appears in same row, shift the letter with immediate right letter.
If pair appears in same column, replace it with the letter below it.
In case pairs are in different rows and columns, replace it with the letters on corner of
same row.
For instance, Keyword: OCCURENCE, Plaintext: TALL TREES. Here, resultant pair will be: TA LX LT
RE ES. Keyword matrix is as follows:
O C U R E
N A B D F
G H I/J K L
M P Q S T
V W X Y Z
5×5 matrix in Playfair Cipher
Hence, here ‘TA’ are in different rows and columns, so replace it by ‘PF’. Thus, ciphertext =
PF IZ TZ EO RT
Hill Cipher
Firstly, in hill cipher, we create a square matrix of key and we also form a matrix of
plaintext. Secondly, the general equation is as follows:
Hence, for encryption, Cipher = PKmod26, here P = plaintext and K = Key.
Moreover, for decryption, Plaintext = CK-1 mod 26. For instance, keyword = HILL and
Plaintext = EXAM, we create a 2×2 matrix of HILL and 2×1 matrix of (EX) and (AM) respectively.
Similarly, for decryption we need to find inverse of K and then multiply it by cipher value.
Lastly, we need to calculate mod 26.
Transposition Technique
Transposition technique is an encryption method which is achieved by
performing permutation over the plain text. Mapping plain text into cipher text using
transposition technique is called transposition cipher.
Transposition technique(No replacement of character) is an encryption method which is
achieved by performing permutation over the plain text. Mapping plain text into cipher text using
transposition technique is called transposition cipher.
On the one hand, the substitution technique substitutes a plain text symbol with a cipher
text symbol. On the other hand, the transposition technique executes permutation on the plain
text to obtain the cipher text. Some of the transposition techniques are:
1. Rail Fence Transposition
2. Columnar Transposition
3. Improved Columnar Transposition
4. Book Cipher/Running Key Cipher
Now let's decide on an order for the column as 4, 1, 3 and 2 and now we will read the text
in column-wise.
Cipher-text: LHIEEIUESSCEPWMNDLAO
Improved Columnar Transposition ( Columnar Technique with multiple rounds)
In this method, we again change the chipper text we received from a Basic technique that is
in round 1 and again follows the same procedure for the cipher-text from round 1.
Algorithm:
1. In a rectangle of pre-defined size, write the plain-text message row by row.
2. Read the plain message in random order in a column-wise fashion. It can be any order such
as 2, 1, 3 etc.
3. Thus, Cipher-text of round 1 is obtained.
4. Repeat from step 1 to 3.
Example:
Original message: "INCLUDEHELP IS AWESOME".
Now we apply the above algorithm and create the rectangle of 4 column (we decide to make a
rectangle with four column it can be any number.)
Now let's decide on an order for the column as 4, 1, 3 and 2 and now we will read the text in
column-wise.
Cipher-text of round 1: LHIEEIUESSCEPWMNDLAO
Round 2:
What Is Cryptanalysis?
Cryptanalysis is the study and process of analyzing and decrypting ciphers, codes, and
encrypted text without using the real key. Alternately, we can say it’s the technique of accessing a
communication’s plain text content when you don’t have access to the decryption key.
Put simply, cryptanalysis is the practice, science, or art of decrypting encrypted messages.
Cryptanalysis experts study ciphers, cryptosystems, and ciphertext to understand their functions.
Then, they use that knowledge to find or improve techniques to weaken or defeat them. However,
as we're about to see, it can be used for good or nefarious purposes.
So, a cryptographer is someone who writes encryption code used in cybersecurity, while a
cryptoanalyst is someone who tries to crack those encryption codes. Two opposing sides of the
cybersecurity coin, locked in conflict, trying to one-up the other, constantly inventing new
measures and countermeasures. This rivalry drives the innovation found in the cybersecurity
field.
Who Uses Cryptanalysis?
Unsurprisingly, hackers use cryptanalysis. Would-be hackers use cryptanalysis to root out
cryptosystem vulnerabilities rather than a brute force attack. Governments use cryptanalysis to
decipher the encrypted messages of other nations. Companies specializing in cybersecurity
products and services use cryptanalysis to test their security features. Even the world of academia
gets in on the action, with researchers and academicians looking for weaknesses in cryptographic
algorithms and protocols.
Speaking of hackers, we should point out that both black and white-hat hackers use cryptanalysis.
Black-hat hackers use it to commit cybercrimes, and white-hat hackers use it to
conduct penetration testing as directed by organizations that hire them to test their security.
Cryptanalysis Attacks and Techniques
There are many different forms of cryptanalysis attacks. However, the two most common
techniques are:
Ciphertext-Only Attack
The would-be attacker only has access to at least one encrypted message but does not know the
plaintext data, any cryptographic key data used, or the encryption algorithm being employed.
Intelligence agencies often face this challenge when they've intercepted encrypted
communications from a target. However, this is a formidable attack to pull off, thanks to the lack of
target data.
Known Plaintext Attack
This attack is easier to implement, compared to the ciphertext-only attack. With a known plaintext
attack, the analyst most likely has access to some or all the ciphertext’s plaintext. The
cryptanalyst's goal is to discover the key the target uses to encrypt the message and use the key to
decrypt the message. Once the key is discovered, the attacker can decrypt every message
encrypted with that specific key. Known plaintext attacks rely on the attacker finding or guessing
all or part of an encrypted message, or alternately, even the original plaintext's format.
And here are some other attack types and techniques cybersecurity experts potentially must
guard against:
Differential Cryptanalysis Attack
This plaintext attack variant targets block ciphers that analyze plaintext in pairs rather than
individually. This approach lets the analyst determine how the algorithm in question works when
it runs into different data types.
Man-in-the-Middle Attack
This attack occurs when the intruder finds a way to insert themselves into an otherwise secure
channel between two parties that want to exchange keys. The cryptanalyst conducts the key
exchange with each end-user, with the latter believing that they’re conducting the exchange with
each other. Thus, the involved parties are none the wiser and are now using a key that the attacker
knows.
Integral Cryptanalysis Attack
The integral cryptanalysis attack is like the differential cryptanalysis attack, but rather than using
pairs of plaintexts, the attack relies on plaintext sets where part of the plaintext remains constant,
and the remainder is modified.
Chosen Plaintext Attack
Analysts using a chosen plaintext attack either already knows the encryption or can use the device
used for encryption. The cryptanalyst can then encrypt the chosen plaintext using the targeted
algorithm to gather information regarding the key.
Side-Channel Attack
Side-channel attacks rely on information obtained from the physical system employed in the
encryption/decryption process. This attack uses data related to the target system's response time
to queries or power usage rather than the plaintext that's slated to be encrypted or the ciphertext
that comes from the encryption process.
Dictionary Attack
Many people typically use passwords consisting either of easily guessed alphanumeric sequences
or actual words. Analysts exploit this habit by encrypting all the words in a dictionary and
checking if a resulting hash matches the encrypted password residing in a SAM file format or
another password file.
Cryptanalysis Tools
Here are just a couple of the many tools used for cryptanalysis:
Cryptol: This tool is an open-source license initially designed to be used by the Nation Security
Agency (NSA), the United States intelligence agency, targeting cryptographic algorithms.
Cryptol allows users to monitor how algorithms operate in programs that specify the ciphers or
algorithms.
CrypTool: CrypTool is another open-source offering that creates elearning programs, plus a
web portal designed to help users learn about cryptographic algorithms and cryptanalysis.
Ganzua: Ganzua is the Spanish term for a skeleton key or lockpick. It’s an open-source, multi-
platform Java-based tool that allows analysts to define almost totally arbitrary cipher and plain
alphabets. In addition, this function will enable users to crack non-English cryptograms.
Forms of Cryptanalysis
Analysts typically boil cryptanalysis down to two primary forms:
Linear cryptanalysis: Linear cryptanalysis is a known plaintext attack that involves discovering
affine approximations to the target cipher’s action. The attacker studies the probabilistic linear
relations, referred to as linear approximations, between plaintext parity bits, the ciphertext,
and the target’s secret key. This attack is one of the most common attacks employed against
block ciphers.
Differential cryptanalysis: This attack is effective against both stream and block ciphers. The
latter case describes a collection of strategies used to track differences across a network of
transformations, spotting instances where the cipher exhibits non-random behavior and
employing these attributes to find the secret cipher key. In a broader sense, differential
cryptanalysis studies how alterations in information intake could impact the resulting
differences in the output.