Unit I (CNS)
Unit I (CNS)
INTRODUCTION
Security trends - Legal, Ethical and Professional Aspects of Security, Need for Security
at Multiple levels, Security Policies - Model of network security – Security attacks,
services and mechanisms – OSI security architecture – Classical encryption techniques:
substitution techniques, transposition techniques, steganography- Foundations of
modern cryptography: perfect security – information theory – product cryptosystem –
cryptanalysis.
1.1 Introduction
Human being from ages had two inherent needs − (a) to communicate and share
information and (b) to communicate selectively. These two needs gave rise to the art
of coding the messages in such a way that only the intended people could have access
to the information. Unauthorized people could not extract any information, even if the
scrambled messages fell in their hand.
The art and science of concealing the messages to introduce secrecy in information
security is recognized as cryptography.
The word ‘cryptography’ was coined by combining two Greek words, ‘Krypto’
meaning hidden and ‘graphene’ meaning writing.
The art of cryptography is considered to be born along with the art of writing. As
civilizations evolved, human beings got organized in tribes, groups, and kingdoms.
This led to the emergence of ideas such as power, battles, supremacy, and politics.
These ideas further fuelled the natural need of people to communicate secretly with
selective recipient which in turn ensured the continuous evolution of cryptography as
well.
The first known evidence of cryptography can be traced to the use of ‘hieroglyph’.
Some 4000 years ago, the Egyptians used to communicate by messages written in
hieroglyph. This code was the secret known only to the scribes who used to transmit
messages on behalf of the kings. One such hieroglyph is shown below.
Later, the scholars moved on to using simple mono-alphabetic substitution ciphers
during 500 to 600 BC. This involved replacing alphabets of message with other
alphabets with some secret rule. This rule became a key to retrieve the message
back from the garbled message.
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.
The Cryptography is 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.
Key: Some critical information used by the cipher, known only to the sender&
receiver.
Encryption (encode): The process of converting plaintext to cipher text using a
cipher and a key.
Decryption (Decode): The process of converting cipher text back into plaintext
using a cipher and a key.
If the sender and receiver use same key then it is said to be symmetric key
(or) single key (or) conventional encryption.
If the sender and receiver use different keys then it is said to be public key
encryption.
A block cipher processes the input and block of elements at a time, producing
output block for each input block.
There are various types of cryptanalytic attacks based on the amount of information
known to the cryptanalyst. They are:
Cipher text only – A copy of cipher text alone is known to the cryptanalyst.
Known plaintext – The cryptanalyst has a copy of the cipher text and the
corresponding plaintext.
Today millions of people perform online transactions every day. There many ways to
attack computer and networks to take advantage of what has made shopping, banking,
transformation of messages, investments and leisure pursuits a simple matter of
dragging and clicking for many people.
Thus, the laws and ethics are important aspects in data and network security. The
legal system has adapted quite well to computer technology by reusing some old
forms of legal protection (copyrights and patents) and creating laws where no
adequate one existed (malicious access).
Still the courts are not a perfect form of protection for computer, for two reasons, first
court tends to be reactive instead of proactive. That is, we have to wait for regression
to occur and then adjudicative it, rather than try to prevent it in first place. Second
fixing a problem through the courts can be time consuming and more expensive.
The latter characteristic prevents all but the wealthy from addressing most wealthy.
On other hand, 1ethics has not had to change , because ethic is more situational and
personal than the law, for example the privacy of personal information becoming
important part of computer network security and although technically this issue is just
an aspect of confidentiality, practically it has a long history in both law and ethics.
Law and security are related in several ways. First international, national, state, city
laws affect privacy, secrecy. These statutes often apply to the rights of individuals to
keep personal matters private. Second law regulates the use of development, and
ownership of data and programs. Patents, copyrights, and trade secrets are legal
devices to protect the right of developers and owners of the information and data.
Computers as targets: To get the information from the computer system or control
the computer system without the authorization or payment or alter the interfaces
or data in the particular system with use of server.
The relative lack of success in bringing cyber-criminals to justice has led to an increase
in their numbers, boldness, and the global scale of their operations. It is difficult to
profile cybercriminals in the way that is often done with other types of repeat offenders.
The success of cybercriminals and the relative lack of success of law enforcement,
influence the behaviour of cybercrime victims. As with law enforcement, many
organizations that may be the target of attack have not invested sufficiently in technical,
physical, and human-factor resources to prevent attacks.
The law is used regulate people for their own good and for the greater good of society.
Cryptography also regulated activity.
Some Example laws that are forced on cryptography.
o Cryptography and Free speech: The Cryptography involve not just products, it
involves ideas too, although governments effectively control the flow of
products across borders, controlling the floe ideas either head or on the internet,
is also impossible.
o There are three main types of intellectual property for which legal protection is
available.
1) Copy rights: Copyright law protects the tangible or fixed expression of an
idea, not the idea itself. Copy right properties exists when proposed work is
original and creator has put original idea in concrete form and the copyright
owner has these exclusive rights, protected against infringement such as
reproduction right, modification right, distribution right
Plant (discovers and asexually reproduces any distinct and new variety
ofplant).
Privacy Law and Regulation: An issue with considerable overlap with computer
security is that of privacy. Concerns about the extent to which personal privacy has
been and may be compromised have led to a variety of legal and technical approaches
to reinforcing privacy rights. A number of international organizations and national
governments have introduced laws and regulations intended to protect individual
privacy.
European Union Data Protection Directive was adopted in 1998 to ensure member
states protect fundamental privacy rights when processing personal info and prevent
member states from restricting the free flow of personal info within EU organized
around principles of notice, consent, consistency, access, security, onward transfer
and enforcement. US Privacy Law have Privacy Act of 1974 which permits
individuals to determine records kept, forbid records being used for other purposes,
obtain access to records, ensures agencies properly collect, maintain, and use personal
info and creates a private right of action for individuals.
Cryptography and Ethics.
There are many potential misuses and abuses of information and electronic
communication that create privacy and security problems. Ethics refers to a system of
moral principles that relates to the benefits and harms of particular actions. An ethic
an objectively defined standard of right and wrong. Ethical standards are often
idealistic principles because they focus on one objective. Even though religious group
and professional organization promote certain standards of ethical behaviour,
ultimately each person is responsible for deciding what do in a specific situation.
Computers have become the primary repository of both personal information and
negotiable assets, such as bank records, securities records, and other financial
information.
o Producers of new forms and types of assets: For example, computer programs
are entirely new types of assets, possibly not subject to the same concepts of
ownership as other assets.
Following are some pointers which help in setting u protocols for the security policy of an
organization.
User policies
IT policies.
User policies generally define the limit of the users towards the computer resources in
a workplace. For example, what are they allowed to install in their computer, if they
can use removable storages?
Whereas, IT policies are designed for IT department, to secure the procedures and functions
of IT fields.
General Policies − This is the policy which defines the rights of the staff and access
level to the systems. Generally, it is included even in the communication protocol as
a preventive measure in case there are any disasters.
Server Policies − This defines who should have access to the specific server and with
what rights. Which software’s should be installed, level of access to internet, how
they should be updated?
Firewall Access and Configuration Policies − It defines who should have access to
the firewall and what type of access, like monitoring, rules change. Which ports and
services should be allowed and if it should be inbound or outbound?
Backup Policies − It defines who is the responsible person for backup, what should
be the backup, where it should be backed up, how long it should be kept and the
frequency of the backup.
VPN Policies − These policies generally go with the firewall policy; it defines those
users who should have a VPN access and with what rights. For site-to-site
connections with partners, it defines the access level of the partner to your network,
type of encryption to be set.
When you compile a security policy you should have in mind a basic structure in order to
make something practical. Some of the main points which have to be taken into
consideration are:
Functions and responsibilities of the employees that are affected by this policy.
Types of Policies
Acceptance User Policy − This policy regulates the behavior of the users towards a
system or network or even a webpage, so it is explicitly said what a user can do and
cannot in a system. Like are they allowed to share access codes, can they share
resources, etc.
User Account Policy − This policy defines what a user should do in order to have or
maintain another user in a specific system. For example, accessing an e-commerce
webpage. To create this policy, you should answer some questions such as −
Remote Access Policy − This policy is mainly for big companies where the user and
their branches are outside their headquarters. It tells what should the users access,
when they can work and on which software like SSH, VPN, RDP.
Network Policy − This policy is to restrict the access of anyone towards the network
resource and make clear who all will access the network. It will also ensure whether
that person should be authenticated or not. This policy also includes other aspects
like, who will authorize the new devices that will be connected with network. The
documentation of network changes. Web filters and the levels of access. Who should
have wireless connection and the type of authentication, validity of connection
session?
Email Usage Policy − This is one of the most important policies that should be done
because many users use the work email for personal purposes as well. As a result
information can leak outside. Some of the key points of this policy are the employees
should know the importance of this system that they have the privilege to use. They
should not open any attachments that look suspicious. Private and confidential data
should not be sent via any encrypted email.
Software Security Policy − This policy has to do with the software’s installed in the
user computer and what they should have. Some of the key points of this policy are
Software of the company should not be given to third parties. Only the white list of
software’s should be allowed, no other software’s should be installed in the
computer. Warez and pirated software’s should not be allowed.
The two parties, who are the principals in this transaction, must cooperate for each
other to the exchange the message. When the transfer of data happened from one
source to another source some logical information channel is established between
them 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.
It is necessary to protect the information from various types of attackers, who may
launch a threat to confidentiality, authenticity, DoS and so on. All the technique
providing some security components:
Some of the secret information shared by the two parties. So, it is hoped,
unknown to the attacker.
Connectionless Confidentiality
Selective-Field Confidentiality
Data 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.
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.
Connectionless Integrity
Nonrepudiation
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
Nonrepudiation, Destination
Example: Imagine a user of online banking who has made a transaction, but later denied that.
How the bank can protect itself in a such situation?
Availability Service
An availability service is one that protects a system to ensure its availability.
This service addresses the security concerns raised by denial-of-service attacks. It
depends on proper management and control of system resources and thus depends on
access control service and other security services.
Security Mechanisms
Security mechanisms are technical tools and techniques that are used to
implement security services.
Threat
Attack
An assault 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.
Single key is used for both encryption and decryption. A symmetric encryption
scheme has five ingredients
Plaintext: This is the original intelligible message or data that is fed into the
algorithm as input.
Encryption algorithm: The encryption algorithm performs various substitutions 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.
Ciphertext: This is the scrambled message produced as output. It depends on the
plaintext and the secret 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
Cryptanalysis
Brute-Force Attack
The attacker tries every possible key on a piece of ciphertext until an intelligible
translation into plaintext is obtained. On average, half of all possible keys must be
tried to achieve success.
There are two basic building blocks of all encryption techniques:
Substitution
Transposition
Substitution Techniques
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 cipher text bit patterns.
Caesar cipher (or) shift cipher
The earliest known use of a substitution cipher and the simplest was by Julius Caesar.
The Caesar cipher involves replacing each letter of the alphabet with the letter
standing 3 places further down the alphabet. The plaintext will be written in
lowercase, ciphertext will be written in uppercase. Let as assign a numerical
equivalent to each letter.
Where a= 0, z = 25
Example
Plaintext: Pay more money
Ciphertext: SDB PRUH PRQHB
The general Caesar algorithm is,
Example
Let k = 3
C = E (3, P)
C = (P+3) mod 26
Encryption
Plaintext = cat
Let K = 3, C= 2
C = 2+ 3
C= 5
C=F
Next letter, a= 0
C = 0 +3
C=D
Next, t = 19
So, C = w
Ciphertext = FDW
Now, Decryption is just reverse process of Encryption
Drawbacks
Bruteforce cryptanalysis can be easily performed by trying all the 25 possible keys.
The language of the plaintext was english.
Monoalphabetic Ciphers
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 5x5 matrix of letters
constructed using a keyword. The technique encrypts pairs of letters instead of single
letters.
Example
Key: Monarchy
Plaintext: instruments
2. Algorithm to encrypt the plain text: The plaintext is split into pairs of two letters
(digraphs). If there is an odd number of letters, a Z is added to the last letter.
PlainText: "instruments"
After Split: 'in' 'st' 'ru' 'me' 'nt' 'sz'
Rules for Encryption:
If both the letters are in the same column: Take the letter below each one (going
back to the top if at the bottom).
For example:
Diagraph: "me"
Encrypted Text: cl
Encryption:
m -> c
e -> l
If both the letters are in the same row: Take the letter to the right of each one (going back
to the leftmost if at the rightmost position).
For example:
Diagraph: "st"
Encrypted Text: tl
Encryption:
s -> t
t -> l
If neither of the above rules is true: Form a rectangle with the two letters and take the
letters on the horizontal opposite corner of the rectangle.
For example:
Diagraph: "nt"
Encrypted Text: rq
Encryption:
n -> r
t -> q
For example:
Plain Text: "instrumentsz"
Encrypted Text: gatlmzclrqtx
Encryption:
i -> g
n -> a
s -> t
t -> l
r -> m
u -> z
m -> c
e -> l
n -> r
t -> q
s -> t
z -> x
Decryption
Plain Text: "gatlmzclrqtx"
Decrypted Text: instrumentsz
Decryption:
(red)-> (green)
ga -> in
tl -> st
mz -> ru
cl -> me
rq -> nt
tx -> sz
Advantages
Play fair cipher is a great advance over simple mono alphabetic ciphers.
Since there are 26 letters, 26 X 26 = 676 diagrams are possible, so identificaion of
individual diagram is more difficult.
Frequency analysis is much more difficult.
Hill Cipher
It is developed by the mathematician Lester Hill in 1929. Hill cipher is a polygraphic
substitution cipher based on linear algebra.Each letter is represented by a number
modulo 26. Often the simple scheme A = 0, B = 1, …, Z = 25 is used, but this is not
an essential feature of the cipher.
The matrix used for encryption is the cipher key, and it should be chosen randomly
from the set of invertible n × n matrices (modulo 26).
C = KP mod 26
Example
Input : Plaintext: ACT
Key: GYBNQKURP
Output : Ciphertext: POH
Encryption
We have to encrypt the message ‘ACT’ (n=3).The key is ‘GYBNQKURP’ which can be
written as the nxn matrix:
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:
Advantages
Encryption method is completely unbreakable.
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 second message.
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.
Example:
Input: Plaintext: GEEKSFORGEEKS
Keyword: AYUSH
Output: Cipher text: GCYCZFMLYLEIM
For generating key, the given keyword is repeated in a circular manner until it matches the
length of the plain text.
The keyword "AYUSH" generates the key "AYUSHAYUSHAYU"
The plain text is then encrypted using the process explained below.
Encryption
The first letter of the plaintext, G is paired with A, the first letter of the key. So use
row G and column A of the Vigenère square, namely G. Similarly, for the second
letter of the plaintext, the second letter of the key is used, the letter at row E and
column Y is C. The rest of the plaintext is enciphered in a similar fashion.
Table to encrypt Geeks
Decryption
Decryption is performed by going to the row in the table corresponding to the key,
finding the position of the ciphertext letter in this row, and then using the column’s
label as the plaintext.
For example, in row A (from AYUSH), the ciphertext G appears in column G, which
is the first plaintext letter. Next we go to row Y (from AYUSH), locate the ciphertext
C which is found in column E, thus E is the second plaintext letter.
A more easy implementation could be to visualize Vigenère algebraically by
converting [A-Z] into numbers [0–25].
Encryption
The plaintext(P) and key(K) are added modulo 26.
Ei = (Pi + Ki) mod 26
Decryption
Di = (Ei - Ki + 26) mod 26
Transposition Techniques
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.
transposition technique rearranges the characters to form a ciphertext
Rail fence
It is simplest of such cipher, in which the plaintext is written down as sequence of
diagonals and then read off as a sequence of rows.
The rail fence cipher offers essentially no communication security, and it will be
shown that it can be easily broken even by hand.
Example
The key for the railfence cipher is just the number of rails. To encrypt a piece of text, e.g.
defend the east wall of the castle
Example
Encryption
Input : Geeks for Geeks
Key = HACK
Output : e kefGsGsrekoe_
Decryption
Input : e kefGsGsrekoe_
Key = HACK
Output : Geeks for Geeks
Encryption
In a transposition cipher, the order of the alphabets is re-arranged to obtain the cipher-text.
1. The message is written out in rows of a fixed length, and then read out again column
by column, and the columns are chosen in some scrambled order.
2. Width of the rows and the permutation of the columns are usually defined by a
keyword.
3. For example, the word HACK is of length 4 (so the rows are of length 4), and the
permutation is defined by the alphabetical order of the letters in the keyword. In this
case, the order would be “3 1 2 4”.
4. Any spare spaces are filled with nulls or left blank or placed by a character
5. Finally, the message is read off in columns, in the order specified by the keyword.
Steganography
Steganography is data hidden within data. Steganography is an encryption technique
that can be used along with cryptography as an extra-secure method in which to
protect data. At any rate, steganography protects from pirating copyrighted materials
as well as aiding in unauthorized viewing.
How is it different from cryptography?
Cryptography and steganography are both methods used to hide or protect secret data.
However, they differ in the respect that cryptography makes the data unreadable, or
hides the meaning of the data, while steganography hides the existence of the data.
In layman’s terms, cryptography is similar to writing a letter in a secret language:
people can read it, but won’t understand what it means. However, the existence of a
(probably secret) message would be obvious to anyone who sees the letter, and if
someone either knows or figures out your secret language, then your message can
easily be read.
If you were to use steganography in the same situation, you would hide the letter
inside a pair of socks that you would be gifting the intended recipient of the letter. To
those who don’t know about the message, it would look like there was nothing more
to your gift than the socks. But the intended recipient knows what to look for, and
finds the message hidden in them.
Similarly, if two users exchanged media files over the internet, it would be more
difficult to determine whether these files contain hidden messages, than if they were
communicating using cryptography.
Image Steganography
As the name suggests, Image Steganography refers to the process of hiding data
within an image file. The image selected for this purpose is called the cover-
image and the image obtained after steganography is called the stego-image.
Working Principle
An image is represented as an N*M (in case of greyscale images) or N*M*3 (in case
of colour images) matrix in memory, with each entry representing the intensity value
of a pixel.
In image steganography, a message is embedded into an image by altering the values
of some pixels, which are chosen by an encryption algorithm. The recipient of the
image must be aware of the same algorithm in order to known which pixels he or she
must select to extract the message.
Figure 1.17 Steganography
Detection of the message within the cover-image is done by the process
of steganalysis.
This can be done through comparison with the cover image, histogram plotting, or by
noise detection. While efforts are being invested in developing new algorithms with a
greater degree of immunity against such attacks, efforts are also being devoted
towards improving existing algorithms for steganalysis, to detect exchange of secret
information between terrorists or criminal elements.
1.8 Foundations of modern cryptography
There are four major characteristics that separate modern cryptography from the classical
approach.
Context of Cryptography
Cryptography
Cryptanalysis
Cryptography
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.
Cryptanalysis
The art and science of breaking the cipher text is known as cryptanalysis.
Cryptanalysis is the sister branch of cryptography and they both co-exist. The
cryptographic process results in the cipher text for transmission or storage. It
involves the study of cryptographic mechanism with the intention to break them.
Cryptanalysis is also used during the design of the new cryptographic techniques to
test their security strengths.
Cryptography primitives are nothing but the tools and techniques in Cryptography
that can be selectively used to provide a set of desired security services −
Encryption
Hash functions
Digital Signatures
The following table shows the primitives that can achieve a particular security service on
their own.
1.8.1 Perfect Security
Perfect Secrecy (or information-theoretic secure) means that the ciphertext conveys
no information about the content of the plaintext. ... However, part of being
provably secure is that you need as much key material as you have plaintext to
encrypt.
Its impact has been crucial to the success of the Voyager missions to deep space, the
invention of the compact disc, the feasibility of mobile phones, the development of
the Internet, the study of linguistics and of human perception, the understanding
of black holes, and numerous other fields.
The theory has also found applications in other areas, including statistical
inference, natural language processing, cryptography, neurobiology, human vision,
the evolution and function of molecular codes (bioinformatics), model selection in
statistics, thermal physics, quantum computing, linguistics, plagiarism detection,
pattern recognition, and anomaly detection.
Important sub-fields of information theory include source coding, algorithmic
complexity theory, algorithmic information theory, information-theoretic
security, Grey system theory and measures of information.
Product Cryptosystems
The combination could yield a cipher system more powerful than either one alone.
This approach of alternatively applying substitution and permutation transformation
has been used by IBM in the Lucifer cipher system, and has become the standard for
national data encryption standards such as the Data Encryption Standard and
the Advanced Encryption Standard.
A product cipher that uses only substitutions and permutations is called a SP-
network. Feistel ciphers are an important class of product ciphers.
1.10 Cryptanalysis
Cryptanalysis is the art of trying to decrypt the encrypted messages without the use of
the key that was used to encrypt the messages. Cryptanalysis uses mathematical
analysis & algorithms to decipher the ciphers.
The success of cryptanalysis attacks depends
Brute force attack– this type of attack uses algorithms that try to guess all the
possible logical combinations of the plaintext 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. It is mostly used when trying to crack encrypted
passwords.
Rainbow table attack– this type of attack compares the cipher text against pre-
computed hashes to find matches.