You are on page 1of 18

MODULE 1: INTRODUCTION - NUMBER THEORY AND BASIC

CRYPTOGRAPHY

Security goals
There are the major goals of information security which are as follows −
Confidentiality − The goals of confidentiality is that only the sender and the predetermined
recipient should be adequate to approach the element of a message. Confidentiality have negotiate
if an unauthorized person is capable to create the message.
Integrity − When the element of a message are transformed after the sender sends it, but since it
reaches the intended recipient, and it can said that the principle of the message is lost.
Availability − The main goals of information security is availability. It is that resources must be
available to authorized parties at all times.

Security attacks

Active attacks: An Active attack attempts to alter system resources or affect their operations.
Active attacks involve some modification of the data stream or the creation of false statements.
Types of active attacks are as follows:
 Masquerade
 Modification of messages
 Repudiation
 Replay
 Denial of Service

Masquerade –
A masquerade attack takes place when one entity pretends to be a different entity. A Masquerade
attack involves one of the other forms of active attacks.
Masquerade assaults may be performed using the stolen passwords and logins, with the aid of
using finding gaps in programs, or with the aid of using locating a manner across the
authentication

Modification of messages –

It means that some portion of a message is altered or that message is delayed or reordered to
produce an unauthorized effect. Modification is an attack on the integrity of the original data.

Non-Repudiation –

This attack occurs when the network is not completely secured or the login control has been
tampered with. With this attack, the author’s information can be changed by actions of a
malicious user in order to save false data in log files, up to the general manipulation of data on
behalf of others, similar to the spoofing of e-mail messages.

Replay –

It involves the passive capture of a message and its subsequent transmission to produce an
authorized effect. In this attack, the basic aim of the attacker is to save a copy of the data
originally present on that particular network and later on use this data for personal uses. Once
the data is corrupted or leaked it is insecure and unsafe for the users.

Denial of Service –

It prevents the normal use of communication facilities. This attack may have a specific target.
For example, an entity may suppress all messages directed to a particular destination. 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.
Passive attacks:

A Passive attack attempts to learn or make use of information from the system but does not
affect system resources. Passive Attacks are in the nature of eavesdropping on or monitoring
transmission. The goal of the opponent is to obtain information that is being transmitted. Types
of Passive attacks are as follows:
 The release of message content
 Traffic analysis

The release of message content –

Telephonic conversation, an electronic mail message, or a transferred file may contain sensitive
or confidential information. We would like to prevent an opponent from learning the contents of
these transmissions.

Traffic analysis –

Suppose that we had a way of masking (encryption) information, so that the attacker even if
captured the message could not extract any information from the message.
The opponent could determine the location and identity of communicating host 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.
The most useful protection against traffic analysis is encryption of SIP traffic. To do this, an
attacker would have to access the SIP proxy (or its call log) to determine who made the call.
DIFFERENCE BETWEEN ACTIVE AND PASSIVE ATTACK

On the basis Active attack Passive attack


of

Definition In active attacks, the attacker In passive attacks, the attacker observes
intercepts the connection and efforts the messages, then copy and save them
to modify the message's content. and can use it for malicious purposes.

Modification In an active attack, the attacker In passive attacks, information remains


modifies the actual information. unchanged.

Victim In active attacks, the victim gets Unlike active attacks, in passive attacks,
notified about the attack. victims do not get informed about the
attack.

System's The damage done with active attacks The passive attacks do not harm the
impact can be harmful to the system and its system.
resources.

System In active attacks, the system In passive attacks, the system resources
resources resources can be changed. remain unchanged.

Dangerous They are dangerous for the integrity They can be dangerous for confidentiality
for and availability of the message. of the message.

Emphasis on In active attacks, attention is on In active attacks, attention is on


detection. prevention.

Types Active attacks involve Masquerade, It involves traffic analysis, the release of
Modification of message, a message.
Repudiation, Replay, and Denial of
service.

