Cryptography and Network Security
Cryptography and Network Security
UNIT-1
SECURITY
CONCEPTS
Basic Concepts
1. Encryption
2. Authentication
3. Integrity
Now, one problem that a communication system can face is the loss of
integrity of messages being sent from sender to receiver. This means that
Cryptography should ensure that the messages that are received by the
receiver are not altered anywhere on the communication path. This can
be achieved by using the concept of cryptographic hash.
4. Non Repudiation
Types of Cryptography
This type of cryptography technique uses just a single key. The sender
applies a key to encrypt a message while the receiver applies the same
key to decrypt the message. Since only single key is used so we say that
this is a symmetric encryption.
The biggest problem with this technique is the distribution of key as this
algorithm makes use of single key for encryption or decryption.
3. Hash Functions
This technique does not involve any key. Rather it uses a fixed length
hash value that is computed on the basis of the plain text message. Hash
functions are used to check the integrity of the message to ensure that
the message has not be altered,compromised or affected by virus.
The organization must add intrastate services based on the size and
scope of the organization. Organizational growth could lead to the
need for public key infrastructure, PKI an integrated system of the
software, encryption methodologies. The information security
mechanism used by large organizations is complex in comparison to
a small organization. The small organization generally prefers
symmetric key encryption of data.
SECURITY APPROACHES
1. Trusted Systems:
2. Security Models
PRINCIPLES OF SECURITY
Loss of confidentiality
Another user C gets access to this message, which is not desired
andtherefore, defeats the purpose of confidentiality. Example of this could
be a confidential email messagesent by A to B, which is accessed by C
without the permission or knowledge of A and B. This type ofattack is
called as interception.
Interception causes loss of message confidentiality.
2. Authentication
Authentication mechanisms help establish proof of identities. The
authentication process ensures thatthe origin of a electronic message or
document is correctly identified.
suppose that user Csends an electronic document over the Internet to
user B. However, the trouble is that user C had posedas user A when she
sent this document to user B.
A real life example of this could be the case of a user C, posing asuser A,
sending a funds transfer request (from A’s account to C’s account) to bank
B. The bank mighthappily transfer the funds from A’s account to C’s
account – after all, it would think that user A hasrequested for the funds
transfer! This concept is shown in Fig.
Loss of integrity
4. Non-repudiation
There are situations where a user sends a message and later on refuses
that she had sent that message. Forinstance, user A could send a funds
transfer request to bank B over the Internet. After the bank performsthe
funds transfer as per A’s instructions, A could claim that she never sent
the funds transfer instructionto the bank! Thus, A repudiates or denies,
her funds transfer instruction. The principle of non-repudiation defeats
such possibilities of denying something, having done it. This is shown in
Fig.
Attack on availability
TYPES OF SECURITY ATTACKS
We shall classify attacks with respect to two views: the common person’s view
and a technologist’s view.
1. General Attacks:
A General ViewFrom a common person’s point of view, we can classify
attacks into three categories, as shown inFig.
Legal Attacks This form of attack is quite novel and unique. Here, the
attacker tries to make the judgeor the jury doubtful about the security of a
computer system. This works as follows. The attacker attacksthe
computer system and the attacked party (say a bank or an organization)
manages to take the attacker
to the court.
Active attacks
Masquerade is caused when an unauthorized entity pretends to be
another entity. Replay attack, a user captures a sequence of events or
some data units and re- sends them.
Alteration of messages involves some change to the original message.
For instance, suppose user Asends an electronic message Transfer $1000
to D’s account to bank B. User C might capture this andchange it to
Transfer $10000 to C’s account.
Trojan horse
4. Specific Attacks
SECURITY SERVICES
SECURITY MECHANISMS
1. Encipherment :
2. Access Control :
3. Notarization :
4. Data Integrity :
5. Authentication exchange :
6. 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.
7. Digital Signature :
INTRODUCTION:
Cryptographic system
Cryptanalysis
Cryptology is a combination of cryptography and cryptanalysis.
A N N A M A C H A R Y A
D Q Q D P D F K D U B D
Each alphabet in the original message can be replaced by another to
hidethe original contents of the message. The codified message is called
as cipher text. Cipher means a codeor a secret message.
When a plain text message is codified using any suitable scheme, the
resulting message iscalled as cipher text.
SUBSTITUTION TECHNIQUES
1. CAESAR CIPHER
This was first proposed by Julius Caesar and is termed as Caesar
Cipher. Caesar Cipher is a special case of substitution techniques
wherein eachalphabet in a message is replaced by an alphabet three
places down the line. For instance, using theCaesar Cipher, the plain text
ATUL will become cipher text DWXO.
MONO-ALPHABETIC CIPHER
0 1 2 3 4 5 6 7 8 9 10 1 12 13 14 15 16 17 18 19 20 21 22 23 24 25
1
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
samb
a
the Cipher text is : HOSKO
Homophonic Substitution Cipher
For example, ‘a’ can be enciphered as ‘d’ in the starting of the text, but as
‘n’ at the middle. The polyalphabetic ciphers have the benefit of hiding
the letter frequency of the basic language. Therefore attacker cannot use
individual letter frequency static to divide the ciphertext.
Key: samba
Plain text: hello students how are
you Cipher text:
Key s a m B a s a m b a s a m b a s a m b a s A
PT h e l L o s t u d e n t s h o w a r e y o U
CT z e x M o k t g E e f t e i o o a c f y g U
Playfair Cipher:
The Playfair Cipher, also called as Playfair Square, is a cryptographic
technique that is used formanual encryption of data.
The Playfair encryption scheme uses two main processes, as shown in Fig
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.
For example:
PlainText: "instruments"
After Split: 'in' 'st' 'ru' 'me' 'nt' 'sz'
1. Pair cannot be made with same letter. Break the letter in single and
add a bogus letter to the previous letter.
Plain Text: “hello”
After Split: ‘he’ ‘lx’ ‘lo’
Here ‘x’ is the bogus letter.
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 ->
ce-
>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).
Diagraph: "ST"
Encrypted Text:
TL Encryption:
S ->
TT-
>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 ->
rt-
>q
Hill Cipher
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. To encrypt
a message, each block of n letters (considered as an n-component vector)
is multiplied by an invertible n × n matrix, against modulus 26. To
decrypt the
randomly.
Example of simple columnar technique
The general model shows that there are four basic tasks in designing a
particular securityservice:
1. Design an algorithm for performing the security-related
transformation. Thealgorithm 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 securityalgorithm and the secret information to achieve a
particular security service
Every encryption and decryption process has two aspects: the algorithm and the
key used forencryption and decryption.
let us take the example ofa combination lock, which we use in real life. We
need to remember the combination (which is a number, suchas 871)
needed to open up the lock. The facts that it is acombination lock and
how to open it (algorithm) arepieces of public knowledge. However, the
actual valueof the key required for opening a specific lock (key),which is
871 in this case, is kept secret. The idea isillustrated in Fig
The sender andthe receiver will use the same key to lock and unlock, this
is called as symmetric key operation (whenused in the context of
cryptography, this operation is called as symmetric key cryptography).
Person A wants to send a highly confidential letter to another person B. A
and B both residein the same city, but are separated by a few miles and
for some reason, cannot meet eachother.
With the symmetric key cryptography A can send securely to the B.
Let us now imagine that not only A and B but also thousands of people
want to send such confidentialletters securely to each other. What would
happen if they decide to go for symmetric key operation? Ifwe examine
this approach more closely, we can see that it has one big drawback if the
number of peoplethat want to avail of its services is very large.
Use of separate locks and keys per
Therefore, can we see that, in general, for n persons, the number of lock-
and-key 𝑛∗(𝑛−1)
2
pairs is
Brute forceattack
With every incremental bit, the attacker has to perform double the
number of operations ascompared to the previous key size. It is found that
for a 56-bit key,
We can represent the possible values in the key range using hexadecimal
notation and see visuallyhow an increase in the key size increases the key
range and therefore, the complexity for an attacker.
Known plain text attack: In this case, the attacker knows about some
pairs of plain text andcorresponding cipher text for those pairs. Using this
information, the attacker tries to find otherpairs and therefore, know more
and more of the plain text. Examples of such known plain texts
arecompany banners, file headers, etc. which are found commonly in all
the documents of a particularcompany.
Chosen plain text attack: Here, the attacker selects a plain text block
and tries to look for theencryption of the same in the cipher text. Here,
the attacker is able to choose the messages toencrypt. Based on this, the
attacker intentionally
Chosen cipher text attack: In the chosen cipher text attack, the
attacker knows the cipher text tobe decrypted, the encryption algorithm
that was used to produce this cipher text and thecorresponding plain text
block. The attacker’s job is to discover the key used for encryption.
A stream cipher is one that encrypts a digital data stream one bit or one
byte at a time.
In the ideal case, a one-time pad version of the Vernam cipher wouldbe
used, in which the keystream (Ki) is as long as the plaintext bit stream (P i).
If the cryptographic keystream is random, then this cipher is unbreakable
by anymeans other than acquiring the keystream.
The logic of a general substitution cipher for A 4-bit input produces one of
16 possible input states, which is mapped by thesubstitution cipher into a
unique one of 16 possible output states, each of which isrepresented by 4
ciphertext bits.
1. Number of Rounds
2. Design of Function F
3. Key Schedule Algorithm
1. Number of Rounds
The number of rounds judges the strength of the block cipher algorithm. It
is considered that more is the number of rounds, difficult is for
cryptanalysis to break the algorithm.
2. Design of Function F
The function F of the block cipher must be designed such that it must be
impossible for any cryptanalysis to unscramble the substitution. The
criterion that strengthens the function F is it non-linearity.
More the function F is nonlinear, more it would be difficult to crack it. Well,
while designing the function F it should be confirmed that it has a good
avalanche property which states that a change in one-bit of input must
reflect the change in many bits of output.
It is suggested that the key schedule should confirm the strict avalanche
effect and bit independence criterion.
Since DES is based on the Feistel Cipher, all that is required to specify DES is −
Round function
Key schedule
Any additional processing − Initial and final permutation
Initial and Final Permutation
The initial and final permutations are straight Permutation boxes (P-boxes)
that are inverses of each other. They have no cryptography significance in
DES. The initial and final permutations are shown as follows −
The heart of this cipher is the DES function, f. The DES function applies a
48- bit key to the rightmost 32 bits to produce a 32-bit output.
Expansion Permutation Box −Since right input is 32-bit and round key
is a 48- bit, we first need to expand right input to 48 bits. Permutation
logic is graphically depicted in the following illustration
There are a total of eight S-box tables. The output of all eight s-boxes
is then combined in to 32 bit section.
Key Generation
The round-key generator creates sixteen 48-bit keys out of a 56-bit cipher
key. The process of key generation is depicted in the following illustration
AES does not use a Feistel structure. Instead, each full round consists
offour separate functions: byte substitution, permutation, arithmetic
operations over a finite field, and XOR with a key.
General Structure
Figure shows the overall structure of the AES encryption process. The
cipher takes a plaintext block size of 128 bits, or 16 bytes. The key length
can be 16, 24, or 32bytes (128, 192, or 256 bits). The algorithm is referred
to as AES-128, AES-192, orAES-256, depending on the key length.
Operation of AES
Interestingly, AES performs all its computations on bytes rather than bits.
Hence, AES treats the 128 bits of a plaintext block as 16 bytes. These 16
bytes are arranged in four columns and four rows for processing as a
matrix −
Unlike DES, the number of rounds in AES is variable and depends on the
length of the key. AES uses 10 rounds for 128-bit keys, 12 rounds for 192-
bit keys and 14 rounds for 256-bit keys. Each of these rounds uses a
different 128-bit round key, which is calculated from the original AES key.
Encryption Process
Shiftrows
Each of the four rows of the matrix is shifted to the left. Any entries that
‘fall off’ are re-inserted on the right side of row. Shift is carried out as
follows −
[ c0 ] [ 2 3 1 1 ] [ b0 ]
| c1 | = | 1 2 3 1 || b1 |
| c2 | | 1 1 2 3 || b2 |
[ c3 ] [ 3 1 1 2 ][ b3 ]
The 16 bytes of the matrix are now considered as 128 bits and are XORed
to the 128 bits of the round key. If this is the last round then the output is
the ciphertext. Otherwise, the resulting 128 bits are interpreted as 16
bytes and we begin another similar round.
Decryption Process
BLOWFISH ALGORITHM
Blowfish is an encryption technique designed by Bruce Schneier in 1993
as an alternative to DES Encryption Technique. It is significantly faster
than DES and provides a good encryption rate with no effective
cryptanalysis technique found to date. It is one of the first, secure block
cyphers not subject to any patents and hence freely available for anyone
to use.
1. blockSize: 64-bits
2. keySize: 32-bits to 448-bits variable size
3. number of subkeys: 18 [P-array]
4. number of rounds: 16
5. number of substitution boxes: 4 [each having 512 entries of 32-bits each]
Step3: Encryption:
A block cipher processes the data blocks of fixed size. Usually, the size of
a message is larger than the block size. Hence, the long message is
divided into a series of sequential message blocks, and the cipher
operates on these blocks one at a time.
Operation
The user takes the first block of plaintext and encrypts it with the
key to produce the first block of ciphertext.
He then takes the second block of plaintext and follows the same
process with same key and so on so forth.
In reality, any application data usually have partial information which can
be guessed. For example, the range of salary can be guessed. A
ciphertext from ECB can allow an attacker to guess the plaintext by trial-
and-error if the plaintext message is within predictable.
Operation
The operation of CBC mode is depicted in the following illustration. The steps
are as follows −
It is worth mentioning that CBC mode forms the basis for a well-known
data origin authentication mechanism. Thus, it has an advantage for those
applications that require both symmetric encryption and data origin
authentication.
In this mode, each ciphertext block gets ‘fed back’ into the encryption process
in order to encrypt the next plaintext block.
Operation
CFB has a very strange feature. In this mode, user decrypts the ciphertext
using only the encryption process of the block cipher. The decryption
algorithm of the underlying block cipher is never used.
It involves feeding the successive output blocks from the underlying block
cipher back to it. These feedback blocks provide string of bits to feed the
encryption algorithm which act as the key-stream generator as in case of
CFB mode.
The key stream generated is XOR-ed with the plaintext blocks. The OFB
mode requires an IV as the initial random n-bit input block. The IV need
not be secret.
Operation
Both encryption and decryption in CTR mode are depicted in the following
illustration. Steps in operation are −
Load the initial counter value in the top register is the same for both
the sender and the receiver. It plays the same role as the IV in CFB
(and CBC) mode.
Encrypt the contents of the counter with the key and place the
result in the bottom register.
STREAM CIPHERS
RC4
RC4 is a stream cipher designed in 1987 by Ron Rivest for RSA Security. It
is a variable key size stream cipher with byte-oriented operations. The
algorithm is based onthe use of a random permutation. Analysis shows
that the period of the cipher is overwhelmingly likely to be greater than
10100. Eight to sixteen machine operations are required per output byte,
and the cipher can be expected to run veryquickly in software. RC4 is used
in the Secure Sockets Layer/Transport Layer Security(SSL/TLS) standards
that have been defined for communication between Webbrowsers and
servers.
Initialization of S
To begin, the entries are set equal to the values from 0 through 255 in
ascendingorder; that is, S[0],S[1],S[2], S[255]=255.
Stream Generation
Once the S vector is initialized, the input key is no longer used. Stream
generationinvolves cycling through all the elements of S[i] , and for each
S[i], swapping S[i] withanother byte in S according to a scheme dictated
by the current configuration of S.After S[255]is reached, the process
continues, starting over again at S[0].
/* Stream Generation
*/ i, j = 0;
while (true)
i = (i + 1) mod 256;
j = (j + S[i]) mod
256; Swap (S[i],
S[j]);
t = (S[i] + S[j]) mod
256; k = S[t];
The most powerful and most common approach to securing the points of
vulnerability highlighted in the preceding section is encryption. If
encryption is to be used to counter these attacks, then we need to decide
what to encrypt and
The second problem that Diffie pondered, and one that was
apparentlyunrelated to the first, was that of digital signatures.
A public key encryption scheme has the following ingredients which are as follows
1. Each user generates a pair of keys to be used for the encryption and
decryption of messages.
2. Each user places one of the two keys in a public register or other
accessible file. This is the public key.The companion key is kept private.
As in Figure suggests, each user maintains a collection of public keys
obtained from others.
4. When Alice receives the message, she decrypts it using her private key.
No other recipient can decrypt the message because only Alice knows
Alice’sprivate key.
The computation of the pair of keys i.e. private key and the public
key must be easy.
Knowing the encryption algorithm and public key of the intended
receiver, computation of cipher text must be easy.
For a receiver of the message, it should be computationally easy to
decrypt the obtained cipher text using his private key.
It is also required that any opponent in the network knowing the
public key should be unable to determine its corresponding private
key.
Having the cipher text and public key an opponent should be
unable to determine the original message.
RSA ALGORITHM
In this algorithm two keys were used. One is private key and another one
is public key.
1. Key generation
2. Encryption
3. Decryption
The more frequently session keys are exchanged, the more secure they
are, becausethe opponent has less ciphertext to work with for any given
session key. On theother hand, the distribution of session keys delays the
start of any exchange andplaces a burden on network capacity. A security
manager must try to balance thesecompeting considerations in
determining the lifetime of a particular session key.
The use of a key distribution center imposes the requirement that the KDC
be trusted and be protected from subversion. This requirement can be
avoided if keydistribution is fully decentralized. Although full
decentralization is not practical forlarger networks using symmetric
encryption only, it may be useful within a localcontext.
1. Public announcement
2. Publicly available directory
3. Public-key authority
4. Public-key certificates.
AUTHENTICATION REQUIREMENTS
MessageEncryption
Messageencryptionbyitselfcanprovideameasureofauthentication.Thea
naly sis differsforsymmetricandpublic-keyencryptionschemes.
Nbsftfbupbutboeepftfbupbutboemjuumfmbnctfbuj
plaintext:
mareseatoatsanddoeseatoatsandlittlelambseati
vy
Asimplefrequencyanalysisconfirmsthatthismessagehastheprofileofo
rdin ary English. On the other hand, if an opponent generates the
following random sequence ofletters:
zuvrsoevgqxlzwigamdvnmhpmccxiuureosfbcebtqx
ytuqrndufpwkyvhfzlcumlgolbbwhttqdnreabdaspwr
wp
NotethattheorderinwhichtheFCSandencryptionfunctionsareperform
ed is critical. With internal error control, authentication is
provided because an
opponentwouldhavedifficultygeneratingciphertextthat,whendecrypt
ed,w ould have valid error control bits. If instead the FCS is the
outer code, an opponent can construct messages with valid error-
control codes. Although the opponent
cannot
knowwhatthedecryptedplaintextwillbe,heorshecanstillhopetocreate
confu
- sion and disruptoperations.
Toprovideauthentication,Ausesitsprivatekeytoencryptthemessage,a
ndB usesA’spublickeytodecrypt.
Thisprovidesauthenticationusingthe
sametypeofreasoningasinthesymmetricencryptioncase:Themessag
emusth
Cryptography and Network Security, Dept. of IT SVCET 89
ave
comefromAbecauseAistheonlypartythatpossessesPRaandthereforet
heonl y party with the information necessary to construct
ciphertext that can be
decrypted
withPUa.Again,thesamereasoningasbeforeapplies:Theremustbesom
einter nal structure to the plaintext so that the receiver can
distinguish between well-formed plaintext and randombits.
Assumingthereissuchstructure,thentheschemeofFigure12.1cdoespr
ovide authentication. It also provides what is known as digital
The sender uses some publicly known MAC algorithm, inputs the
message and the secret key K and produces a MAC value.
Similar to hash, MAC function also compresses an arbitrary long
input into a fixed length output. The major difference between hash
and MAC is that MAC uses secret key during the compression.
The sender forwards the message along with the MAC. Here, we
assume that the message is sent in the clear, as we are concerned
of providing message origin authentication, not confidentiality. If
confidentiality is required then the message needs encryption.
On receipt of the message and the MAC, the receiver feeds the
received message and the shared secret key K into the MAC
algorithm and re- computes the MAC value.
The receiver now checks equality of freshly computed MAC with the
MAC received from the sender. If they match, then the receiver
accepts the message and assures himself that the message has
been sent by the intended sender.
If the computed MAC does not match the MAC sent by the sender,
the receiver cannot determine whether it is the message that has
been altered or it is the origin that has been falsified. As a bottom-
line, a receiver safely assumes that the message is not the genuine.
Limitations of MAC
There are two major limitations of MAC, both due to its symmetric nature of
operation −
Both these limitations can be overcome by using the public key based
digital signatures discussed in following section.
HASH FUNCTIONS
Pre-Image Resistance
o This property means that it should be computationally hard to
reverse a hash function.
o In other words, if a hash function h produced a hash value z, then it
should be a difficult process to find any input value x that hashes
to z.
o This property protects against an attacker who only has a hash
value and is trying to find the input.
Second Pre-Image Resistance
o This property means given an input and its hash, it should be hard
to find a different input with the same hash.
o In other words, if a hash function h for an input x produces hash
value h(x), then it should be difficult to find any other input value y
such that h(y) = h(x).
o This property of hash function protects against an attacker who has
an input value and its hash, and wants to substitute different value
as legitimate value in place of original input value.
Collision Resistance
o This property means it should be hard to find two different inputs
of any length that result in the same hash. This property is also
referred to as collision free hash function.
The size of each data block varies depending on the algorithm. Typically
the block sizes are from 128 bits to 512 bits. The following illustration
demonstrates hash function −
This process is repeated for as many rounds as are required to hash the
entire message. Schematic of hashing algorithm is depicted in the
following illustration
−
Since, the hash value of first message block becomes an input to the
second hash operation, output of which alters the result of the third
operation, and so on. This effect, known as an avalanche effect of
hashing.
Hashing algorithm is a process for using the hash function, specifying how
the message will be broken up and how the results from previous
message blocks are chained together.
SHA-2: A family of two similar hash functions, with different block sizes,
known as SHA-256 and SHA-512. They differ in the word size; SHA-256
uses 32-bit words where SHA-512 uses 64-bit words. There are also
truncated versions of each standard, known as SHA-224, SHA-384, SHA-
512/224 and SHA-512/256. These were also designed by the NSA.
SHA 2 is SHA 1’s upgraded algorithm. SHA 3 is SHA 2’s upgraded algorithm.
The encryption key input for each iteration is the intermediate hash value
from the previous iteration; the plaintext is the current message block;
and the feed forward value is the bitwise XOR of the current message
block and the intermediate hash value from the previous iteration.
HMAC
A hash function such as SHA was not designed for use as a MAC and
cannot be used directly for that purpose because it does not rely on a
secret key. There have been a number of proposals for the incorporation
of a secret key into an existing hash algorithm. The approach that has
received the most support is HMAC. HMAC has been issued as RFC 2104,
has been chosen as the mandatory- to-implement MAC for IP security, and
is used in other Internet protocols, such as SSL.
The first two objectives are important to the acceptability of HMAC. HMAC
treats the hash function as a "black box." This has two benefits. First, an
existing implementation of a hash function can be used as a module in
implementing HMAC. In this way, the bulk of the HMAC code is
prepackaged and ready to use without modification. Second, if it is ever
desired to replace a given hash function in an HMAC implementation, all
that is required is to remove the existing hash function module and drop
in the new module. This could be done if a faster hash function were
desired.
The last design objective in the preceding list is, in fact, the main
advantage of HMAC over other proposed hash-based schemes. HMAC can
be proven secure provided that the embedded hash function has some
reasonable cryptographic strength.
HMAC Algorithm
M]] In words,
The XOR with ipad results in flipping one-half of the bits of K. Similarly, the
XOR with opad results in flipping one-half of the bits of K, but a different
set of bits. In effect, by passing Si and So through the compression
function of the hash algorithm, we have pseudorandomly generated two
keys from K.
CMAC
The Data Authentication Algorithm defined in FIPS PUB 113, also known as
the CBC-MAC (cipher block chaining message authentication code). This
cipher-based MAC has been widely adopted in government and
industry.MAC is secure under a reasonable set of security criteria, with the
following restriction.
If the message is not an integer multiple of the cipher block length, then
the final block is padded to the right (least significant bits) with a 1 and as
many 0s as necessary so that the final block is also of length b. The CMAC
operation then precedes as before, except that a different n-bit key K2 is
used instead of K1.The two n-bit keys are derived from the k-bit
encryption key as follows:
L = E (K, 0n)
K1 = L · x
K2 = L · x2 = (L · x) · x
where multiplication (·) is done in the finite field (2n) and x and x2 are first
and second order polynomials that are elements of GF(2n) Thus the binary
representation of x consists of n - 2 zeros followed by 10; the binary
representation of x2 consists of n - 3 zeros followed by 100. The finite field
is defined with respect to an irreducible polynomial that is
lexicographically first among all such polynomials with the minimum
possible number of nonzero terms. For the two approved block sizes, the
polynomials are and x64 x4 x3 x 1 and x128 x7 x2 x 1. To generate K1 and
K2 the block cipher is applied to the block that consists entirely of 0 bits.
DIGITAL SIGNATURE
Properties
It must verify the author and the date and time of the signature.
It must authenticate the contents at the time of the signature.
It must be verifiable by third parties, to resolve disputes.
HereA denotes the user whose signature method is being attacked, and C
denotes theattacker.
non-negligible probability:
The term direct digital signature refers to a digital signature scheme that
involvesonly the communicating parties (source, destination). It is
assumed that the destination knows the public key of the source.
The validity of the scheme just described depends on the security of the
sender’s private key. If a sender later wishes to deny sending a particular
message, the sender can claim that the private key was lost or stolen and
that someone else forged his or her signature.
KNAPSACK ALGORITHM
Knapsack Encryption Algorithm is the first general public key
cryptography algorithm. It is developed by Ralph Merkle and Mertin
Hellman in 1978. As it is a Public key cryptography, it needs two different
keys. One is Public key which is used for Encryption process and the other
one is Private key which is used for Decryption process. In this algorithm
we will use two different knapsack problems in which one is easy and
other one is hard. The easy knapsack is used as the private key and the
hard knapsack is used as the public key. The easy knapsack is used to
derived the hard knapsack.
Example –
Step-1:
Choose a super increasing knapsack {1, 2, 4, 10, 20, 40} as the private key.
Step-2:
Choose two numbers n and m. Multiply all the values of private key
by the number n and then find modulo m. The value of m must be
greater than the sum of all values in private key, for example 110.
And the number n should have no common factor with m, for
example 31.
1x31 mod(110) = 31
2x31 mod(110) = 62
4x31 mod(110) = 14
10x31 mod(110) = 90
20x31 mod(110) = 70
40x31 mod(110) = 30
Thus, our public key is {31, 62, 14, 90, 70, 30}
And Private key is {1, 2, 4, 10, 20, 40}.
Example –
Lets our plain text is 100100111100101110.
1. Encryption :
As our knapsacks contain six values, so we will split our plain text in a
groups of six:
Multiply each values of public key with the corresponding values of each
group and take their sum.
2. Decryption :
The receiver receive the cipher text which has to be decrypt. The
receiver also know as the values of m and n.
So, first we need to find the n-1 , which is multiplicative inverse of n mod m i.e.,
Gcd of 110 & 31 is By Euclidean algorithm
110=3(31)+17 1 = 3- 1(2)
Cryptography and Network 31 =1(17) + 14 1 = 5(3) -1(14)
ity, Dept. of CSE, 107
Secur 17 = 1(14) + 3 1 = 11(14) – 9(17)
14 = 4(3) + 2 1 = 11(17) – 6(31)
3 = 1(2) + 1 1 = 71(31) – 20 (110)
n x n-1mod(m) =
1 31 xn-
1
mod(110) = 1
n-1 = 71
Now, we have to multiply 71 with each block of cipher text take modulo m.
121 x 71 mod(110) = 11
Then, we will have to make the sum of 11 from the values of private key
{1, 2, 4, 10, 20, 40} i.e.,
1+10=11 so make that corresponding bits 1 and others 0 which is
100100. Similarly,
197 x 71 mod(110) = 17
1+2+4+10=17 = 111100
characters.
PGP Message Generation:
IP SECURITY OVERVIEW
IP security (IPsec) is a capability that can be added to either current
version of the Internet Protocol (IPv4 or IPv6) by means of additional
headers. IPsec encompasses three functional areas: authentication,
confidentiality, and key management.
In 1994, the Internet Architecture Board (IAB) issued a report titled
“Security inthe Internet Architecture”
To provide security, the IAB included authentication and encryption as
necessary security features in the next-generation IP, which has been
issued as
Benefits of IPsec
Some of the benefits of IPsec:
When IPsec is implemented in a firewall or router, it provides strong
security that can be applied to all traffic crossing the perimeter.
Traffic within a company or workgroup does not incur the overhead
of security- related processing.
IPsec in a firewall is resistant to bypass if all traffic from the outside
must useIP and the firewall is the only means of entrance from the
Internet into theorganization.
IPsec is below the transport layer (TCP, UDP) and so is
transparent toapplications.
IPsec can be transparent to end users.
IPsec can provide security for individual users if needed.
Routing Applications
Router advertisement (a new router advertises its presence) comes
from anauthorized router.
A neighbor advertisement (a router seeks to establish or maintain a
neighbour relationship with a router in another routing domain)
comes from an authorized router.
A redirect message comes from the router to which the initial IP
packet was sent.
A routing update is not forged.
IPsec Services
IPsec provides security services at the IP layer by enabling a system to
select required security protocols, determine the algorithm(s) to use for
the service(s), and put in place any cryptographic keys required to provide
the requested services.
Access control
Connectionless integrity
Data origin authentication
Rejection of replayed packets (a form of partial sequence integrity)
Confidentiality (encryption)
Limited traffic flow confidentiality
IP SECURITY ARCHITECTURE
Confidentiality
Authentication
Integrity
Packet Format:
AUTHENTICATION HEADER
Transport mode
Tunnel mode
AH format
The AH format is described in RFC 2402. The below shows the position of
the Authentication Header fields in the IP packet.
Next header
It is an 8-bit field which identifies the type of what follows. The value of
this field is chosen from the set of IP header protocol fields, which is set to
51, and the value that would have gone in the protocol field goes in the
AH next header field.
Payload length
It is reserved for future use. Its length is 16 bits and it is set to zero.
It is 32 bits in length.
Sequence number
Authentication data
ESP Format
Figure 19.5a shows the top-level format of an ESP packet. It contains the
followingfields.
Padding
Figure 19.7 shows two ways in which the IPsec ESP service can be used. In
the upperpart of the figure, encryption (and optionally authentication) is
provided directly between two hosts. Figure 19.7b shows how tunnel
mode operation can be used to set up a virtual private network.
Case 4. This provides support for a remote host that uses the Internet to
reach anorganization’s firewall and then to gain access to some server or
workstation behindthe firewall.
KEY MANAGEMENT
• Flags (8 bits): Indicates specific options set for this IKE exchange.
Three bits are defined so far. The initiator bit indicates whether this
packet is sent by the SA initiator. The version bit indicates whether the
transmitter is capable of using a higher major version number than the
one currently indicated. The response bit indicates whether this is a
response to a message containing the same message ID.
• Length (32 bits): Length of total message (header plus all payloads) in octets
The SSL Record Protocol provides two services for SSL connections:
Version Number
The TLS Record Format is the same as that of the SSL Record Format For
the current version of TLS, the major version is 3 and the minor version is
3.
There are two differences between the SSLv3 and TLS MAC schemes:
the actualalgorithm and the scope of the MAC calculation. TLS makes
use of the
Pseudorandom Function
Alert Codes
TLS supports all of the alert codes defined in SSLv3 with the exception of
no_certificate. A number of additional codes are defined in TLS; of these,
the following are always fatal.
Account
INTRUDER
INTRUSION DETECTION
Intrusions might occur from the outside or from within your network
structure (an employee, customer, or business partner). Some intrusions
are just aimed to alert you that an intruder has entered your site and is
defacing it with various messages or obscene graphics. Others are more
malevolent, attempting to harvest sensitive data on a one-time basis or as
part of a long-term parasitic connection that will continue to siphon data
until it is identified.
Some intruders will try to implant code that has been carefully developed.
Others will infiltrate the network, stealthily siphoning out data on a regular
basis or altering public-facing Web sites with varied messages.
PASSWORD MANAGEMENT
There are many challenges in securing passwords in this digital era. When
the number of web services used by individuals are increasing year-over-
year on one end, the number of cyber crimes is also skyrocketing on the
other end. Here are a few common threats to protecting our passwords:
While hackers are equipped with advanced tools and attacks, individuals
and businesses still rely on traditional methods of password management.
This clearly raises the need for the best password management practices
to curb security threats.
Use strong and unique passwords for all websites and applications
Reset passwords at regular intervals
Configure two-factor authentication for all accounts
Securely share passwords with friends, family, and colleagues
Store all enterprise passwords in one place and enforce secure
password policies within the business environment
Periodically review the violations and take necessary actions.
Malicious Programs
Malicious software can be divided into two categories: those that need a
host program, and those that are independent.
A virus can do anything that other programs do. The only difference is
that it attaches itself to another program and executes secretly when the
host program is run. Once a virus is executing, it can perform any
function, such as erasing files and programs.
During its lifetime, a typical virus goes through the following four phases:
Dormant phase: The virus is idle. The virus will eventually be activated
by some event, such as a date, the presence of another program or file, or
the capacity of the disk exceeding some limit. Not all viruses have this
stage.
Virus Structure
An infected program begins with the virus code and works as follows.
The first line of code is a jump to the main virus program. The second line
is a special marker that is used by the virus to determine whether or not a
potential victim program has already been infected with this virus.
Finally, the virus transfers control to the original program. If the infection
phase of the program is reasonably rapid, a user is unlikely to notice any
difference between the execution of an infected and uninfected program.
1.For each uninfected file P2 that is found, the virus first compresses that
file to produce P'2, which is shorter than the original program by the size
of the virus.
Characteristics of Firewall
Every network security device has its purpose and its way of
implementation. if we use the wrong device for the wrong problem, the
network becomes vulnerable. if the outdated device is used for a
designing firewall, it exposes the network to risk and is almost useless.
Firstly the designing part must be done then the product requirements
must be found out, if the product is already available then it is tried to fit
in a design that makes security weak.
4. Layered Defense
TYPES OF FIREWALL
Types of Firewall:
Packet Filters
These firewalls can examine application layer (of OSI model) information
like an HTTP request. If finds some suspicious application that can be
responsible for harming our network or that is not safe for our network
then it gets blocked right away.
Next-generation Firewalls
These firewalls are called intelligent firewalls. These firewalls can perform
all the tasks that are performed by the other types of firewalls that we
learned previously but on top of that, it includes additional features
like application
Circuit-level gateways
Software Firewall
Hardware Firewall
Cloud Firewall
Halt Hacking
Stops viruses
Cost
Depending on the type of firewall, it can be costly, usually, the
hardware firewalls are more costly than the software ones.
Restricts User
Restricting users can be a disadvantage for large organizations,
because of its tough security mechanism. A firewall can restrict the
employees to do a certain operation even though it’s a necessary
operation.
Issues with the speed of thenetwork
Since the firewalls have to monitor every packet passing through the
network, this can slow down operations needed to be performed, or it
can simply lead to slowing down the network.
Maintenance
Firewalls require continuous updates and maintenance with every
change in the networking technology. As the development of new
viruses is increasing continuously that can damage your system.
Current EPS Architecture EPS is used to transmit payment details from the
payer branch to thepayee branch via the central server in Mumbai. Fig.
10.5 depicts the flow, which is also described step-by-step
On the Payee Leg, the EPS central office will create a Credit Request as
before, sign and encrypt itwith the bank officer’s digital certificate. This
signed-and- encrypted request will be forwarded to thePayee Branch.
VIRTUAL ELECTIONS
Computerized voting wouldbecome quite common in the next few
decades. As such, it is important that the protocol for virtualelections
should protect individual privacy and should also disallow cheating.
Consider the followingprotocol in order that voters can send their votes
electronically to the Election Authority (EA).
1. The EA does not know whether the authorized voters have voted or it
has received fake (bogus)votes.
2. Secondly, there is no mechanism to prevent duplicate voting.
What is the advantage of this protocol? Clearly, no one would be able to
change another voter’s vote,because it is first encrypted with the EA’s
public key and is then sent to the EA. However, if we observethis scheme
carefully, an attacker need not change someone’s vote at all. The attacker
can simply send duplicate votes!
How can we improve upon this protocol to make it more robust? Let us
rewrite it, as follows:
1.Each voter casts the vote and signs it with her private key
2. Each voter then encrypts the signed vote with the public key of the EA.
disallowed.