Crypto PDF
Crypto PDF
2.Attacks
Security attack: Any action that compromises the security of information
owned by an organisation/system/entity
ii.Traf c Analysis is monitoring and analysing the nature of the data being
transmitted between communicating devices . The attacker analyses the
pattern , frequency and length of the messages , the location and identity of
hosts to deduce vital information related to the nature of data being
transferred.This attack is subtle because the attacker cannot learn the data/
messages as the data is encrypted. Passive attacks are very dif cult to
detect, because they do not involve any alteration of the data. Neither the
sender nor receiver is aware that a third party has read the messages or
observed the traf c pattern. However, it is feasible to prevent the success of
these attacks, usually by means of data encryption.
iii. Modi cation of messages simply means that some portion of a legitimate
message is altered, or that messages are delayed or reordered, to produce
an unauthorized effect
3.Security services
A service that is provided by a protocol layer of communicating open systems
that ensures adequate security of the systems or of data transfers. Security
service is a processing or communication service that is provided by a system
to give a speci c kind of protection to system resources; security services
implement security policies and are implemented by security mechanisms.
fi
fi
fi
fi
fi
Services are of 5 categories , each category having some services , together
forming 14 services
2.Access Control
The service for prevention of unauthorized use of a resource (i.e., this service
controls who can have access to a resource, under what conditions access
can occur, and what those accessing the resource are allowed to do).
4.Data Integrity:
Data integrity is the assurance that data received is exactly as sent by an
authorized entity. It ensures that the data has not been modi ed, inserted,
deleted, or replayed during transmission.
iv.Connectionless Integrity:
fl
fi
fi
fl
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
Connectionless integrity provides for the integrity of a single connectionless
data block. It aims to detect any data modi cation and, to a limited extent,
may include replay detection, which involves identifying whether the data
block has been retransmitted or replayed.
i.Non-repudiation, Origin:
De nition: This aspect provides proof that a message was indeed sent by
the speci ed party. It ensures that the sender cannot later deny having
originated the message.
Example: When a user digitally signs an email, the recipient has proof that
the sender is indeed the party who claimed to send the message. This
prevents the sender from later denying their involvement in the
communication.
ii.Non-repudiation, Destination:
De nition: This aspect provides proof that a message was received by the
speci ed party. It ensures that the recipient cannot later deny having received
the message.
Example: When a sender receives a delivery receipt for an email, it serves
as proof that the intended recipient received the message. This prevents the
recipient from later denying that they received the communication.
4.Security Mechanisms
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
Modular Exponentiation
6.2 Euclidean Algorithm
1.Cryptography 2.Steganography
i.Symmetric-Key Encipherment:
In symmetric-key encryption, a single key is used for both encryption and
decryption. This means that the same key is applied to both the plaintext
(original data) and the ciphertext (encrypted data). It's called "symmetric"
because the encryption and decryption keys are identical or can be easily
derived from each other.
ii.Asymmetric-Key Encipherment:
Asymmetric-key encryption involves the use of a pair of keys – a public key
and a private key. The public key is used for encryption, while the private key
is used for decryption. The keys are mathematically related, but it is
computationally infeasible to derive one key from the other.
iii.Hashing:
Hashing is a one-way process that transforms input data (or message) into a
xed-size string of characters, which is typically a hash value or hash code.
Hash functions are designed to be fast and deterministic, meaning the same
input will always produce the same hash output, but it is computationally
infeasible to reverse the process.
i.Null ciphers : involve hiding information within a larger body of text by using
speci c patterns or arrangements of characters.Common examples include
creating a mundane text, where every nth word, or even letter, is part of the
secret message.
iii.Invisible ink:
A number of substances can be used for writing but leave no visible trace
until heat or some chemical is applied to the paper.
iv.Pin punctures:
Small pin punctures on selected letters are ordinarily not visible unless the
paper is held in front of the light.
2.Sender and receiver must have obtained copies of the secret key in a
secure fashion and must keep the key secure. If someone can discover the
key and knows the algorithm, all communication using this key is readable.
If the key is generated at the message source, then it must also be provided
to the destination by means of some secure channel. Alternatively, a third
party could generate the key and securely deliver it to both source and
destination.
With the message X and the encryption key K as input, the encryption
algorithm forms the ciphertext Y = [Y1, Y2, c , YN].
We can write this as
Y = E(K, X).
This notation indicates that Y is produced by using encryption algorithm E as
a function of the plaintext X, with the speci c function determined by the value
of the key K.
The intended receiver, in possession of the key, is able to invert the
transformation:
X = D(K, Y)
Using the secret key and the encryption algorithm all encrypted data is
readable to the attacker , Therefore , the secret key must be kept and
transmitted to the recipient securely
fi
fi
7.2 Mono-alphabatic and polyalphabatic Substitution Techniques
Monoalphabetic Substitution:
In a monoalphabetic substitution cipher, each letter in the plaintext is replaced
with a single, xed corresponding letter in the ciphertext. The substitution
remains constant throughout the entire message.
Polyalphabetic Substitution:
polyalphabetic substitution ciphers use multiple substitution alphabets to
encode the message. The choice of which alphabet to use for each letter is
typically determined by a key.
Once diagrams are generated , they can be encrypted into cipher texts
The Playfair algorithm is based on the use of a 5 * 5 matrix of letters
constructed using a keyword (any word acting as a key here , based on which
the 5 * 5 matrix will be constructed)
fi
fi
Rules of Constructing a 5 * 5 matrix
Eg: If keyword(key) is MONARCHY
1.Initial rows from left to right are lled using the keyword
If any letter repeats in the keyword , it is lled only once
3.if both are in different rows and columns , select that rectangle
Replace that letter by the letter at the end of the row in that rectangle
Eg: diagrams sz and tu will be replaced by tx and lz
In the Vigenère cipher, the key is a keyword or phrase, and each letter of the
key corresponds to a shift value. The shifts are applied to the plaintext letters,
creating a series of Caesar ciphers.
Eg: d has caesar value 3 because starting from a(0) , b(1) , c(2) , d is at the
3rd index , 3+22 = 25 , 25mod26 = 25 = Z
We can express the Vigenère cipher in the following manner. Assume a
sequence of plaintext letters P = p0, p1, p2, c , pn - 1 and a key consisting of
the sequence of letters K = k0, k1, k2, c , km - 1, where typically m 6 n. The
sequence of ciphertext letters C = C0, C1, C2, c , Cn - 1 is calculated as
follows:
(pm + k0) mod 26, (pm + 1 + k1) mod 26, c , (p2m - 1 + km - 1) mod 26, c
Thus, the rst letter of the key is added to the rst letter of the plaintext, mod
26, the second letters are added, and so on through the rst m letters of the
plaintext. For the next m letters of the plaintext, the key letters are repeated.
This process continues until all of the plaintext sequence is encrypted. A
general equation of the
encryption process is
Compare this with Equation (3.1) for the Caesar cipher. In essence, each
plain- text character is encrypted with a different Caesar cipher, depending on
the corresponding key character. Similarly, decryption is a generalization of
Equation (3.2):
Therefore , at the sender , for Encryption using Hill cipher , a square matrix
acting as key is taken , a nxn sq matrix can encrypt n plaintext letters , and
Det K and Adj K is needed to calculate K-1 , once K-1 , is calculated the P is
obtained easily as
(Sum in NoteBk)
8. Transposition Ciphers
A very different kind of mapping is achiattackerd by performing some sort of
permutation on the plaintext letters. This technique is referred to as a
transposition cipher. Transposition ciphers are a type of cryptographic
algorithm that involves rearranging the positions of characters in the plaintext
without changing the actual characters themselves. Unlike substitution
ciphers, where each character is replaced by another, transposition ciphers
focus on the reordering or permutation of the characters.
8.2KeylessTransposition Ciphers
Chapter 3. Cryptographic Hash Functions
The input message M can be of any length, from a few bits to several
gigabytes.
The hash value h is typically of xed length, such as 128 bits, 256 bits, or 512
bits, depending on the speci c hash function being used.It plays a crucial role
in ensuring data integrity, verifying data authenticity, and providing non-
repudiation.
Hash functions used for security applications are called cryptographic hash
functions.
These hash functions must satisfy additional security properties beyond those
of regular hash functions.
Security Applications
—> They are essential for ensuring the integrity and authenticity of digital
information in a wide range of scenarios, including communication protocols,
le systems, and databases.
2.Deterministic: For the same input message, the hash function should
always produce the same hash value.
5.Second Pre-image Resistance: For any given input message M₁, it should
be computationally infeasible to nd another input message M₂ ≠ M₁ such that
H(M₁) = H(M₂). This property ensures that nding a different input message
with the same hash value as a given message is dif cult.
3. Initialize MD Bu er:
After padding, the message is divided into 512-bit blocks.
MD5 uses four internal bu ers (A, B, C, D), each 32 bits (total 128 bits).
These bu ers are initialized with prede ned constant values.
ff
ff
ff
fi
4. Process Each Block:
Each 512-bit block is further broken down into 16 sub-blocks of 32 bits each
(M[0] to M[15]).
There are four rounds of operations, each using all sub-blocks, the bu ers,
and constant values (T[1] to T[64]).
Within a Round:
Non-linear Functions: Each round uses a di erent non-linear function (F, G,
H, I) on a combination of the bu ers and a sub-block.
Intermediate Hash Updates: The result of the non-linear function is added
with the current value of a speci c bu er, another sub-block value, and a
constant value.
Left Shift: A left circular shift is applied to the resulting value.
Bu er Update: The nal value is added to another bu er, and the result is
stored in the original bu er (e ectively updating it).
Iteration:
These steps are repeated for all 16 sub-blocks within a round, updating each
of the four bu ers.
The four rounds are then applied sequentially to the same 512-bit block with
di erent non-linear functions.
Final Hash:
After processing all message blocks, the nal values of the four bu ers (A, B,
C, D) are combined to create the 128-bit MD5 hash digest.
While each sub-block participates in all four rounds, the speci c operations
change based on the round function.
The calculations within a round ensure that all sub-blocks contribute
indirectly to updates in all four bu ers, leading to a total of 64 operations (16
sub-blocks * 4 rounds).
ff
ff
ff
fi
ff
ff
ff
fi
ff
ff
fi
ff
ff
fi
ff
ff
MD5 is no longer considered cryptographically secure due to known
weaknesses. It should not be used for new security applications
4.SHA-1
SHA-1 (Secure Hash Algorithm 1) is a cryptographic hash function that takes
an input message and produces a xed-size (160-bit) hash value, typically
represented as a 40-character hexadecimal number.
Each operation operates on one W[I] that is chosen using above formula and
at the end go each operation values of the buffers get updated as shown
above , after every 20 operations values of the constant K used and the non-
linear process followed is changed
This technique assumes that two communicating parties, say A and B, share
a common secret key K. When A has a message to send to B, it calculates
the MAC as a function of the message and the key:
MAC = C(K, M)
where
M = input message
C = MAC function
fi
fi
K = shared secret key
MAC = message authentication code
The message plus MAC are transmitted to the intended recipient. The
recipient performs the same calculation on the received message, using the
same secret key, to generate a new MAC. The received MAC is compared to
the calculated MAC (Figure 12.4a). If we assume that only the receiver and
the sender know the identity of the secret key, and if the received MAC
matches the calculated MAC, then
1.The receiver is assured that the message has not been altered. If an
attacker alters the message but does not alter the MAC, then the receiver’s
calculation of the MAC will differ from the received MAC. Because the
attacker is assumed not to know the secret key, the attacker cannot alter the
MAC to correspond to the alterations in the message.
2.The receiver is assured that the message is from the alleged sender.
Because no one else knows the secret key, no one else could prepare a
message with a proper MAC.
3.If the message includes a sequence number (such as is used with HDLC,
X.25, and TCP), then the receiver can be assured of the proper sequence
because an attacker cannot successfully alter the sequence number.
HMAC Algorithm
H = embedded hash function (e.g., MD5, SHA-1, RIPEMD-160)
IV = initial value input to hash function
M = message input to HMAC (including the padding speci ed in the
embedded hash function)
Yi = i th block of M, 0 ... i ... (L - 1)
fi
fi
fi
fi
L = number of blocks in M
b = number of bits in a block (eg 512 in SHA-1 )
n = length of hash code produced by embedded hash function eg 160 bits in
SHA-1
K = secret key; recommended length is >= n; if key length is greater than b,
the key is input to the hash function to produce an n-bit key , if key length is
smaller than b use padding to form K+ of b bits
K+ = K padded with zeros on the left so that the result is b bits in length
ipad = 00110110 (36 in hexadecimal) repeated b/8 times
opad = 01011100 (5C in hexadecimal) repeated b/8 times
HMAC(K, M)
Then HMAC can be expressed as
HMAC(K, M) = H ( (K+ ⊕ opad) } H[(K+ ⊕ ipad) } M] )
We can describe the algorithm as follows.
2.XOR (bitwise exclusive-OR) K+ with ipad to produce the b-bit block Si.
3.Append M to Si.
4.Apply H to the stream generated in step 3. Here IV is the pre-de ned
initialisation value for Hash functions’s buffers (A,B,C,D,E) for SHA-1
5.XOR K+ with opad to produce the b-bit block So.
6.Append the hash result from step 4 to So.
7.Apply H to the stream generated in step 6 and output the result.
Note that the XOR with ipad results in ipping one-half of the bits of K.
Similarly, the XOR with opad results in ipping one-half of the bits of K, using
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.
If the message is not an integer multiple of the cipher block length, then
the nal block is padded to the right (least signi cant bits) with a 1 and as
many 0s as necessary so that the nal block is also of length b. The CMAC
operation then proceeds as before, except that a different b-bit key K2 is used
instead of K1 , see 12.8 Fig
fi
fi
fi
Derivation of L:
The rst step is to encrypt a block of all-zero bits (0b) using the encryption
key K. This produces a ciphertext L.
Derivation of K1 and K2:
K1 is derived by multiplying L by the rst-order polynomial x in the nite eld
GF(2^b).
K2 is derived by multiplying L by the second-order polynomial x^2 in the same
nite eld.
Block Cipher Application:
To generate K1 and K2, the block cipher (e.g., AES) is applied to a block
consisting entirely of zeros.
The resulting ciphertext is used to derive K1 and K2 as described above.
Subkey Generation:
The rst subkey is derived by performing a left shift of one bit on the resulting
ciphertext from the block cipher. Additionally, depending on the block size, a
constant is XORed to the left-shifted ciphertext.
The second subkey is derived in the same manner from the rst subkey.
fi
fi
fi
fi
fi
fi
fi
fi
Ch. 2 Symmetric and Asymmetric key Cryptography and Key
Management
The cryptographic strength of a block cipher derives from three aspects of the
design: the number of rounds, the function F, and the key schedule algorithm.
1.Number of Rounds - The greater the number of rounds, the more dif cult it
is to perform crypt- analysis, even for a relatively weak F. In general, the
criterion should be that the number of rounds is chosen so that known
cryptanalytic efforts require greater effort than a simple brute-force key
search attack. If DES has 16 or more rounds, differential cryptanalysis would
require more effort than a brute-force key search.
3.Key Schedule Algorithm - With any block cipher, the main key is used to
generate one subkey for each round. In general, we would like to select
subkeys to maximize the dif culty of deducing individual subkeys and the
dif culty of working back to the main key.
5.Counter Mode
fi
3.DES - Until the introduction of the Advanced Encryption Standard (AES) in
2001, the Data Encryption Standard (DES) was the most widely used
encryption scheme. The algorithm itself is referred to as the Data Encryption
Algorithm (DEA). For DEA, data are encrypted in 64-bit blocks using a 56-bit
key. The algorithm transforms 64-bit input in a series of steps into a 64-bit
output. The same steps, with the same key, are used to reverse the
encryption.
After
the IP is completed , the 64 bits Plaintext is divided into 2 equal parts Left(L)
and Right Plaintext (R) , which is input given to the rounds
Step 2: 16 Rounds of Encryption , The 64 bit output from IP , is encrypted
with the 48 bit unique sub-key K1 generated by the Round Key Generator , to
output a 64 bit round-1 encrypted cipher text , this output from Round 1 is
given as input to round 2 (consisting of the same operations as performed in
round-1) and a new unique sub-key K2 , so on there are a total of 16 rounds ,
each round having output of preceding round , as the current input and a new
sub-key ,
Step 3: Swap - Once all rounds have been completed , the nal outputted L ,
R are swaped with each other and then passed on to FP step
Round Key Generator - The input to the round key generator is a 64 bit key
K. This key is used to generate 16 unique 48 bits each sub-keys that are
used in the 16 rounds of encryption on plaintext.
This Key K 1st undergoes Key Permutation Choice-1 in which the K is
compressed from 64bits to 56 bits by discarding 8 bits , these 8 bits to be
discarded are prede ned.Generally every 8th indexed bit is discarded.
This 56 bit key thus generated which is K56 is then divided into 2 equal parts
C and D each of 28 bits , Each of C , D undergoes a Left circular Shift(LCS) ,
the number of bits by which left shift is to performed is pre-de ned for each
round . After the LCS , C,D are combined to form 56 bits , and to generate the
unique 48 bit sub-key , it again undergoes Key Permutation Choice-2 wherein
the 56 bit key is compressed to 48 bit key by discarding 8 bits , these 8 bits to
be discarded are prede ned.
Finally the 48 bit sub-key , unique for each round is used for encryption at
each Round.
The Values of C , D are then given as input to next round of sub-key
generation.
This also repeats 16 times to generate 16 Sub-keys.
1.Expansion Permutation
The 32 bits from R block ,1st undergo Expansion Permutation , in which the
32 bits of R are expanded to 48 bits so that I could be XORed with the 48 bit
sub-key K48
3.S-Box Substitution
This box compresses the 48 bits output to 32 bits ,
4.P-Box Permutation
Then it undergoes P-box Permutation which adds more confusion , as it re-
arranges the 32 bit output in a pre-de ned format.
5.XOR 32 bit permuted output with 32bit Left Plaintext block(L) , This
nally forms the encrypted output of a round ,
This is further passed as input to the next round as R
S-Box Substitution -
The S-Box substitution , takes as input the XORed 48 bits from the previous
step and converts it back to 32 bits. To do so , S-Box consists of 8 S-Boxes ,
each s-box can take 6 bits as input and outputs 4 bits each , so 8 S-boxes
take 6x8 = 48 bits as input and outputs 4x8 = 32 bits.
fi
fi
Inside Each S-box taking 6 bits as input , is a pre-de ned Table consisting of
4 rows and 16 columns , together forming 16x4 = 64 bits of values ,
fi
The 6 bit value fed to each S-box , is used as an index into the Table to
determine which 4 bit value placed at each index in the table must be given
as output , as shown above , the 0th and 5th bit of the 6bits input is used to
determine the row numbers , and the 1st to 4th bits are used to determine the
column number , the value at the cell thus found is the 4 bit output
Straight P box Permutation - It takes the 32 bit output from the S-Box
substitution as input , It basically rearranges/reorders/jumbles the input 32 bit
data using a pre-de ned pattern which adds more confusion.
2.Round1-9 : The output from Round-0 is given to Round-1 , which is the 1st
round in the 9 Rounds that follow , In Each round of these 9 rounds following
operations are performed,
i.Substitute bytes: Uses an S-box to perform a byte-by-byte substitution of
the block.
ii. ShiftRows: A simple permutation that performs left circular shift.
iii.MixColumns: A matrix multiplication that makes use of arithmetic over
GF(28) (Galois Field).
iv.AddRoundKey: A simple bitwise XOR of the current block with a portion of
the expanded key.
Key Expansion Schedule - The 128bit key is expanded into an array of key
schedule words . Each word is four bytes, and this key is expanded into 44
words ,
Unique 4 words (128 bits) , will be used for the encryption of PT in each
round , Together there are 10 rounds + one initial round = 11x4 words(128
bits) = 44 key words are used. The key expansion function generates 10+1
round keys, each of which is a distinct 4 * 4 matrix. Each round key serves as
one of the inputs to the AddRoundKey transformation in each round.
Each w consists of 1 word (32 bits) , and 4 such words are used as a key
S-state array S[] - The S-box or S-state array, is an array of 256 bytes from 0
to 255 , storing random byte values ,with elements S[0],S[1], . . . ,S[255]
which are repeatedly permutated. At all times, S contains a permutation of all
8-bit numbers from byte 0 to 255.
For encryption and decryption, a byte k is generated from S by selecting one
of the 256 entries in a systematic fashion , which is then XORed with the
plaintext to generate the ciphertext . As each value of k is generated, the
entries in S are once again permuted.
Key K[] : It is a variable-length key .It can be from 1 to 256 bytes (8 to 2048
bits) and is used to initialize a 256-byte state vector S,
Temporary vector T[] - A temporary vector, T, is used for the initialisation of
S[] .If the length of the key K is 256 bytes, then K is copied to T. Otherwise,
for a key of length of ‘len’ bytes , where ‘len’ < 256 bytes , the rst len
elements of T are copied from K, and then K is repeated as many times as
necessary to ll out T.
Algorithm
1.Key Scheduling Algorithm - In KSA ,initial permutation is performed on
the S[] array . Before initialisation ,the entries of S are set equal to the values
from 0 to 255 in ascending order; that is, S[0] = 0, S[1] = 1, … , S[255] = 255.
Once the S vector is initialized, the input key is no longer used. Stream
generation involves cycling through all the elements of S[i], and for each S[i],
swapping S[i] with another byte in S according to a scheme dictated by the
current con guration of S. After S[255] is reached, the process continues,
starting over again at S[0]
fi
3.Encryption : To encrypt, XOR the value k generated with the next byte of
plaintext. To decrypt, XOR the value k with the next byte of ciphertext.
Session Keys - A KDC creates a secret key for each registered member.
This secret key can be used only between the member and the KDC, not
between two members. If sender needs to communicate secretly with
receiver, she needs a secret key between herself and Receiver. A KDC can
create a session key between Sender and Receiver, using their keys with the
center. The keys of Sender and Receiver are used to authenticate Sender
and Receiver to the center and to each other before the session key is
established. After communication is terminated, the session key is no longer
useful.
A session symmetric key between two parties is used only once.
2.The KDC receives the message and creates what is called a ticket. The
ticket is encrypted using Receiver's key (K). The ticket contains the identities
of Sender and Receiver and the session key (Kab). The ticket with a copy of
the session key is encrypted using S’s secret key and is sent to Sender.
Sender receives the message, decrypts it, and extracts the session key. She
cannot decrypt Receiver's ticket; the ticket is for Receiver, not for Sender.
Note that this message contains a double encryption; the ticket is encrypted,
and the entire message is also encrypted. In the second message, Sender is
actually authenticated to the KDC, because only Sender can open the whole
message using her secret key with KDC.
3.Sender sends the ticket to Receiver. Receiver opens the ticket and knows
that Sender needs to send messages to him using KaB as the session key.
Note that in this mes-sage, Receiver is authenticated to the KDC because
only Receiver can open the ticket.
Because Receiver is authenticated to the KDC, he is also authenticated to
fi
fi
Sender, who trusts the KDC. In the same way, Sender is also authenticated to
Receiver, because Receiver trusts the KDC and the KDC has sent Receiver
the ticket that includes the identity of Sender.
1.Sender sends a message to the KDC that includes her nonce, Ra, her
identity, and Receiver's identity.
2. The KDC sends an encrypted message to Sender that includes Sender's
nonce, Receiver's identity, the session key, and an encrypted ticket for
Receiver. The whole message is encrypted with Sender's key.
3. Sender sends Receiver's ticket to him after it decrypts the message it
received from KDC.
4. Receiver sends his challenge to Sender (Rb), encrypted with the session
key.
5. Sender responds to Receiver's challenge. Note that the response carries
Rb - 1 instead of Rb. If Rb send by Sender matches the Rb with Receiver ,
then both parties have authenticated to be themselves and data transfer can
begin.
Process / Operation
A client process (Sender) can access a process running on the real server
(Receiver) in six steps ,
1.Sender sends request to the AS in plain text using her registered identity.
2.The AS sends a message encrypted with key, Ka-as. Ka-as is not the
sender's password itself; rather, it is derived using an algorithm and the
sender's password during the authentication process with the Authentication
Server (AS).
The message contains two items: a session key, KA-TGS, that is used by
Sender to contact the TGS, and a ticket for the TGS that is encrypted with the
TGS symmetric key, Kas-tgs. Sender does not know Ka-as, but when the
message arrives, sender types her symmetric password. The password and
the appropriate algorithm together create Ka-as if the password is correct.
The password is then immediately removed from the memory; it is not sent to
the network and it does not stay in the terminal. It is used only for a moment
to create Ka-as. The process now uses Ka-as to decrypt the message sent.
Ka-tgs and the ticket are extracted.
3 Sender now sends three items to the TGS. The rst is the ticket received
from the AS. The second is the name of the real server (Receiver), the third is
a timestamp that is encrypted by Ka-tgs. The timestamp prevents a replay by
Attacker.
4 Now, the TGS sends two tickets, each containing the session key between
Sender and Receiver, Ka-b. The ticket for Sender is encrypted with Ka-tgs;
the ticket for Receiver is encrypted with Receiver's key, Ktgs-b. Note that
Attacker cannot extract Ka-b because Attacker does not know Ka-tgs or Ktgs-
b , She cannot replay step 3 because she cannot replace the timestamp with
a new one (she does not know Ka-tgs). even if she is very quick and sends
the step 3 message before the timestamp has expired, she still receives the
same two tickets that she cannot decipher.
https://www.linkedin.com/advice/0/how-do-you-secure-kerberos-tickets-from-
replay#:~:text=Kerberos%20prevents%20replay%20attacks%20using,a%20c
ertain%20margin%20of%20error.
.
.
fi
5.Sender sends Receiver's ticket with the timestamp encrypted by Ka-b.
6 Receiver con rms the receipt by adding 1 to the timestamp. The message
is encrypted with Ka-B and sent to Sender.
.
fi
10.Symmetric key agreement : Symmetric key agreement refers to the
process of two or more parties agreeing on a shared secret key over a public
channel securely. This shared key is then used for encrypting and decrypting
messages between the parties without the need of a KDC.
Sender and Receiver can create a session key between themselves without
using a KDC. This method of session-key creation is referred to as the
symmetric-key agreement and Dif e Hellman is a good method to do so.
Dif e Hellman -
Dif e-Hellman Key Agreement
In the Dif e-Hellman protocol two parties create a symmetric session key
without the need of a KDC. Before establishing a symmetric key, the two
parties need to choose two numbers p and g. The rst number, p, is a large
prime number on the order of 300 decimal digits (1024 bits). The second
number, g, is a generator of order
p - 1 in the group <Zp*, X>. These two (group and generator) do not need to
be con dential. They can be sent through the Internet; they can be public.
The steps are as follows:
1.Sender chooses a large random number x such that 0 < x < p - 1 and
calculates
R1 = gx mod p.
2 Receiver chooses another large random number y such that 0 ≤ y < p - 1
and calculates
R2 = g^y mod p.
3.Sender sends R1, to Receiver. Note that Sender does not send the value of
x; she sends only R1.
4.Receiver sends R2, to Sender. Again, note that Receiver does not send the
value of y, he sends only R2.
5.Sender calculates K = (R2)^x mod p.
6.Receiver also calculates K = (R1)^y mod p.
.
fi
fi
fi
fi
fi
fi
11.Public key Distribution : In asymmetric-key cryptography, people do not
need to know a symmetric shared key.
If Sender wants to send a message to Receiver, she only needs to know
Receiver's public key, which is open to the public and available to everyone. If
Receiver needs to send a message to Sender, he only needs to know
Sender's public key, which is also known to everyone. In public-key
cryptography, each person has two keys , a private key which is con dential
and limited to the person and a public key known to the public. Messages
send by sender to receiver are encrypted using the public key of the receiver
and decrypted by the receiver using her private key.
In public-key cryptography, everyone has access to everyones public key;
public keys are available to the public.
Digital Certi cate : A digital certi cate, also known as an SSL certi cate or
public key certi cate, is a digital document issued by a trusted third party,
known as a Certi cate Authority (CA), that veri es the identity of an entity,
such as a website, server, or individual. Digital certi cates play a crucial role
in ensuring the security and authenticity of online communication and
transactions .
One of the primary purposes of a digital certi cate is to provide the entity's
public key. This key is used for encrypting data that only the corresponding
private key can decrypt, enabling secure communication and data exchange.
11.1 X.509 - X.509 is a standard format for digital certi cates that addresses
the issue of varying certi cate formats introduced by different Certi cate
Authorities (CAs). It provides a structured way to describe certi cates,
ensuring uniformity and compatibility across different systems and
applications
A certi cate has the following elds:
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
1 Version number. This eld de nes the version of X.509 of the certi cate.
The version number started at 0; the current version (third version) is 2.
2.Serial number. This eld de nes a number assigned to each certi cate. The
value is unique for each certi cate issuer.
3.Signature algorithm ID. This eld identi es the algorithm used to sign the
certi cate. Any parameter that is needed for the signature is also de ned in
this eld.
4.Issuer name. This eld identi es the certi cation authority that issued the
certi cate. The name is normally a hierarchy of strings that de nes a country,
a state, organization, department, and so on.
5.Validity Period. This eld de nes the earliest time (not before and the latest
time (not after) the certi cate is valid.
6 Subject name. This eld de nes the entity to which the public key belongs.
It is also a hierarchy of strings. Part of the eld de nes what is called the
common name, which is the actual name of the beholder of the key.
" Subject public kev. This eld de nes the owner's public key, the heart of the
certi cate. The eld also de nes the corresponding public-key algorithm
(RSA, for example) and its parameters.
7.Issuer unique identi er. This optional eld allows two issuers to have the
same issuer eld value, if the issuer unique identi ers are different.
8.Subject unique identi er. This optional eld allows two different subjects to
have the same subject eld value, if the subject unique identi ers are
different.
10.Signature. This eld is made of three sections. The rst section contains
all other elds in the certi cate. The second section contains the digest of the
rst section encrypted with the CA's public key. The third section contains the
algorithm identi er used to create the second section.
fi
.
.
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
Digitally signing a certi cate with a private key is basically encrypting the
certi cate data using a Hash function (like SHA-1) and private key which can
be accessed only if the key is known
Duties
Several duties have been de ned for a PKI.
1 Certi cates issuing, renewal, and revocation. These are duties de ned in
the X.509. Because the PKIX is based on X.509, it needs to handle all duties
related to certi cates.
2 Keys storage and update. A PKI should be a storage place for private keys
of those members that need to hold their private keys somewhere safe. In
addition, a PKI is responsible for updating these keys on members' demands.
.
.
fi
fi
fi
fi
fi
fi
fi
fi
3.Providing services to other protocols. As we see will in the next few
chapters, some Internet security protocols, such as IPSec and TLS, are
relying on the services by a PKI.
4 Providing access control. A PKI can provide different levels of access to the
information stored in its database. For example, an organisation PKI may
provide access to the whole database for the top management, but limited
access for employees.
Public Key: This key is freely distributed and made available to anyone who
wants to communicate securely with the key owner. It is used for encryption
by anyone who wishes to send an encrypted message to the key owner.
Private Key: This key is kept secret and known only to the key owner. It is
used for decryption to unlock messages that have been encrypted using the
corresponding public key.
A one-way function3 is one that maps a domain into a range such that every
function value has a unique inverse, with the condition that the calculation of
the function is easy, whereas the calculation of the inverse is infeasible:
Y = f(X) easy
X = f-1(Y) infeasible
RSA uses two exponents, e and d, where e is public key and d is private key.
Suppose P is the plaintext and C is the ciphertext.
Sender uses C = P^e mod n
to create ciphertext C from plaintext P;
Receiver uses P = C^d mod n
to retrieve the plaintext sent by Sender.
n (called - modulus), is a very large number, is created during the key
generation process.
Security of RSA
Modular exponentiation is computationally feasible in polynomial time using
the fast exponentiation algorithm.
However, modular logarithm (inverse of modular exponentiation used for
decryption/ determination of - d) is as hard as factoring the modulus, for
which there is no polynomial algorithm yet. This means that Sender can
encrypt in polynomial time (e is public), Receiver also can decrypt in
polynomial time (because he knows d), but adversary cannot decrypt
because she would have to calculate the eth root of C using modular
arithmetic , which is computationally infeasible .
Decryption using Private key - receiver can use following to decrypt the
ciphertext message he received. Decryption in RSA can be done using an
algorithm with polynomial time complexity. The size of the ciphertext is less
than n.
Veri cation Step: Once the system receives the identi er, the next step
involves verifying the authenticity of the identity claimed. This veri cation can
be achieved through various means, such as passwords, biometric data (like
ngerprints or facial recognition), hardware tokens, or other authentication
factors. The user presents or generates this authentication information to
corroborate the binding between the entity and the identi er.
1.Something known. This is a secret known only by the claimant that can be
checked by the veri er. Examples are a password, a PIN, a secret key, and a
private key.
1.First Approach - In the 1st approach, the system keeps a table (a le that
is sorted by user identi cation. To access the system resources, the user
sends her user identi cation and password, in plaintext, to the system. The
system uses the identi cation to nd the password in the table. If the
password sent by the user matches the password in the table, access is
granted; otherwise, it is denied.
Possible attacks
Salting makes the dictionary attack more dif cult. If the original password is 6
digits and the salt is 4 digits, then hashing is done over a 10-digit value. This
means that attacker now needs to make a list of 10 million items and create a
hash for each of them.
The list of hashes has 10 million entries, and the comparison takes much
longer. Salting is very effective if the salt is a very long random number. The
UNIX operating system uses a variation of this method.
4.Fourth Approach - In the fourth approach, two identi cation techniques are
combined. A good example of this type of authentication is the use of an ATM
card with a PIN (personal identi cation number). The card belongs to the
category "something possessed" and the PIN belongs to the category
"something known". The PIN is a password that enhances the security of the
card. If the card is stolen, it cannot be used unless the PIN is known. The PIN
number, however, is traditionally very short so it is easily remembered by the
owner. This makes it vulnerable to the guessing type of attack
One-time password - One-time passwords (OTPs) are temporary
passwords that are valid for a single login session or transaction, typically for
a short duration. OTPs are widely used to enhance security by adding an
extra layer of authentication beyond traditional passwords.
1.First Approach
In the rst approach, the user and the system agree upon a list of passwords.
Each password on the list can be used only once. There are some drawbacks
to this approach.
First, the system and the user must keep a long list of passwords. Second, if
the user does not use the passwords in sequence, the system needs to
perform a long search to nd the match. This scheme makes eavesdropping
fi
fi
fi
fi
fi
fi
fi
fi
fi
and
reuse of the password useless.
The password is valid only once and cannot be used again.
2.Second Approach
In the second approach, the user and the system agree to sequentially
update the pass-word. The user and the system agree on an original
password, Pi, which is valid only for the rst access. During the rst access,
the user generates a new password, P2, and encrypts this password with P
as the key. P2, is the password for the second access.
During the second access, the user generates a new password, P3, and
encrypts it with P2; P3s is used for the third access. In other words, Pi; is
used to create Pi+1. Of course, if Attacker can guess the rst password (P),
she can nd all of the subsequent ones
Subsequent Accesses:
When the user tries to access the system again, they receive the updated
value of n (e.g., n - 1).
The user calculates h^(n-1)(Po) and sends the result to the system.
The system applies the hash function to the received value to get h^(n-2)(Po),
which is then compared with the updated entry.
This process continues with each access, decrementing the value of n and
updating the stored password value accordingly.
First Approach
In the rst approach, the veri er sends a nonce, a random number used only
once, to challenge the claimant. A nonce must be time-varying; every time it is
created, it is different. The claimant responds to the challenge using the
secret key shared between the claimant and the veri er.
The rst message is not part of challenge-response, it only informs the veri er
that the claimant wants to be challenged. The second message is the
challenge. Rb is the nonce randomly chosen by the veri er (Receiver) to
challenge the claimant. The claimant encrypts the nonce using the shared
secret key known only to the claimant and the veri er and sends the result to
the veri er. The veri er decrypts the message. If the nonce obtained from
decryption is the same as the one sent by the veri er, Sender is granted
access.
Note that in this process, the claimant and the veri er need to keep the
symmetric key used in the process secret. The veri er must also keep the
value of the nonce for claimant identi cation until the response is returned.
The reader may have noticed that use of a nonce prevents a replay of the
third message by Attacker. Attacker cannot replay the third message and
pretend that it is a new request for authentication by claimant, because once
veri er receives the response, the value of Rb is not valid any more. The next
time a new value is used.
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
2nd
Approach
Using an Asymmetric-Key Cipher
Instead of a symmetric-key cipher, we can use an asymmetric-key cipher for
entity authentication. Here the secret must be the private key of the claimant.
The claimant must show that she owns the private key related to the public
key that is available to everyone. This means that the veri er must encrypt
the challenge using the public key of the claimant; the claimant then decrypts
the message using her private key. The response to the challenge is the
decrypted challenge. Following are two approaches: one for unidirectional
authentication and one for bidirectional authentication.
First Approach
In the rst approach, veri er encrypts the challenge using Al's public key.
Claimant decrypts the message with her private key and sends the nonce to
veri er.
fi
fi
fi
fi
Second Approach
In the second approach, two public keys are used, one in each direction.
Claimant sends her identity and nonce encrypted with veri er's public key.
veri er responds with his nonce
encrypted with Claimant's public key. Finally, Claimant, responds with
veri er's decrypted nonce.
Digital signature process - The sender uses a signing algorithm to sign the
message.The message and the signature are sent to the receiver. The
receiver receives the message and the signature and applies the verifying
algorithm to the combination. If the result is true, the message is accepted;
otherwise, it is rejected.
A conventional signature is like a private "key" belonging to the signer of the
document. The signer uses it to sign documents; no one else has this
signature. The copy of the signature is on le like a public key; anyone can
use it to verify a document, to compare it to the original signature.
In a digital signature, the signer uses her private key, applied to a signing
algorithm, to sign the document. The veri er, on the other hand, uses the
public key of the signer, applied to the verifying algorithm, to verify the
document.
Note that when a document is signed, anyone, including receiver, can verify it
because everyone has access to sender's public key. Sender must not use
her public key to sign the document because then anyone could forge her
signature.
A digest is made out of the message at sender's site. The digest then goes
through the signing process using Sender's private key. Sender then sends
the message and the signature to Receiver.
At Receiver's site, using the same public hash function, a digest is rst
created out of the received message. Calculations are done on the signature
and the digest. The verifying process also applies criteria on the result of the
calculation to determine the authenticity of the signature. If authentic, the
message is accepted; otherwise, it is rejected.
2. Known-Message Attack:
In a known-message attack, the attacker has access to one or more pairs of
known messages and their corresponding valid signatures.
These message-signature pairs are obtained from documents previously
signed by the signer.
Attacker's objective in a known-message attack is to create a new message
and forge/replicate a valid signature for that message, mimicking the
signature style of Signer. The goal is to make the forged signature appear
genuine to a veri er , even though Signer did not sign the new message.
To conduct a known-message attack, Attacker analyzes the known message-
signature pairs to identify patterns, relationships, or weaknesses that can be
exploited to generate a forged signature for a different message.
5. Digital Signature Scheme - These are the various methods using which
digital signatures are created.
The signing and verifying sites use the same function, but with different
parameters. The veri er compares the message and the output of the
function for congruence.
If the result is true, the message is accepted.
fi
fi
1.2.1 Packet Snif ng - https://www.geeksforgeeks.org/what-is-packet-snif ng/
Packet snif ng, also known as network snif ng or protocol analysis, is a
technique used to capture and analyse data packets as they traverse a
network.Packet snif ng is commonly used for network monitoring and
analysis. Attackers use packet sniffers to examine traf c patterns, detect
anomalies in the network packets , attackers use packet snif ng to intercept
and capture sensitive information such as usernames, passwords, credit card
numbers, and other con dential data transmitted over the network. This
information can be used for identity theft, nancial fraud, or gaining
unauthorised access to systems. Packet sniffers work by putting the network
interface card (NIC) into promiscuous mode , Once in promiscuous mode, the
packet sniffer captures data packets from the network. These packets contain
information such as source and destination IP addresses, MAC addresses,
port numbers, protocol types, and payload data. Using cryptanalysis ,
attackers can decode passwords , keys etc.
The simplest DoS attack relies primarily on brute force, ooding the target
with an overwhelming ux of packets, oversaturating its connection bandwidth
or depleting the target's system resources. Bandwidth-saturating oods rely
on the attacker's ability to generate the overwhelming ux of packets. A
common way of achieving this today is via distributed denial-of-service,
employing a botnet.
fi
fi
fi
fl
fl
fi
fi
fi
fl
fl
fi
fl
fi
Impact of DoS Attacks:
• Service Disruption: The primary impact of a DoS attack is the
disruption of services. Targeted systems may become slow,
unresponsive, or completely unavailable, causing inconvenience to
users and potential nancial losses for businesses.
• Loss of Revenue: For businesses that rely on online services, a
prolonged DoS attack can lead to loss of revenue due to downtime and
reduced customer engagement.
• Reputation Damage: Publicly visible DoS attacks can harm the
reputation of organizations, eroding trust among customers and
stakeholders.
• Data Loss: In some cases, DoS attacks may lead to data loss or
corruption if systems are overwhelmed and fail to handle requests
properly.
2.2 ICMP ood : ICMP Flood based DoS Attack https://www.cloud are.com/
en-gb/learning/ddos/ping-icmp- ood-ddos-attack/
The ICMP Flood attack takes place in the Network Layer.
4. Network security:
4.1 IDS -
4.2 Firewalls -
fl