Prevention Active attacks are tough to restrict Unlike active attacks, passive attacks are
from entering systems or networks. easy to prohibit.
Types of Security Mechanism :

Types of Security Mechanism are :


Encipherment :
This security mechanism deals with hiding and covering of data which helps data to become
confidential. It is achieved by applying mathematical calculations or algorithms which
reconstruct information into not readable form. It is achieved by two famous techniques
named Cryptography and Encipherment. Level of data encryption is dependent on the
algorithm used for encipherment.

Access Control :
This mechanism is used to stop unattended access to data which you are sending. It can be
achieved by various techniques such as applying passwords, using firewall, or just by
adding PIN to data.

Notarization :
This security mechanism involves use of trusted third party in communication. It acts as
mediator between sender and receiver so that if any chance of conflict is reduced. This
mediator keeps record of requests made by sender to receiver for later denied.

Data Integrity :
This security mechanism is used by appending value to data to which is created by data
itself. It is similar to sending packet of information known to both sending and receiving
parties and checked before and after data is received. When this packet or data which is
appended is checked and is the same while sending and receiving data integrity is
maintained.

Authentication exchange :
This security mechanism deals with identity to be known in communication. This is
achieved at the TCP/IP layer where two-way handshaking mechanism is used to ensure
data is sent or not
Bit stuffing :
This security mechanism is used to add some extra bits into data which is being
transmitted. It helps data to be checked at the receiving end and is achieved by Even parity
or Odd Parity.

Digital Signature :
This security mechanism is achieved by adding digital data that is not visible to eyes. It is
form of electronic signature which is added by sender which is checked by receiver
electronically. This mechanism is used to preserve data which is not more confidential but
sender’s identity is to be notified.

Security services

The classification of security services are as follows:

1. Confidentiality: Ensures that the information in a computer system and transmitted information
are accessible only for reading by authorized parties. E.g. printing, displaying and other forms of
disclosure.
2. Authentication: Ensures that the origin of a message or electronic document is correctly
identified, with an assurance that the identity is not false.
3. 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.
4. Non repudiation: Requires that neither the sender nor the receiver of a message be able to deny
the transmission.
5. Access control: Requires that access to information resources may be controlled by or the target
system.
6. Availability: Requires that computer system assets be available to authorized parties when needed

Euclidean Algorithm for Greatest Common Divisor


Pseudo Code of the Algorithm-
Step 1: Let a, b be the two numbers
Step 2: a mod b = R
Step 3: Let a = b and b = R
Step 4: Repeat Steps 2 and 3 until a mod b is greater than 0
Step 5: GCD = b
Step 6: Finish
Example:

Cryptography
Cryptography is technique of securing information and communications through use of codes so
that only those person for whom the information is intended can understand it and process it.
Thus preventing unauthorized access to information. The prefix “crypt” means “hidden” and
suffix graphy means “writing”
Types of Cryptography

1. Symmetric Key Cryptography


2. Asymmetric Key Cryptography

Symmetric Key Cryptography

Symmetric key cryptography is also called Private key Cryptography. In this approach, both the
sender and receiver will use the same key for encrypting and decrypting the message.

This means, In Symmetric Key Cryptography Sender will encrypt the data with a secret key. Then
the receiver will use the same key to decrypt the received data. AES, DES, RC4, RC5, and RC6 are
examples of symmetric key Cryptography
Asymmetric Key Cryptography

Asymmetric Key Cryptography is called as Public-key cryptography. In this approach, Receiver


will use Private Key to Decrypt and Sender will use Public Key Encrypt.

So, when you send some data with Asymmetric Key cryptography to Joe, you will Encrypt the
data with a public key which can be opened only by You with the Private Key Not even the Public
Key. This method is considered more secure than the Symmetric Key Cryptography. Some most
used Asymmetric Key Cryptography is Elliptic curve techniques, RSA, DSA, PKCS.

Features of Cryptography are as follows:


