Network Security
Network Security
SECURITY
UNIT-1 CRYPTOGRAPHY TERMINOLOGY
CRYPTOGRAPHY
It can reformat and transform our data, making
it safer on its trip between computers.
It is a technique of securing communication by
converting plain text into ciphertext
The technology is based on the essentials of
secret codes, augmented by modern
mathematics that protects our data in powerful
ways.
• Computer Security - generic name for the
collection of tools designed to protect data and
to thwart hackers
• Network Security - measures to protect data
during their transmission
• Internet Security - measures to protect data
during their transmission over a collection of
interconnected networks
BASIC CONCEPTS
Cryptography -The art or science encompassing the principles and methods of transforming
an intelligible message into one that is unintelligible, and then retransforming that message
back to its original form
Plaintext -The original intelligible message
Cipher text -The transformed message
Cipher- An algorithm for transforming an intelligible message into one that is unintelligible by
transposition and/or substitution methods
Key- Some critical information used by the cipher, known only to the sender& receiver
Encipher (encode) -The process of converting plaintext to cipher text using a cipher and a key
Decipher (decode)- the process of converting cipher text back into plaintext using a cipher
and a key
Cryptanalysis -The study of principles and methods of transforming an unintelligible message
back into an intelligible message without knowledge of the key. Also called code breaking
Cryptology- Both cryptography and cryptanalysis
Code - An algorithm for transforming an intelligible message into an unintelligible one using a
code-book
FEATURES OF CRYPTOGRAPHY
• Confidentiality: Information can only be accessed by the person for whom it is intended and no
other person except him can access it.
• Integrity: Information cannot be modified in storage or transition between sender and intended
receiver without any addition to information being detected.
• Non-repudiation: The creator/sender of information cannot deny his intention to send information
at a later stage.
• Authentication: The identities of the sender and receiver are confirmed. As well destination/origin
of the information is confirmed.
• Interoperability: Cryptography allows for secure communication between different systems and
platforms.
E(M) = C
In reverse process,
D(C) = M
The full process
D(E(M)) = M
AUTHENTICATION , INTEGRITY AND NON-REPUDIATION
DK (EK(M)) = M
Scenarios where algorithms or cryptographic techniques
might be restricted
Export restrictions: These restrictions are imposed by various governments due to
national Security concerns to strength of encryption that could be exported to certain
countries.
Security Policies: Within organizations, there may be security policies or guidelines that
restrict the use of certain cryptographic algorithms or require the use of specific approved
algorithms to maintain a consistent and secure cryptographic environment.
Key Length Restrictions: Some standards and regulations specify minimum key lengths
Some algorithm use different encryption key and decryption key.
It is used when a large amount of data needs to be transferred. It is used to transfer small amount of data.
The length of key used is 128 or 256 bits The length of key used is 2048 or higher
Steganography Cryptography
The structure of data is not modified in the case The structure of data is modified in the case of
of Steganography. Cryptography.
The use of key is not obligatory, but if it is used it The use of key is obligatory in the case of
enhances security. Cryptography.
The ciphertext generated by the One-Time pad is random, so it does not have any statistical relation
with the plain text.
TheA assignmentB
is as follows:
C D E F G H I J
The relation between the key and plain text: In this algorithm, the length of the key should be
equal
0 to that of
1 plain text.
2 3 4 5 6 7 8 9
K L M N O P Q R S T
10 11 12 13 14 15 16 17 18 19
U V W X Y Z
20 21 22 23 24 25
Input: Message = HELLO,
Key = MONEY
Output: Cipher – TSYPM, Message – HELLO
Explanation:
Part 1: Plain text to Ciphertext
Plain text — H E L L O ? 7 4 11 11 14
Key — M O N E Y ? 12 14 13 4 24
Plain text + key ? 19 18 24 15 38 ? 19 18 24 15 12 (= 38 – 26)
Cipher Text ? T S Y P M
If any way cryptanalyst finds these two keys using which two plaintext are produced but if the
key was produced randomly, then the cryptanalyst cannot find which key is more likely than the
other. In fact, for any plaintext as the size of ciphertext, a key exists that produces that plaintext.
So if a cryptanalyst tries the brute force attack(try using all possible keys), he would end up with
many legitimate plaintexts, with no way of knowing which plaintext is legitimate. Therefore, the
code is unbreakable.
The security of the one-time pad entirely depends on the randomness of the key. If the
characters of the key are truly random, then the characters of the ciphertext will be truly
random. Thus, there are no patterns or regularities that a cryptanalyst can use to attack the
ciphertext.
Advantages
One-Time Pad is the only algorithm that is truly unbreakable and can be used for low-bandwidth
channels requiring very high security(ex. for military uses).
A cryptographic protocol is a set of rules and procedures that use cryptographic
algorithms to achieve specific security objectives in communication and data exchange. These
protocols ensure confidentiality, integrity, and authentication in various digital interactions.
• Initialization: The parties involved agree on the protocol and necessary parameters.
• Key exchange: A secure method is used to exchange encryption keys.
• Authentication: The identities of the parties are verified.
• Encryption: Data is encrypted using the agreed-upon algorithms and keys.
• Transmission: The encrypted data is sent over the network.
• Decryption: The recipient decrypts the data using their key.
• Verification: The integrity and authenticity of the received data are checked.
Types of protocols
A) Arbitrated protocols
B. Adjudicated protocols
C. Self enforcing
Attacks on protocols
• Passive attacks
• Active attacks
• Cheaters
1. Symmetric cryptosystems (DES etc.)
2.
3. Security should lie in the key
4. Keys must be distributed in secret, and are as valuable as all the information they
encrypt.
5. Having a key compromised (broken, stolen, extorted, bribed) permits all sorts of mayhem
through messages read, and messages faked,
• N users need O(n^2) keys to communicate securely.
2. One-way functions
Functions those are one-way, unless one knows the secret that allows them to be inverted.
Such functions are at the heart of public key systems such as RSA
Difficulty of factoring, discrete logs, various NP complete problems has been used as a basis
for trapdoor functions.
Again, no mathematical proof that such functions actually exist.
One-way functions
It easy to compute, whereas inverse functions are complicated to compute.
There is no mathematical proof that one-way functions exist.
The existence of such one-way functions is still a not-resolved question.
How Do One Way Functions Work?
A one-way function mainly starts with a group of letters known as a key,
which is then mapped to a hash of a specific length.
Modern hashes have 128 bits or more, however, the hash value is
shorter than the original string of characters.
The hash value is often referred to as a
message digest
. When you scramble this message digest, it becomes unique each time.
A one-way function should be free of collisions. This means it should be
extremely difficult to locate two distinct sequences that give the same
hash result.
Furthermore, one-way functions are used to store data. Data can be
accessed by locating hash values, and are stored in computer memory.
Public key cryptography
• It provides a secure way to exchange information and authenticate users by using pairs of
keys.
• The public key is used for encryption and signature verification, while the private key is
used for decryption and signing.
• When the two parties communicate with each other to transfer the intelligible or sensible
message, referred to as plaintext, is converted into apparently random unreadable for
security purposes referred to as ciphertext.
Components of Public Key Encryption
Plain Text: This is the message which is readable or
understandable. This message is given to the Encryption
algorithm as an input.
Cipher Text: The cipher text is produced as an output of
Encryption algorithm. We cannot simply understand this
message.
Encryption Algorithm: The encryption algorithm is used to
convert plain text into cipher text.
Decryption Algorithm: It accepts the cipher text as input and
the matching key (Private Key or Public key) and produces the
original plain text
Public and Private Key: One key either Private key (Secret
key) or Public Key (known to everyone) is used for encryption
and other is used for decryption
Hybrid Cryptosystem
It is a cryptographic system that combines the strengths of both symmetric and asymmetric
encryption. It leverages the high speed of symmetric encryption and the secure key distribution
of asymmetric encryption. Hybrid cryptosystems are widely used in real-world applications, such
as SSL/TLS protocols for secure communication.
Components of a Hybrid Cryptosystem
Symmetric Encryption:
Uses a single key for both encryption and decryption.
Fast and suitable for encrypting large amounts of data.
Example: AES (Advanced Encryption Standard).
Asymmetric Encryption:
Uses a pair of keys (public and private).
Secure key distribution but slower compared to symmetric encryption.
Example: RSA
Key Exchange:
A process where a symmetric key is securely shared using asymmetric encryption.
How a Hybrid Cryptosystem Works
Sender:
Generates a random symmetric key (called a session key).
Encrypts the data using the symmetric key (fast encryption).
Encrypts the symmetric key using the receiver’s public key (secure key exchange).
Receiver:
Decrypts the symmetric key using their private key.
Uses the symmetric key to decrypt the actual data.
Digital Signature
A digital signature is a cryptographic technique used to ensure the authenticity,
integrity, and non-repudiation of digital data. It verifies that a message, document,
or transaction originates from the claimed sender and has not been altered during
transmission.
Key Features
Authentication: Confirms the sender’s identity.
Integrity: Ensures the message has not been tampered with.
Non-repudiation: Prevents the sender from denying the act of signing.
How Digital Signatures Work
Key Generation:
A key pair (private key and public key) is created.
Private Key: Used to sign the message.
Public Key: Used to verify the signature.
Signing Process:
The sender creates a hash (a fixed-length string) of the message using a cryptographic hash
function.
The hash is encrypted with the sender’s private key, creating the digital signature.
Verification Process:
The recipient decrypts the digital signature using the sender’s public key, obtaining the hash.
The recipient computes the hash of the received message and compares it with the decrypted
hash.
Alice signs a message—"Hello Bob!"—by appending a signature computed from the
message and her private key. Bob receives both the message and signature. He
uses Alice's public key to verify the authenticity of the signed message.
Now, suppose when Alice sends a message to Bob, then Bob will check if the sender is authentic;
to ensure that it was Alice who sent the message, not Eve. For this, Bob can ask Alice to sign the
message electronically. So we can say that an electronic signature can prove that Alice is
authentic and is the one sending the message. We called this type of signature a digital signature.
DSA algorithm
The Digital Signature Algorithm (DSA) is a cryptographic
algorithm used to generate and verify digital signatures. It
ensures the integrity and authenticity of digital data and is
widely used in securing communications. Here’s an
explanation of its key concepts and workings:
Key Concepts of DSA:
Asymmetric Cryptography:
DSA uses two keys:
A private key: Known only to the owner and used to generate the digital signature.
A public key: Shared with others and used to verify the signature.
Digital Signature:
A unique cryptographic code that binds the signer’s identity to the document or message.
Ensures that the message has not been tampered with and confirms the sender’s authenticity.
Applications of DSA:
Data Integrity: Ensures the content of the message hasn’t been altered during transmission.
Authentication: Confirms the identity of the sender.
The image above shows the entire procedure of the DSA algorithm. You will use two
different functions here, a signing function and a verification function. The difference
between the image of a typical digital signature verification process and the one above is
the encryption and decryption part.
Digital Signature Algorithm & Digital Signature Standards
The National Institute of Standards and Technology (NIST) has published Federal Information Processing
Standard FIPS 186, known as the Digital Signature Standard (DSS). The DSS makes use of the SHA and presents a
new digital signature technique, the Digital Signature Algorithm (DSA). Latest version also incorporates digital
signature algorithms based on RSA and on elliptic curve cryptography.
The RSA Approach
• In the RSA approach, the message to be signed is input to a hash function(SHA-512 , SHA-1)
that produces a secure hash code of fixed length.
• This hash code is then encrypted using the sender’s private key to form the signature.
• Both the message and the signature are then transmitted.
• The recipient takes the message and produces a hash code.
• The recipient also decrypts the signature using the sender’s public key.
• If the calculated hash code matches the decrypted signature, the signature is accepted as
valid.
The DSS Approach
• The DSS approach also makes use of a hash function.
• The hash code is provided as input to a signature function along with a random number k,
generated for this particular signature.
• The signature function also depends on the sender’s private key (PRa), and a set of
parameters known to a group of communicating principle.
• We can consider this set to constitute a global public key (PUG).
• The result is a signature consisting of two components, labelled s and r.
• At the receiving end, the hash code of the incoming message is generated.
• The signature is input to a verification function. The verification function also depends on the
global public key as well as the sender’s public key (PUa), which is paired with the sender’s
private key.
• The output of the verification function is a value that is equal to the signature component r, if
the signature is valid. The signature function is such that only the sender, with knowledge of
the private key, could have produced the valid signature.
Digital Signature Algorithm
Create digital Signature Signature Verification
Pseudo-random sequences
It plays a crucial role in cryptography by providing sequences of numbers that appear random but
are generated deterministically using an algorithm. Here’s a breakdown of their importance,
characteristics, and applications in cryptography
What Are Pseudo-Random Sequences?
• A pseudo-random sequence is a series of numbers that:
• Appears random: The sequence exhibits statistical properties of randomness.
• Deterministic: It is generated using a deterministic process, typically a mathematical algorithm,
starting from an initial value called a seed.
• The term "pseudo" indicates that these sequences are not truly random because they are
produced by algorithms, but they are sufficiently unpredictable for cryptographic purposes when
designed correctly.
Characteristics of Pseudo-Random Sequences in Cryptography
• Unpredictability: Given part of the sequence, it should be computationally infeasible to predict
the next value without knowing the seed.
• Determinism: The same seed always produces the same sequence, which is useful for
reproducibility in cryptographic protocols.
• Statistical Randomness: The sequence should pass statistical tests for randomness, such as
uniform distribution and lack of patterns.
• Periodicity: While pseudo-random sequences are periodic (since they are generated
Cryptographic Applications
a. Key GenerationPseudo-random number generators (PRNGs) are used to generate cryptographic
keys, such as symmetric keys in AES or private keys in RSA and ECC.
b. Initialization Vectors (IVs)IVs are nonces (numbers used once) required in encryption schemes like
CBC (Cipher Block Chaining). They are often derived from pseudo-random sequences.
c. NoncesNonces prevent replay attacks in protocols. They are generated using pseudo-random
sequences to ensure uniqueness.
d. Salt in HashingSalts used in password hashing schemes are often pseudo-random to prevent
precomputed attacks like rainbow tables.
e. Stream CiphersStream ciphers like RC4 and ChaCha20 use pseudo-random sequences to XOR
plaintext for encryption.
f. Secure CommunicationProtocols like TLS rely on pseudo-random sequences for key exchange and
session key generation.
If the sender and receiver wish to exchange encrypted messages, each must be equipped to
encrypt messages to be sent and decrypt messages received. The nature of the equipping
they require depends on the encryption technique they might use. If they use a code, both
will require a copy of the same codebook. If they use a cipher, they will need appropriate
keys. If the cipher is a symmetric key cipher, both will need a copy of the same key. If it is
an asymmetric key cipher with the public/private key property, both will need the other’s
public key.
Key exchange with Symmetric key
Key exchange in symmetric cryptography is the process of sharing a secret key between two
parties so that they can communicate securely. The key is used to encrypt messages for sending
and decrypt messages for receiving.
Here are some things to know about key exchange with symmetric cryptography:
• Key exchange is required : For two parties to communicate securely, they must first
exchange the key. If the key is intercepted by a third party, they can decrypt the messages.
• Key exchange can be difficult : It can be difficult to establish a shared key using only
symmetric encryption algorithms.
• Asymmetric encryption can help :Asymmetric encryption can be used to securely exchange
the symmetric key. For example, web browsers and servers use an SSL/TLS handshake to
generate a shared symmetric key.
• Symmetric encryption is efficient :Symmetric encryption is generally more efficient than
asymmetric encryption, making it a good choice for exchanging large amounts of data.
• Symmetric encryption algorithms: Symmetric encryption algorithms include AES, DES, and
3DES.
Key exchange with Public key cryptography
Public key cryptography uses a two-key system to exchange keys and establish a secure
communication channel:
• Public key: Can be sent openly over a network or shared in public.
• Private key: Kept private by the owner.
The public and private keys are cryptographic inverses of each other, so what one key
encrypts, the other key will decrypt. For example, if Alice wants to send a secret message to
Bob, she can send him her public key and Bob can encrypt the message using that key. Alice
can then decrypt the message with her private key.
Public key cryptography is also known as asymmetric cryptography because it uses two keys
instead of one. It's used in many applications, including secure communication, online
transactions, and access control
Man-in-the-Middle Attack
• It is a cyberattack where the attacker secretly relays and possibly alters the communications
between two parties who believe that they are directly communicating with each other, where in
actuality the attacker has inserted themselves between the two user parties.
• This situation arises because the two persons who are communicating are unable to verify the
status of the person communicating with them, taking the assumption that the interception process
does not cause interference in the network.
1. Incomplete Information:
• An attacker attempting to intercept and decrypt the messages will not have the necessary keys
to decrypt both halves of a message until it's fully exchanged.
2. Sequential Dependency:
• If an attacker modifies the first half of the message, they cannot create a valid second half
without knowing the private key of the sender.
• Since decryption depends on completing the exchange, the protocol ensures that each party
confirms the authenticity of the communication at each stage.
1. Anu generates a random session key, K, and encrypts the message, M, using K (Εκ(Μ)).The point
2. Anu retrieves the public keys of Bhuvan, Chitra, and Dinesh from the database.
3. Anu encrypts K with each recipient's public key (Ев(K), EC(K), ED(K)).
4. Anu broadcasts the encrypted message and all the encrypted keys to anyone who wishes to
receive it (EB(K), EC(K), ED(K), Ex(М)).dictionary ever massive pre-co
5. Only Bhuvan, Chitra, and Dinesh can decrypt the session key, K, using their respective private
keys.
6. Only Bhuvan, Chitra, and Dinesh can decrypt Anu's message using the session key.
Authentication
When Anu logs into a host computer , how does the host know who she is? How does the host
know she is not Jay trying to falsify Anu's identity?
Traditionally, passwords solve this problem.
Anu enters her password, and the host confirms that it is correct. Both Anu and the host know
this secret piece of knowledge, and the host requests it from Anu every time she attempts to log
in.
The computer calculates f(xi) and compares it with xi+1a stored in its database. Jay can't obtain any
useful information because each number is only used once, and the function is one-way. Similarly,
the database is not useful to an attacker. Of course, when Anu runs out of numbers on her list, she
has to reinitialize the system
Authentication and Key Exchange
Even with salt, the first protocol has serious security problems. When Anu sends her password to her
host, anyone who has access to her data path can read it. She might be accessing her host through a
convoluted transmission path that passes through four industrial competitors, three foreign
countries, and two forward-thinking universities. Jay can be at any one of those points, listening to
Anu's login sequence. If Jay has access to the processor memory of the host, she can see the
password before the host hashes it.
Public-key cryptography can address this issue. The host maintains a file of every user's public key;
all users keep their private keys. Here is a simple attempt at a protocol. When logging in, the protocol
proceeds as follows:
1. The host sends Anu a random string.
2. Anu encrypts the string with her private key and sends it back to the host, along with her name.
3. The host looks up Anu's public key in its database and decrypts the message using that publickey.
4. If the decrypted string matches what the host sent Anu in the first place, the host allows Anu
access to the system.
No one else has access to Anu's private key, so no one else can impersonate Anu. More importantly,
Anu never sends her private key over the transmission line to the host. Jay, listeningin on the
interaction, cannot obtain any information that would enable her to deduce the private key and
impersonate Anu.
The private key is both long and non-mnemonic and will likely be processed automatically by the
user's hardware or communications software. This necessitates an intelligent terminal that Anu
Mutual Authentication Using the Interlock Protocol
In the context of mutual authentication, Anu and Bhuvan aim to verify each other's identities. They
both possess knowledge of each other's passwords: Anu has PA, and Bhuvan has PB. However, there
is a protocol that is susceptible to attack:
1. Initially, Anu and Bhuvan exchange public keys.
2. Anu encrypts PA with Bhuvan's public key and transmits it to him.
3. Bhuvan encrypts PB with Anu's public key and sends it to her.
4. Anu decrypts the message received in step (2) and confirms its correctness.
5. Bhuvan decrypts the message received in step (3) and validates its accuracy.
This protocol is vulnerable to a man-in-the-middle attack. Mahesh can intercept both public keys,
replace Bhuvan's public key with his own, and send it to Anu. He does the same with publ's public
key for Bhuvan. Mahesh can then manipulate the encryption and decryption steps to gath knowledge
of both PA and PB.
Authentication and key Exchange
Authentication is the process of confirming the identity of communicating entities such as users,
devices, or servers. It ensures that the parties involved are who they claim to be
Authentication Key Exchange (AKE) is the exchange of session key in a key exchange protocol which
also authenticates the identities of parties involved in key exchange. It is a way for two parties to
securely talk to each other, ensuring they both know who they're talking to and can keep their
conversation private.
Let's imagine Alice and Bob want to have a secret conversation over the internet. They want to be
sure that nobody else can listen in or pretend to be them during their chat. They use an AKE
Wide Mouth Frog Protocol
The Wide Mouth Frog Protocol is a computer network verification protocol typically used on
unsecured networks.
It permits people communicating over a network to verify their identity to each other, it also
helps in preventing replay attacks, or snooping and offers detection of any alteration and the
prevention of any unwanted reading.
However, to avoid active attacks, some form of message authentication or authenticated
encryption must be used.
The protocol can be specified as follows in security protocol notation, where user A is verifying
itself to user B using a server S:
• Where the identities of user A, user B, and the trusted server are A, B, and S respectively.
• Timestamps generated by user A and server S are TS1 and TS2 respectively.
• A generated symmetric key KAB, which will be the session key of the session between user A
and user B.
To understand the working let’s consider the example of the Wide-Mouthed-Frog protocol:
M1 A → S: {T{S1}.B.K{AB}}SKey(A)
M2 S → B: {T{S2}.A.K{AB}}SKey(B)
Here the server shares two different keys that are SKey(A) and SKey(B) with A and B; the
purpose of the protocol is to establish a session key K{AB} between user A and user B, and to
verify A to B. After that user A creates a session key and directs it to the server along with a
timestamp TS1; the server then sends the key to user B along with a new timestamp TS2.
Timestamps are generally used so that the users can obtain indications that the messages they
have received were created recently. It should be noted that for passing and for this mechanism
to work the different users’ clocks need to be synchronized; each user’s clock is crucial to the
security of the protocol.
Yahalom protocol
It is an authentication and secure key-sharing protocol designed for use on an insecure network
such as the Internet. Yahalom uses a trusted arbitrator to distribute a shared key between two
people. This protocol can be considered as an improved version of Wide Mouth Frog protocol.
Needhan Schroeder Protocol
The Needham–Schroeder protocol is a set of key transport protocols that can be used over
insecure networks:
Kerberos Protocol
Kerberos is a network authentication protocol that uses symmetric key cryptography and a
key distribution center (KDC) to verify user identities.
Four basic approaches to the analysis of
cryptographic protocols
Description:
This approach uses precise mathematical definitions and considers the computational hardness of
cryptographic primitives.
Key Features:
• Models adversaries as probabilistic polynomial-time algorithms.
• Measures security based on the probability of adversarial success.
Strengths:
• Closely aligns with real-world cryptographic security.
• Accounts for probabilistic behavior and resource-bounded adversaries.
Limitations:
• Computationally expensive and less automated than symbolic methods.
• Harder to scale for complex protocols.
Examples:
• Formal proofs in the Universal Composability (UC) framework or using tools like EasyCrypt.
3. Logic-Based Approaches
Description:
These methods employ formal logic (e.g., modal logic or temporal logic) to model and analyze the
behavior of cryptographic protocols.
Key Features:
• Specify protocols and their properties using logical formulas.
• Prove or disprove properties like secrecy or authenticity.
Strengths:
• Provides a structured and rigorous framework.
• Suitable for reasoning about trust and belief in protocols.
Limitations:
• Can be complex and prone to errors in formalization.
• May require expert knowledge of logic systems.
Examples:
• BAN Logic (Burrows-Abadi-Needham Logic) for reasoning about authentication protocols.
4. Automated Tools and Verification
Description:
• This approach uses automated tools to verify the correctness and security of cryptographic
protocols.
Key Features:
• Combines symbolic and computational models for automated analysis.
• Employs techniques like model checking, theorem proving, or SAT solving.
Strengths:
• Increases efficiency and reduces human effort.
• Scalable for complex protocols.
Limitations:
• Relies on the correctness of the tools themselves.
• May produce false positives or negatives.
Examples:
• Tools like ProVerif, AVISPA, and Scyther.
Secret Splitting
Description:
A method of dividing a secret into multiple parts (shares) such that each part is individually
meaningless and does not reveal any information about the secret.
Key Features:
Reconstruction Requirement: All parts (or a specific subset) must be combined to reconstruct the
secret.
Security:
A single share (or any insufficient subset) provides no information about the secret.
Use Case:
Often used in scenarios where the secret must be fully protected unless all parties collaborate.
Example:
such that:𝐾=𝐾1⊕𝐾2
Suppose a secret key K is split into two parts, K1 and K2,
• Threshold Property: Any 𝑡t or more shares can reconstruct the secret, while fewer than 𝑡t shares
Key Features:
reveal nothing.
• Flexibility: Shares can be distributed to multiple parties, and redundancy is built into the system.
Common Schemes:
• Shamir’s Secret Sharing:
Based on polynomial interpolation.
A secret S is encoded as the constant term of a random polynomial f(x) of degree t−1:
Uses geometric principles where the secret is a point in 𝑛-dimensional space, and shares are
• Blakley’s Secret Sharing:
Definition:
Key escrow is a system in which encryption keys are held in escrow (trusted storage) so
that, under certain conditions (e.g., a legal warrant), a third party can access encrypted
data.
Key Features:
• Usually implemented by governments or organizations for accountability or surveillance.
• Often controversial due to privacy concerns.
• Used in systems like the Clipper Chip (U.S., 1990s) and enterprise key management
systems.
Example Use Case:
• Corporate environments where a company wants to ensure access to employees’
encrypted files after departure.
• Law enforcement access to encrypted communication under a court order.
Secret Elections (Private Voting Protocols)
Goal: Enable verifiable and anonymous voting, where:No one can determine how someone else
voted.Everyone can verify that votes were counted correctly.
Key Techniques:
Real-World Example:
• Helios voting system, Estonia's e-voting.
Secure Multiparty Computation (SMPC or MPC)
Goal:
Multiple parties compute a function over their private inputs without revealing those inputs to
each other.
Classic Example:
"Yao's Millionaires' Problem" – Two people want to know who is richer without revealing their
actual wealth.
Approaches:
• Secret sharing (e.g., Shamir’s secret sharing): Each party holds a piece of the data.
• Garbled circuits: Encrypt the function itself; others evaluate without learning internals.
• Homomorphic encryption: Enables operations on encrypted data.
Use Cases:
Privacy-preserving data analytics.Joint auctions or bidding.Collaborative machine learning (e.g.,
federated learning with privacy).
Anonymous Message Broadcast (Dining Cryptographers Problem)
Key Protocol:
• Dining Cryptographers Protocol (by David Chaum):
• Each participant shares keys with neighbors.
• XORs reveal if someone paid (sent message), but not who.
Variants:
• DC-nets (Dining Cryptographers Networks)
• Mix-nets and Onion Routing (used in Tor)
• Riposte: A modern anonymous broadcast system.
Digital Cash (Cryptographic e-Cash Notes)
Goal:
Mimic the privacy and untraceability of physical cash in digital form, while preventing double-
spending.
Key Features:
• Anonymity: No one knows who owns or spends a coin.
• Unforgeability: Coins can't be copied or faked.
• Double-spending detection: If someone tries to reuse a coin, they’re caught.
Techniques Used:
• Blind signatures : Bank signs a coin it can’t link to the spender.
• Zero-knowledge proofs: Prove you own a valid coin without revealing it.
• Cryptographic accumulators and Merkle trees in modern versions.
UNIT – 3 KEY LENGTH
KEY LENGTH
In cryptography, key length is the number of bits in a
key used for encryption. Key length is measured in bits
and is a key factor in determining the security of
encryption.
Key length and security
Longer keys are more secure than shorter keys.
Different ciphers may require different key lengths to
achieve the same level of security.
The key length defines the upper-bound on an
algorithm's security.
The security of all algorithms can be violated by brute-
force attacks.
Key Size and Encryption System
There are two types of encryption systems:
Symmetric Systems: These are the algorithms for cryptography
that use the same cryptographic keys for both encryption and
decryption of ciphertext.
Asymmetric Systems: These are the algorithms that use pair of
related keys. Each key pair consists of a public key and a
corresponding private key.
Number theory is the study of integers and their properties, especially primes, divisibility, and
modular operations.
Important Concepts:
• Primes: Cannot be divided by other numbers (e.g., 2, 3, 5, 7).
• Modular Arithmetic: Used in RSA and Diffie-Hellman.
Example: 7 mod 3 = 1GCD, LCM: Useful in computing multiplicative inverses.
• Euler’s Theorem:
If a and n are coprime: a^φ(n) ≡ 1 mod n
• Fermat’s Little Theorem:
If p is prime and a is not divisible by p, then:a^(p−1) ≡ 1 mod p
Application:
• Encryption, digital signatures, hashing.
Computational Complexity Theory
This theory studies how difficult problems are to solve in terms of time and space.
Key Complexity Classes:
• P (Polynomial Time): Solvable quickly (e.g., sorting).
• NP (Nondeterministic Polynomial Time): Verifiable quickly (e.g., Sudoku).
• NP-Complete: Hardest in NP. If one can be solved quickly, all can.
• NP-Hard: Even harder than NP-complete in some cases.
Importance in Cryptography:
• Cryptographic security depends on hard problems, like:
• Integer factorization (RSA)
• Discrete logarithm (Diffie-Hellman, ECC)
• If these problems are solved efficiently, many encryption systems break.
Prime Number Generation (DBS)
In cryptography, large prime numbers are required (e.g., in RSA).
Methods of Prime Generation:
• Random Selection + Primality Test
• Generate a random number and test for primality using:
• Fermat Test (simple but not always accurate)
• Miller-Rabin Test (fast and probabilistic)
• AKS Test (deterministic, slow)
• DBS (Deterministic Binary Search):
• A structured method to search for primes deterministically within a range.
• Useful in provable prime generation.
• Can guarantee a prime exists in an interval using number-theoretic bounds.
Security Need: Cryptographic systems fail if generated primes are small, predictable, or
reused.
Security of DES (Data Encryption Standard)
DES is a symmetric block cipher developed by IBM in the 1970s.
DES Features:
• 64-bit block size.
• 56-bit effective key (outdated).
• Uses 16 rounds of Feistel structure:
• Substitution (via S-boxes)
• Permutation (P-boxes)
• Key mixing
Security Concerns:
• Brute-force vulnerability: 2⁵⁶ keys is searchable with modern computing.
• Linear and Differential Cryptanalysis: Exploit predictable patterns.
• Weak keys: Certain keys produce insecure or repeating encryption.
Improvement:
• 3DES (Triple DES): Encrypt-decrypt-encrypt using multiple keys.
• Increases effective key length (112 or 168 bits)
• Much slower than DES, but more secure.
Stream Ciphers using LFSRs (Linear Feedback Shift Registers)
Stream Cipher:
• Encrypts bit by bit or byte by byte, instead of in blocks.
• Uses a keystream that is XORed with plaintext.
LFSR (Linear Feedback Shift Register):
• A register of bits that shifts with every clock cycle.
• New bit = XOR of specific bits (taps).
• Produces a pseudo-random bit sequence.
Example Use:
• A5/1 stream cipher used in GSM mobile communications.
Advantages:
• Simple hardware implementation.
• Fast and lightweight.
Security Weakness:
• Predictable: If the structure or a portion of output is known, attackers can reconstruct the
internal state.
• Linear: Easy to break with known plaintext attacks.
• Solution: Use non-linear feedback or multiple LFSRs to harden the cipher.
UNIT 5
One-Way Hash Functions
A hash function takes an input (message) and produces a fixed-size output called a hash
or digest.
Key Properties of a One-Way Hash Function:
1.Deterministic: Same input → same output every time.
2.Fast Computation: Easy to compute the hash for any input.
3.Pre-image Resistance: Hard to find input from its hash (one-way).
4.Second Pre-image Resistance: Hard to find another input with the same hash.
5.Collision Resistance: Hard to find two different inputs with the same hash.
Applications:
• Password storage (e.g., hash passwords instead of storing them).
• Data integrity (e.g., verify file hasn't been tampered with).
• Digital signatures (sign the hash of a message, not the message itself).
• Blockchain (e.g., Bitcoin uses hash chaining)
SHA: Secure Hash Algorithms
SHA is a family of hash functions developed by NIST (National Institute of Standards and
Technology).
Common SHA Variants:
• SHA-1:
• Output: 160 bits.
• No longer secure (collision vulnerabilities).
• SHA-2 (e.g., SHA-256, SHA-512):
• SHA-256: Output = 256 bits (most widely used today).
• Secure and widely supported.
• SHA-3:
• Based on Keccak algorithm.
• Different internal design (sponge construction).
• Used where a higher level of post-quantum resistance is desired.
Public Key Algorithms (Asymmetric Encryption)
Goal:
To allow two parties to agree on a shared secret key over an insecure channel, without anyone else being
able to figure it out.
How It Works:
1.Choose a large prime number p and a base g (both public).
2.Alice chooses secret a and sends A = g^a mod p to Bob.
3.Bob chooses secret b and sends B = g^b mod p to Alice.
4.Alice computes shared key: K = B^a mod p
5.Bob computes shared key: K = A^b mod p
Security:
Based on the Discrete Logarithm Problem: Given g, p, and g^a mod p, it is hard to find a.
RSA is a widely used public-key encryption algorithm, based on the difficulty of factoring large numbers.
Key Concepts:
•Asymmetric encryption (public and private keys).
•Security relies on the difficulty of factoring large semiprimes.
Applications:
•Digital signatures
•Secure web browsing (HTTPS)
•Key exchange
Knapsack Algorithm (Merkle–Hellman Cryptosystem)
This is an asymmetric cryptographic algorithm based on the subset sum problem, a known NP-complete problem.
Basic Idea:
•Encrypt a message by treating it as a binary number and mapping it to a sum of selected weights (the knapsack).
•Decryption requires solving the subset sum with a known transformation.
How it Works:
1.Choose a superincreasing sequence W = [w1, w2, ..., wn]
2.Select modulus M > sum(W) and a multiplier R coprime with M
3.Generate public key B = [R × wi mod M for wi in W]
Encryption:
•Convert message to binary vector b = [b1, b2, ..., bn]
•Ciphertext = sum(bi × Bi)
Decryption:
•Multiply ciphertext by modular inverse of R mod M
•Solve the superincreasing knapsack problem to retrieve the bits
Status:
•Historically important but broken by more advanced attacks. Not used in modern cryptography.
DSA (Digital Signature Algorithm)
How It Works:
1.Key Generation:
•Choose large prime p, q (q divides p−1), and generator g
•Private key x, Public key y = g^x mod p
2.Signature Generation (for message m):
•Generate random k
•Compute r = (g^k mod p) mod q
•Compute s = (k^−1 * (H(m) + x*r)) mod q
•Signature = (r, s)
3.Signature Verification:
•Compute w = s^−1 mod q
•Compute u1 = H(m)*w mod q, u2 = r*w mod q
•Compute v = ((g^u1 * y^u2) mod p) mod q
•Signature is valid if v == r
Notes:
•DSA is not for encryption, only for signing.
•Secure if used with proper random k; otherwise, it can leak the private key.
ISDN (Integrated Services Digital Network)
ISDN is a set of standards for digital transmission of voice and data over ordinary
telephone copper wires.
Features:
• Supports both voice and data simultaneously.
• Provides higher quality and speed than analog systems.
Components:
• BRI (Basic Rate Interface): 2B+D channels (2 data + 1 control).
• PRI (Primary Rate Interface): 23B+D or 30B+D (varies by region).
Applications:
• Video conferencing
• Telemedicine
• Early internet access before broadband
Current Use:
• Largely obsolete, replaced by DSL, fiber, and VoIP systems.
MD5 (Message Digest Algorithm 5)
Algorithm:
1.Message is padded to a multiple of 512 bits
2.Initial buffer: 4 words (A, B, C, D)
3.64 operations organized into 4 rounds
4.Output: 128-bit hash (32 hexadecimal characters)
Example:
plaintext
Input: "hello" MD5: 5d41402abc4b2a76b9719d911017c592
Security:
•No longer secure — vulnerable to collision attacks.
•Should not be used for cryptographic purposes (e.g., password hashing).
•Use SHA-2 or SHA-3 instead.