IS QueBank
IS QueBank
→ The RSA algorithm is a public-key cryptography algorithm used for encrypting and
decrypting messages, as well as for digital signatures. It works by using a pair of keys: a
public key for encryption and a private key for decryption. The security of RSA relies on the
difficulty of factoring large integers.
Key Generation:
1. Choose two distinct prime numbers, p and q. For example, let p = 3 and q = 11.
2. Calculate n = p * q. This is the modulus and will be part of both public and private keys.
In our example, n = 3 * 11 = 33.
3. Calculate the totient of n, denoted as φ(n) = (p - 1) * (q - 1). In our example, φ(n) = (3 -
1) * (11 - 1) = 2 * 10 = 20.
4. Choose an integer e (public exponent) such that 1 < e < φ(n) and e is coprime to φ(n).
This means that the greatest common divisor of e and φ(n) is 1. For example, e = 7.
5. Calculate the modular inverse of e modulo φ(n) to find the private key d (private
exponent). This is such that (e * d) mod φ(n) = 1. In our example, d = 3.
Public Key: The public key is (e, n), which in our example is (7, 33).
Private Key: The private key is (d, n), which in our example is (3, 33).
Encryption:
1. The sender obtains the recipient's public key (e, n).
2. The sender converts the message (M) into a numerical value. For example, the message
"HELLO" could be converted to the numerical sequence 72, 69, 76, 76, 79.
3. The sender calculates the ciphertext (C) using the formula: C = M^e mod n. For example,
if the message is represented by the number 60, and the public key is (7, 33), then the
ciphertext would be 60^7 mod 33, which equals 60.
4. The sender sends the ciphertext (C) to the recipient.
Decryption:
1. The recipient receives the ciphertext (C).
2. The recipient uses their private key (d, n) to decrypt the ciphertext.
3. The recipient calculates the original message (M) using the formula: M = C^d mod n. For
example, if the ciphertext is 60 and the private key is (3, 33), then the original message
would be 60^3 mod 33, which equals 60.
Example:
1. Let's say Alice wants to send a message "HELLO" to Bob.
2. Alice uses her private key to generate her public key (e=7, n=33).
3. Bob converts "HELLO" to the number 60.
4. Bob uses Alice's public key (7, 33) to encrypt the message: 60^7 mod 33 = 60. The
ciphertext is 60.
5. Bob sends the ciphertext 60 to Alice.
6. Alice uses her private key (3, 33) to decrypt the ciphertext: 60^3 mod 33 = 60. The
original message is 60.
2. Explain modes of Block Cipher and CFB, OFB, and CBC in detail.
→ Block cipher modes of operation like CFB (Cipher Feedback), OFB (Output Feedback),
and CBC (Cipher Block Chaining) provide different ways to encrypt and decrypt data,
especially when dealing with longer messages than a single block. These modes are essential
for ensuring data security and integrity.
1) Cipher Block Chaining (CBC):
Mechanism:
CBC encrypts each block of plaintext by XORing it with the previous ciphertext block before
applying the encryption function. This chaining ensures that each ciphertext block depends on
the preceding ones.
Key Features:
● Error Propagation: A single bit error in a ciphertext block can affect the decryption of
subsequent blocks.
● Parallel Processing: Decryption can be parallelized, but encryption cannot.
● Padding: CBC typically requires padding to ensure that the plaintext length is a multiple
of the block size.
Use Cases:
CBC is commonly used in legacy systems and scenarios where security and data integrity are
paramount.
● 687 and 24
→ 687 ÷ 24 = 28 remainder 15
24 ÷ 15 = 1 remainder 9
15 ÷ 9 = 1 remainder 6
9 ÷ 6 = 1 remainder 3
6 ÷ 3 = 2 remainder 0
✅ GCD = 3
● 88 and 220
→ 220 ÷ 88 = 2 remainder 44
88 ÷ 44 = 2 remainder 0
✅ GCD = 44
● 84 and 320
→ 320 ÷ 84 = 3 remainder 68
84 ÷ 68 = 1 remainder 16
68 ÷ 16 = 4 remainder 4
16 ÷ 4 = 4 remainder 0
✅ GCD = 4
● 400 and 60
400 ÷ 60 = 6 remainder 40
60 ÷ 40 = 1 remainder 20
40 ÷ 20 = 2 remainder 0
✅ GCD = 20
5. Explain
● Kerberos
→ Kerberos is a protocol for authenticating service requests between trusted hosts across an
untrusted network, such as the internet. By providing a gateway between users and a
network, Kerberos helps verify the identities of users and hosts, and it keeps unauthorized or
malicious users out of a private network.
How It Works (Steps Simplified):
1. Login & Request Ticket:
User logs in → sends username to the Authentication Server (AS).
2. AS Sends Ticket Granting Ticket (TGT)
AS verifies identity → sends back encrypted TGT.
3. Request Service Ticket (ST)
User sends TGT to the Ticket Granting Server (TGS) to access a service.
4. Access Resource
TGS gives a Service Ticket → user shows it to the service → access granted.
Example:
You log in to your college portal once. Then you can access library, attendance, result pages
without logging in again = Kerberos ticket is working.
● X.509 Certificate
→ An X.509 certificate is a digital document that verifies the identity of an entity (like a
person, organization, or device) over the internet. It's a key component of the Public Key
Infrastructure (PKI) and is used to secure communication and transactions. Essentially, it acts
like a digital identity card, allowing users to verify the legitimacy of an entity they are
interacting with.
Purpose:
X.509 certificates are designed to establish trust and security in online communication and
transactions.
Content:
They contain information such as the entity's identity (name, organization, etc.), a public key, a
digital signature, and details about the Certificate Authority (CA) that issued it.
Function:
The public key allows secure encryption and decryption of data.
The digital signature ensures the integrity and authenticity of the data.
The CA's signature verifies the authenticity of the certificate itself.
Applications:
They are widely used in various applications like:
1. Secure web browsing (HTTPS).
2. Secure email (S/MIME).
3. Code signing.
4. Client authentication.
5. Government-issued electronic IDs.
Trust:
When a certificate is signed by a trusted CA, it can be relied upon to verify the identity of the
entity it represents.
● MD5
→ MD5 (Message Digest Method 5) is a cryptographic hash algorithm that generates a 128-
bit digest from a string of any length. The digests are represented as 32-digit hexadecimal
numbers.
Ronald Rivest designed this algorithm in 1991 to provide the means for digital signature
verification. Eventually, it was integrated into multiple other frameworks to bolster security
indexes.
The digest size is always 128 bits, and thanks to hashing function guidelines, a minor change in
the input string generates a drastically different digest. This is essential to prevent similar hash
generation, also known as a hash collision, as much as possible.
Example:
Input: "hello"
MD5 Hash: 5d41402abc4b2a76b9719d911017c592
Note:
● MD5 is fast but no longer secure
● Vulnerable to collision attacks (2 inputs giving same hash)
● SHA -512
→ SHA stands for secure hashing algorithm. SHA is a modified version of MD5 and used for
hashing data and certificates. A hashing algorithm shortens the input data into a smaller form
that cannot be understood by using bitwise operations, modular additions, and compression
functions. You may be wondering, can hashing be cracked or decrypted? Hashing is similar
to encryption, the only difference between hashing and encryption is that hashing is one-
way, meaning once the data is hashed, the resulting hash digest cannot be cracked, unless a
brute force attack is used. See the image below for the working of SHA algorithm. SHA
works in such a way even if a single character of the message changed, then it will generate
a different hash. For example, hashing of two similar, but different messages i.e., Heaven and
heaven is different. However, there is only a difference of a capital and small letter.
OR
SHA-512 is part of the SHA-2 family, which is more secure than MD5.
📌 Produces a 512-bit hash (64 bytes)
📌 Stronger and safer than MD5
Example:
Input: "hello"
SHA-512 Hash:
9b71d224bd62f3785d96d46ad3ea3d73319bfc... (very long 128-character hash)
6. What is PKI? How does it work?
→ PKI, or Public Key Infrastructure, is a system that uses digital certificates and public-key
encryption to securely exchange information and authenticate users, devices, and services. It
provides a framework for creating, managing, distributing, using, storing, and revoking
digital certificates, which are crucial for establishing trust and security in digital
communications.
What is a Public Key Infrastructure (PKI)? - essendi it
Here's how it works:
1. Key Pair Generation:
A user or entity generates a pair of cryptographic keys: a private key (kept secret) and a public
key (shared with others).
2. Certificate Authority (CA):
A trusted CA issues a digital certificate that binds the public key to a specific user, device, or
service.
3. Secure Communication:
When two parties want to communicate securely, they exchange their public keys, which are part
of their certificates.
4. Encryption and Decryption:
The sender encrypts the message using the recipient's public key, and only the recipient can
decrypt it using their corresponding private key.
5. Authentication:
The digital certificate ensures that the recipient knows the sender's identity and that the message
hasn't been tampered with.
In essence, PKI uses asymmetric encryption (public and private keys) to provide confidentiality,
authentication, and integrity for digital communications and transactions. It's widely used in
various applications, including secure web browsing (HTTPS), email encryption (S/MIME),
code signing, and IoT device authentication.
7. Explain Digital Encryption Standards (DES) in detail.
→ The Data Encryption Standard (DES) is a symmetric-key algorithm used to encrypt data
by transforming it into an unreadable format using a 56-bit key. It operates on 64-bit blocks
of data and was a widely used encryption standard, especially in the government and
financial sectors, before being largely replaced by more secure algorithms like AES.
Here's a more detailed breakdown:
● Symmetric-key: DES uses the same key for both encrypting and decrypting data,
meaning both the sender and receiver must have access to the key.
● Block cipher: DES processes data in fixed-size blocks (64 bits) at a time.
● Key size: While the initial key is 64 bits, only 56 bits are used for encryption.
● Encryption process: DES uses a series of substitutions, transpositions, and key mixing
operations within a 16-round Feistel structure to encrypt the data, according to a blog
post on Medium.
● Vulnerability: DES's 56-bit key length has been found to be vulnerable to brute-force
attacks, making it less secure for modern applications, says Simplilearn.com.
● Replacement: DES has been largely replaced by more secure algorithms like the
Advanced Encryption Standard (AES).
● Historical significance: Despite its vulnerabilities, DES played a significant role in the
development of cryptography and was the first encryption standard adopted by the U.S.
government.
Example (Conceptual):
Let’s say:
Plaintext = "HELLO123" → Converted into binary (64 bits)
Key = 56-bit symmetric key
After 16 rounds, we get the ciphertext (scrambled version)
To decrypt, we use the same key and go in reverse order of operations.
2. Security Measures:
Access Controls:
Implementing mechanisms to restrict access to information and resources based on roles and
permissions.
Authentication and Verification:
Verifying the identity of users and devices to ensure only legitimate individuals can access
systems and data.
Data Encryption:
Protecting sensitive data by converting it into an unreadable format, preventing unauthorized
access even if the data is intercepted.
Firewalls and Intrusion Detection/Prevention Systems:
Protecting networks and systems from unauthorized access and malicious activities.
Vulnerability Management:
Identifying and addressing security weaknesses in systems and applications.
Security Policies and Procedures:
Establishing guidelines and procedures for managing information security risks and ensuring
compliance.
5. Asset Management:
Information Asset Classification:
Categorizing information assets based on their sensitivity and importance, enabling appropriate
security controls.
Data Lifecycle Management:
Managing the lifecycle of information assets, from creation to storage, use, and disposal,
ensuring data security throughout.
9. In a system RSA algorithm with p=5 and q=11 is implemented for data security. What is
the value of the decryption key if the value of the encryption is 27? Also, verify that the
calculated value for the decryption key is correct.
→ The RSA algorithm (Rivest-Shamir-Adleman) is an algorithm used by modern
technologies to encrypt and decrypt messages.
It is asymmetric or public-key cryptography that uses two keys for encryption & decryption: a
Public key and a private key.
Benefits of CBC:
● Increased Security:
● By chaining the blocks, CBC makes it more difficult for attackers to exploit predictable
patterns in the ciphertext.
● Protection Against Known Plaintext Attacks:
● CBC is generally resistant to known plaintext attacks, where an attacker knows some of
the plaintext and tries to deduce the key.
● Widely Used:
● CBC has been a popular choice for symmetric encryption, particularly in older protocols
like TLS/SSL