1. Confidentiality: Information can only be accessed by the person for whom it is intended and
no other person except him can access it.
2. Integrity: Information cannot be modified in storage or transition between sender and
intended receiver without any addition to information being detected.
3. Non-repudiation: The creator/sender of information cannot deny his intention to send
information at later stage.
4. Authentication: The identities of sender and receiver are confirmed. As well as
destination/origin of information is confirmed.

Applications of Cryptography:
1. Computer passwords
2. Digital Currencies
3. Secure web browsing
4. Electronic Signatures
5. Authentication
6. Cryptocurrencies
7. End-to-end encryption
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.

Substitution Technique:

1. Caesar Cipher
2. Monoalphabetic Cipher
3. Playfair Cipher
4. Polyalphabetic Cipher
5. One-Time Pad
6. Hill Cipher

1) 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.
Example:
Plain Text: meet me tomorrow
Cipher Text: phhw ph wrpruurz

2) Mono-Alphabetic Substitution Cipher


A mono-alphabetic cipher (aka simple substitution cipher) is a substitution cipher where each
letter of the plain text is replaced with another letter of the alphabet. It uses a fixed key which
consist of the 26 letters of a “shuffled alphabet”.

Example:
Plain text: Sun rises in east

Cipher text: yghiklbfjkwqam

3 ) Playfair Cipher
Playfair cipher is a substitution cipher which involves a 5X5 matrix

Plain Text: meet me tomorrow

Key: KEYWORD

Step 1: Create a 5X5 matrix and place the key in that matrix row-wise from left to right. Then put
the remaining alphabet in the blank space.

Note: If a key has duplicate alphabets, then fill those alphabets only once in the matrix, and I & J
should be kept together in the matrix even though they occur in the given key.
Step 2: Now, you have to break the plain text into a pair of alphabets.

Plain Text: meet me tomorrow

Pair: me et me to mo rx ro wz

Note

 Pair of alphabets must not contain the same letter. In case, pair has the same letter then break it
and add ‘x’ to the previous letter. Like in our example letter ‘rr’ occurs in pair so, we have broken
that pair and added ‘x’ to the first ‘r’.
 In case while making pair, the last pair has only one alphabet left then we add ‘z’ to that alphabet
to form a pair as in our above example, we have added ‘z’ to ‘w’ because ‘w’ was left alone at last.
 If a pair has ‘xx’ then we break it and add ‘z’ to the first ‘x’, i.e. ‘xz’ and ‘x_’.

Step 3: In this step, we will convert plain text into ciphertext. For that, take the first pair of plain
text and check for cipher alphabets for the corresponding in the matrix. To find cipher alphabets
follow the rules below.
Note

 If both the alphabets of the pair occur in the same row replace them with the alphabet to
their immediate right. If an alphabet of the pair occurs at extreme right then replace it with the
first element of that row, i.e. the last element of the row in the matrix circularly follows the first
element of the same row.
 If the alphabets in the pair occur in the same column, then replace them with the
alphabet immediate below them. Here also, the last element of the column circularly follows the
first element of the same column.
 If the alphabets in the pair are neither in the same column and nor in the same row, then the
alphabet is replaced by the element in its own row and the corresponding column of the other
alphabet of the pair.
 Pair: me et me to mo rx ro wz

 Cipher Text: kn ku kn kz ks ta kc yo

4) POLYALPHABETIC CIPHER
Vigenère cipher

When the vigenere table is given, the encryption and decryption are done using the vigenere table
(26 * 26 matrix) in this method.
How this Cipher Works

1. Pick a keyword (for our example, the keyword will be "MEC").

2. Write your keyword across the top of the text you want to encipher, repeating it as many
times as necessary.

3. For each letter, look at the letter of the keyword above it (if it was 'M', then you would go
to the row that starts with an 'M'), and find that row in the Vigenere table.

4. Then find the column of your plaintext letter (for example, 'w', so the twenty-third column).

5. Finally, trace down that column until you reach the row you found before and write down
the letter in the cell where they intersect (in this case, you find an 'I' there).

Example:

Keyword: M E C M E C M E C M E C M E C M E C M E C M
Plaintext: w e n e e d m o r e s u p p l i e s f a s t
Ciphertext: I I P Q I F Y S T Q W W B T N U I U R E U F

5) One-time pad (OTP),


One-time pad (OTP), also called Vernam-cipher or the perfect cipher, is a crypto algorithm where
plaintext is combined with a random key. It is the only existing mathematically unbreakable
encryption.

One-time pads have been used by Special Operations teams and resistance groups during WW2,
popular with intelligence agencies and their spies throughout the Cold War and beyond, and protect
diplomatic and military message traffic around the world for many decades.

 The key is at least as long as the message or data that must be encrypted.
 The key is truly random (not generated by a simple computer function or such)
 Key and plaintext are calculated modulo 10 (digits), modulo 26 (letters) or modulo 2
(binary)
 Each key is used only once, and both sender and receiver must destroy their key after use.
 There should only be two copies of the key: one for the sender and one for the receiver
(some exceptions exist for multiple receivers).

Hill Cipher
hill cipher is a polygraphic substitution cipher based on Linear Algebra. It was invented by Lester
S. Hill in the year 1929. In simple words, it is a cryptography algorithm used to encrypt and decrypt
data for the purpose of data security.
In hill cipher algorithm every letter (A-Z) is represented by a number moduli 26. Usually, the
simple substitution scheme is used where A = 0, B = 1, C = 2…Z = 25 in order to use 2x2 key
matrix.

Encryption
To encrypt the text using hill cipher, we need to perform the following operation.

1. E(K, P) = (K * P) mod 26

Where K is the key matrix and P is plain text in vector form. Matrix multiplication of K and P
generates the encrypted ciphertext.

Steps For Encryption

Step 1: Let's say our key text (2x2) is DCDF. Convert this key using a substitution scheme into a
2x2 key matrix as shown below:

Step 2: Now, we will convert our plain text into vector form. Since the key matrix is 2x2, the
vector must be 2x1 for matrix multiplication. (Suppose the key matrix is 3x3, a vector will be a
3x1 matrix.)

In our case, plain text is TEXT that is four letters long word; thus we can put in a 2x1 vector and
then substitute as:

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

Transposition Techniques

1. Rail-Fence Technique ( keyless transposition technique )


Rail-Fence is the simple Transposition technique that involves writing plain text as a sequence of

diagonals and then reading it row by row to produce the ciphertext.

Algorithm

Step 1: Write down all the characters of plain text message in a sequence of diagnosis.

Step 2: Read the plain text written in step 1 as a sequence of rows.

Example: Suppose plain text corporate bridge, and we want to create the ciphertext of the given.

First, we arrange the plain text in a sequence of diagnosis, as shown below.

To understand it in a better manner, let’s take an example.

Now read the plain text by row-wise, i.e. croaerdeoprtbig.

Columnar Transposition Techniques


How does this algorithm work?
Step 1: Write all the characters of plain text message row by row in a rectangle of predefined size.

Step 2: Read the message in a columnar manner, i.e. column by column.

Note: For reading the message, it needs not to be in the order of columns. It can happen in any

random sequence.

Step 3: The resultant message is ciphertext.

Example: Let’s assume that Plain text is a corporate bridge, and we need to calculate the cipher

text using a simple columnar transposition technique.

Let’s take 6 columns and arrange Lthe plain text in a row-wise manner.

Decide the
Column 1 Column 2 Column 3 Column 4 Column 5 Column 6
column order

c o r p o r for reading

the message
a t e b r i
– let’s

assume

1,3,5,2,4,6 is
d g e an order.

Now read the message in a columnar manner using the decided order. – cadreeorotgpbri

cadreeorotgpbri is a ciphertext.

You might also like