Illustrate the concept of security policy and mechanism with an example. Differentiate between block cipher and stream cipher. Explain the process of key expansion in AES.
Security policies and mechanisms play vital roles in the realm of information security. A security policy serves as a blueprint, articulating the regulations, recommendations, and procedures that guide an organization or system in safeguarding the confidentiality, integrity, and availability of its assets. On the flip side, security mechanisms encompass the technical or procedural tools and measures implemented to uphold and reinforce these policies. To illustrate this concept, consider the following example.
Example: Email Security Policy and Mechanisms
Security Policy:
A security policy is a statement of what is and what is not, allowed. This defines security for particular site/system. It ensures the confidentiality and integrity of email communication within the organization.
i. Encryption: All sensitive and confidential emails must be encrypted during transmission.
ii. Authentication: Users must authenticate themselves before accessing their email accounts.
iii. Access Control: Grant appropriate access levels to different users based on their roles and responsibilities.
iv. Anti-Phishing Measures: Implement mechanisms to detect and prevent phishing attacks.
v. Data Retention: Define policies for the retention and disposal of email data to comply with legal and regulatory requirements.
Security Mechanism:
Security mechanisms deal with prevention, detection, and recovery from a security attack. Prevention involves mechanisms to prevent the computer from being damaged. Detection requires mechanisms that allow detection of when, how, and by whom an attack occurred. Recovery involves a mechanism to stop the attack, assess the damage done, and then repair the damage.
- Transport Layer Security (TLS): Implement TLS to encrypt email traffic during transmission, preventing unauthorized access.
- Multi-Factor Authentication (MFA): Enforce MFA to enhance user authentication and prevent unauthorized access to email accounts.
- Role-Based Access Control (RBAC): Use RBAC to assign specific permissions and access levels to users based on their roles within the organization.
- Email Filtering and Anti-Phishing Tools: Deploy email filtering solutions to identify and block phishing attempts, malicious attachments, and suspicious links.
- Archiving and Retention Systems: Implement systems for archiving and retaining email data according to the defined policies.
Example:
An employee, Alice, needs to send a confidential report to her colleague, Bob. Following the email security policy:
• Alice accesses her email account using MFA.
• She encrypts the email containing the confidential report using TLS.
• The RBAC ensures that only authorized personnel have access to the confidential report.
• The email filtering system scans outgoing emails to prevent accidental leakage of sensitive information.
• The organization’s data retention policy ensures that the email is stored appropriately and retained for the required period.
In this example, the security policy provides a framework for safeguarding email communication, and the security mechanisms, such as TLS, MFA, RBAC, and email filtering, are the tools that enforce and support these policies, ensuring a secure and compliant email environment within the organization.
| Feature | Block Cipher | Stream Cipher |
| Basic Unit | Operates on fixed–size blocks of data | Operates on individual bits or bytes |
| ProcessingMode | Processes input data in fixed– size blocks | Processes input data one bit or byte at a time |
| EncryptionProcess | Divides plaintext into blocks and encrypts eachblock separately | Encrypts one bit or byte of plaintext at a time |
| Complexity | Generally more complex due to block–levelprocessing | Typically simpler as it operates on a continuousstream of data |
| MemoryRequirements | May require more memory for storing blocksduring processing | Typically requires less memory as it processes datain a continuous stream |
| ErrorPropagation | Errors in one block affect only that block, withlimited impact on subsequent blocks | Errors may propagate through the entire stream,affecting subsequent bits or bytes |
| Applications | Often used in situations where data can beprocessed in blocks, such as disk encryption andnetwork communication | Suitable for real–time communication systems,wireless communication, and scenarios where data iscontinuously generated |
| Examples | AES (Advanced Encryption Standard), DES(Data Encryption Standard) | RC4, A5/1, Salsa20 |
Key expansion stands as a pivotal phase within the Advanced Encryption Standard (AES) algorithm, facilitating the transformation of the initial key into a series of round keys essential for both encryption and decryption procedures. The process of AES key expansion comprises multiple steps, with variations contingent upon the chosen key size—whether 128, 192, or 256 bits.
1. Initial Round Key:
The original key of 128 bits is divided into four 32-bit words (4 words x 32 bits = 128 bits).
These four words become the initial round key.
2. Key Schedule Core:
For the key expansion process, a key schedule core is used. It involves three operations: RotWord, SubWord and XOR with a round constant.
3. SubWord Operation:
Each of the four words in the initial round key undergoes a SubWord operation.
SubWord substitutes each byte of the word with the corresponding byte from the AES S-box (a predefined substitution table).
4. RotWord Operation:
After the SubWord operation, a RotWord operation is performed on the word. RotWord rotates the word, shifting its bytes to the left.
5. XOR with Round Constant:
Each word is XORed with a round constant derived from the Rijndael key schedule.
The round constant is a value derived from the Rcon table, which contains values used for the key expansion process.
6. Generation of New Words:
Three new 32-bit words are generated by XORing the result of the RotWord, SubWord, and XOR operations with the previous three words of the expanded key.
7. Repeat:
Steps 3-6 are repeated until the key schedule has been expanded to the required number of rounds for the specific key size (10 rounds for a 128-bit key).
Describe the properties of hash functions. Discuss how hash value is generated using SHA-1 algorithm.
The Properties of hash functions are:
1. Determinism: A hash function is deterministic, meaning a given input will always produce the same output.
2. Uniformity: A good hash function should produce uniformly distributed outputs.
This means that the probability of any given work should be equal. This property is essential because it helps to avoid collisions, where different inputs produce the same result.
3. Non-reversibility: A hash function is non-reversible, meaning it is impossible to determine the input that produced a given output. This property is essential because it helps to ensure data security and confidentiality.
4. Fixed-size output: It produces a fixed-size output regardless of the input size. This property is essential because it enables efficient storage and retrieval of data.
5. Sensitivity to input changes: A slight change in the input to a hash function should produce a significant difference in the output. This property is essential because it helps to ensure data integrity, as even minor changes in the input will result in a different production.
6. Collision resistance: A good hash function should be resistant to collisions, which occur when different inputs produce the same output. Collision resistance is significant because it helps ensure data accuracy and reliability.
7. Speed: A hash function should be fast and efficient, as it is for real-time applications where speed is critical.
The SHA-1 (Secure Hash Algorithm 1) is a cryptographic hash function that produces a 160-bit hash value, typically represented as a 40-character hexadecimal number. Here is how the hash value is generated using the SHA-1 algorithm:
1. Padding:
- The input message is padded to ensure its length is congruent to 448 modulo 512.
- Padding involves appending a ‘1’ bit followed by a series of ‘0’ bits and then appending the length of the original message as a 64-bit integer.
2. Initialization:
SHA-1 initializes five 32-bit variables (A, B, C, D, E) with specific constant values. These variables are used as part of the processing.
3. Processing 512-bit Blocks:
The padded message is divided into 512-bit blocks. Each block is further divided into 16 32-bit words.
4. Round Operations:
SHA-1 operates in 80 rounds, each involving different bitwise operations, logical functions, and additions.
5. Word Expansion:
Each 512-bit block goes through a process called “word expansion” where the 16 words are expanded into 80 words through bitwise operations.
6. Main Rounds:
SHA-1 has three main rounds. The operations in each round are based on the majority, parity, and XOR functions.
Round 1: F (B, C, D) = (B AND C) OR ((NOT B) AND D) Round 2: G (B, C, D) = B XOR C XOR D Round 3: H (B, C, D) = (B AND C) OR (B AND D) OR (C AND D)
7. Update Variables:
After each round, the variables A, B, C, D, and E are updated based on the results of the operations.
8. Final Hash Value:
The final hash value is obtained by concatenating the variables A, B, C, D, and E in that order.
Each round of SHA-1 involves different constants and different operations on the variables. The variables A, B, C, D and E are updated after each processing.
Define challenge response system. Why do we need Kerberos?
A challenge-response system is a security mechanism designed to authenticate users or systems by presenting a challenge and expecting a valid response. This method is commonly used in authentication processes to fortify security measures. The fundamental purpose is to validate that the entity seeking authentication possesses specific knowledge or capabilities that are not easily replicated or intercepted by unauthorized parties.
By requiring a correct response to a unique challenge, this system adds an extra layer of protection, ensuring a more robust and secure authentication process.
Kerberos is a widely used network authentication protocol that provides secure authentication for users and systems in a networked environment. Here are several reasons why Kerberos is essential:
Single Sign-On (SSO):
Kerberos enables single sign-on, allowing users to authenticate once and obtain tickets that can be used to access various network services without the need to re-enter credentials. This improves user convenience and simplifies the authentication process. Centralized Authentication:
Kerberos operates on a client-server model with a centralized authentication server. This centralization enhances security by providing a single point for authentication and reducing the need for distributed password databases.
Mutual Authentication:
Kerberos ensures mutual authentication between users and services. Both the user and the service authenticate each other, reducing the risk of man-in-the-middle attacks. Ticket-Based Authentication:
Authentication in Kerberos is based on tickets. When a user authenticates, they receive a ticket that can be presented to access various services without re-entering credentials. This ticket is time-limited, enhancing security.
Secure Communication:
Kerberos uses encryption to secure the communication between clients and servers. This ensures the confidentiality and integrity of authentication information and other sensitive data exchanged in the network.
Authorization:
Kerberos tickets can include information about the user’s authorization level. This information is used by services to determine what actions the user is permitted to perform, enhancing access control.
Scalability:
Kerberos is scalable and suitable for large network environments. It efficiently handles authentication requests, making it well-suited for enterprises with numerous users and services.
Interoperability:
Kerberos is a widely adopted standard, making it interoperable with various operating systems and applications. It is supported by major platforms, including Windows, Unix, Linux, and macOS.
Reduced Password Exposure: Since users authenticate once to obtain tickets, there is a reduced need for entering passwords multiple times. This minimizes the risk of password exposure due to keyloggers or other password interception methods.
Support for Cross-Realm Authentication: Kerberos supports cross-realm authentication, allowing users from different Kerberos realms to authenticate and access resources across realms securely.
Show that Z 5is a field. John publishes the ElGamal public key (q, α, YA) =(101, 2, 14). Jane desired to send the secret message CSIT to John. Using the equivalence A = 0, B=1, … , Z=25, encrypt the message using John’s public key. Use a random number k = 4.
To show that Z 5is a field, we need to demonstrate that it satisfies the following properties:
1. Closure under Addition and Multiplication:
For any a, b in Z5 :
i. a + b ≡ c (mod 5) where c is an integer in the range 0 to 4.
ii. a · b ≡ d (mod 5) where d is an integer in the range 0 to 4.
2. Associativity of Addition and multiplication For any a, b, c in Z5 :
i. (a + b) + c ≡ a + (b + c) (mod 5).
ii. (a · b) · c ≡ a · (b · c)
3. Existence of Additive and Multiplicative Identity:
There exist element 0 and 1 in Z 5 such that:
i. a + 0 ≡ a (mod 5) for any a in Z5 .
ii. a · 1 ≡ a (mod 5) for any a in Z5 .
4. Existence of Additive and Multiplicative Inverse.
For any a in Z5 .
i. There exists –a in Z 5 such that a +(– a) ≡ 0(mod 5) a + (– a) ≡ 0 (mod 5).
ii. For any a in Z 5 (except 0), there exists a –1 in Z 5 such that a · a –1 ≡ 1 ( mod 5).
5. Commutative of Addition and Multiplication:
i. a + b ≡ b + a
ii. a · b ≡ b · a
All these properties show that Z 5 is a field.
Solution:
In the ElGamal encryption the public key is denoted as (q, α, YA ) where,
- q is a prime number,
- α is a primitive root modulo q,
- Y A is the public key corresponding to John’s public key.
Step 1:
Represent the message “CSIT” as a sequence of numbers using the equivalence A=0,
B=1, … , Z=25 as:
C = 2, S = 18, I = 8, T = 19.
Step 2:
- Choose a random number k = 4.
- Compute C 1 – α k mod q.
- Compute C 2 = (Y A k · M) mod q, where M is the numerical representation of the character
Now,
For “C”
- C 1 = 2 4 mod 101 = 16.
- C 2 = (14 4 · 2) mod 101 = 56.
For “S”:
- C 1 = 24 mod 101 = 16 (same random k).
- C 2 = (14 4 · 18) mod 101 = 82.
For “I”:
C 1 = 24 mod 101 = 16.
C 2 = (14 4 · 8) mod 101 = 37.
For “T”:
C 1 = 2 4 mod 101 = 16.
C 2 = (14 4 · 19) mod 101 = 92.
So, the cipher text pairs for the message CSIT are:
(C1 , C2 ) = {(16,56), (16,82), (16,37), (16,92)}.
Differentiate between Trojan horse and virus. Describe any two types of intruders.
| Feature | Trojan Horse | Virus |
| Nature | Non–self–replicating malicious software disguised aslegitimate software. | Self–replicating malicious code that attaches itselfto host files or programs. |
| Replication | Does not replicate on its own. | Replicates by attaching itself to other programs orfiles. |
| Method ofSpread | Generally requires user interaction to execute. | Spreads automatically through infected files orprograms. |
| Purpose | Typically used to create backdoors, stealinformation, or perform other malicious actions. | Designed to cause harm to data, software, or thesystem itself. |
| Visibility touser | Often disguised as legitimate or useful software. | May be noticeable through the presence ofunexpected behavior, file size changes, or systemslowdowns. |
| Activation | Activated when the user runs the infected program. | Activated when the infected file or program isexecuted. |
| Examples | Sub7, Zeus, Back Orifice. | Melissa, ILOVEYOU, Code Red. |
| PayloadDeliveryMethod | Generally delivered through social engineering,enticing users to download and execute themalicious file. | Typically spreads through infected emailattachments, shared files, or compromised websites. |
The two types of intruders are:
i. Masquerader:
The category of individuals that are not authorized to use the system but still exploit users’ privacy and confidential information by possessing techniques that give them control over the system, such category of intruders is referred to as Masquerader. Masqueraders are outsiders and hence they don’t have direct access to the system, their aim is to attack unethically to steal data/ information.
ii. Misfeasor:
The category of individuals that are authorized to use the system, but misuse the granted access and privilege. These are individuals that take undue advantage of the permissions and access given to them, such category of intruders is referred to as Misfeasor. Misfeasors are insiders and they have direct access to the system, which they aim to attack unethically for stealing data/ information.
The message “IMOGUN” was encrypted with a Playfair cipher using keyword “GALOIS”. Decrypt the message.
To decrypt the message ―IMOGUN‖ using the keyword ―GALOIS‖, we need to make matrix using the keyword:
| G | A | L | O | I |
| S | B | C | D | E |
| F | H | K | M | N |
| P | Q | R | T | U |
| V | W | X | Y | Z |
Now, break the encrypt message into pairs:
IM, OG, UN
How encryption is done using IDEA algorithm.
IDEA (International Data Encryption Algorithm) is a symmetric key block cipher that operates on 64-bit blocks of data using a 128-bit key. The algorithm consists of multiple rounds (typically 64 rounds for a 128-bit key) of substitution, permutation, and modular arithmetic operations. Here’s a simplified overview of the encryption process in IDEA:
Key Expansion:
- Subkey Generation:
- The 128-bit key is divided into eight 16-bit subkeys: K1, K2, …, K8.
Encryption Rounds (64 Rounds for a 128-bit Key):
- For each 64-bit block of plaintext (divided into four 16-bit blocks: X1, X2, X3, X4), the following operations are performed in each round:
- Substitution (S-Box):
- Each 16-bit block is substituted using a 16×16 substitution box (S-Box). The S-Box replaces each 4-bit nibble with another using a specific lookup table.
- Permutation (P-Box):
- The 64-bit block undergoes a permutation (P-Box) operation that shuffles the bits based on a predefined pattern.
- Key Mixing:
- The current 64-bit block is mixed with a subkey (Ki) using bitwise XOR.
- Modular Addition and Multiplication:
- Modular addition and multiplication operations are performed on the 64-bit block. Modular addition involves adding the result of the previous steps to the next 64-bit block. Modular multiplication involves multiplying the result by the next 64-bit block.
- Round Keys:
- The subkeys are used in a specific order for each round, and they are combined with the data in different ways.
- Final Round:
- After 64 rounds, a final permutation is applied to the data, resulting in the final encrypted block.
- Substitution (S-Box):
Describe the services provided by Pretty Good Privacy protocol to secure email.
PGP (Pretty Good Privacy) is a data encryption and decryption program that provides cryptographic privacy and authentication for data communication. It is primarily used for securing email communication. PGP offers a range of services to secure email, ensuring the confidentiality, integrity, and authenticity of the messages.
Here are the key services provided by PGP:
Encryption:
PGP uses asymmetric key cryptography to encrypt the content of emails. Each user has a pair of public and private keys. The public key is used for encryption, while the private key is used for decryption. When someone sends an email to a recipient, they encrypt the message using the recipient’s public key, ensuring that only the recipient with the corresponding private key can decrypt and read the message.
Digital Signatures:
PGP enables users to sign their emails using their private key. This creates a digital signature that provides authentication and verifies the origin of the message. Recipients can use the sender’s public key to verify the signature, ensuring that the email has not been altered in transit and that it indeed comes from the claimed sender.
Key Management:
PGP includes a key management system to handle the distribution, storage, and revocation of public keys. Users can exchange public keys through key servers or other secure methods. PGP also supports key revocation, allowing users to mark their keys as invalid if they are compromised or no longer in use.
Web of Trust:
PGP incorporates a decentralized trust model known as the “Web of Trust.” Users can authenticate the ownership of public keys by signing them with their private keys. This creates a network of trust, where users can trust the keys of others based on the endorsements from people they trust.
Compatibility: PGP is compatible with various email clients and platforms, making it widely applicable for securing email communication across different systems. It supports both text-based and MIME-encoded emails.
Compatibility with OpenPGP: PGP is an implementation of the OpenPGP standard, ensuring interoperability with other OpenPGP-compliant systems and tools. This allows users to communicate securely with individuals using different PGP implementations.
Secure Key Generation: PGP provides a secure key generation process, ensuring that the keys generated are sufficiently random and secure. This is crucial for the overall strength of the encryption.
What is the condition of for two integers, x and y, to be relatively prime? Find whether 61 is prime or not using Miller-Rabin algorithm.
Two integers, x and y, are said to be relatively prime (or coprime) if the greatest common divisor (GCD) of x and y is equal to 1.
In mathematical term, the condition for two integers x and y to be relatively prime is: GDC(x, y) = 1
Solution:
To check the number 61 is prime or not lets choose a random a such that 2 ≤ a ≤ 59. Let’s choose a = 2
Now, 2 60 mod 61 = 1
Since, 2 60 mod 61 is congruent to 1, the result says that 61 might be prime.
How direct digital signature different from arbitrated digital signature? How digital signature generation and verification is done using RSA.

RSA encryption/decryption can be used to generate and verify digital signatures. Digital signatures ensure the authenticity and integrity of a message or document. They also allow the receiver to verify that the message or document has not been tampered with since it was signed.
Digital Signature Generation
1. Hashing: The message or document is first hashed using a secure hash function, such as SHA-256. The hash value is a unique fingerprint of the message or document.
2. Encryption: The hash value is then encrypted using the signer’s private key. The encrypted hash value is the digital signature.
Digital Signature Verification
1. Decryption: The receiver decrypts the digital signature using the signer’s public key. This recovers the hash value.
2. Hashing: The receiver hashes the received message or document using the same hash function as the signer.
3. Comparison: The receiver compares the recovered hash value from the signature decryption to the hash value calculated from the received message or document. If the two hash values match, then the signature is valid and the message or document has not been tampered with.
Example:
Alice wants to send a message to Bob with a digital signature.
1. Alice hashes the message using SHA-256.
2. Alice encrypts the hash value using her private key. This is the digital signature.
3. Alice sends the message and the signature to Bob.
4. Bob decrypts the signature using Alice’s public key. This recovers the hash value.
5. Bob hashes the received message using SHA-256.
6. Bob compares the recovered hash value from the signature decryption to the hash value calculated from the received message. If the two hash values match, then the signature is valid and the message has not been tampered with.
Which one is more secure, monoalphabetic cipher or poly alphabetic cipher? Justify. Using rail fence cipher encrypt the text “LEARNING AND TEACHING ARE DIFFERENT” using 3 as rails.
Polyalphabetic ciphers are more secure than monoalphabetic ciphers. This is because monoalphabetic ciphers have a number of weaknesses that can be exploited to break them. One weakness of monoalphabetic ciphers is that they do not disguise the frequency of letters in the plaintext.
This means that an attacker can use frequency analysis to identify the most common letters in the plaintext and then use this information to guess the plaintext. For example, in English, the most common letter is “e”, so an attacker could guess that any cipher text letter that appears most frequently is the cipher text for “e”.
Another weakness of monoalphabetic ciphers is that they can be broken with relatively little cipher text. This is because the attacker can use statistical techniques to identify patterns in the cipher text that can be used to guess the plaintext. For example, an attacker could look for patterns in the lengths of words in the cipher text and then use this information to guess the lengths of words in the plaintext.
Polyalphabetic ciphers do not have these weaknesses. This is because they use multiple alphabets to encrypt the plaintext. This means that the frequency of letters in the plaintext is not disguised in any one cipher text alphabet, and it is therefore much more difficult for an attacker to use frequency analysis to break the cipher. Additionally, polyalphabetic ciphers can be broken only with a large amount of cipher text. This is because the attacker needs to identify all of the different alphabets that are used to encrypt the plaintext before they can start to guess the plaintext.
As a result of these weaknesses, monoalphabetic ciphers are no longer considered to be secure and are not used in practice. Polyalphabetic ciphers are much more secure and are widely used in modern cryptography.
Second Part
The Rail Fence Cipher is a transposition cipher that works by writing the message in a zigzag pattern across a number of rows. In this case, you want to encrypt the text “LEARNING AND TEACHING ARE DIFFERENT” using 3 rails. Original Text: LEARNING AND TEACHING ARE DIFFERENT
Why do we need discrete logarithm over normal logarithm? Find out whether 3 is primitive root of 7 or not.
We need discrete logarithm over normal logarithm because of the following:
Computational hardness: Discrete logarithms are computationally difficult to solve, while normal logarithms are relatively easy to compute. This makes discrete logarithms more suitable for cryptographic applications.
Applicability: Discrete logarithms are specifically designed for finite groups, while normal logarithms are applicable to a wider range of mathematical contexts.
Security: Discrete logarithms are preferred over normal logarithms in cryptography due to their computational hardness, which is crucial for ensuring the security of communication protocols and digital signatures.
Second part:
To find if 3 is primitive root of 7 or not, we calculate the powers of 3 mod 7 Now,
3 1 ≡ 3 (mod 7)
3 2 ≡ 2 (mod 7)
3 3 ≡ 6 (mod 7)
3 4 ≡ 4 (mod 7)
35 ≡ 5 (mod 7)
3 6 ≡ 1 (mod 7)
So, the powers of 3 mod 7 generates all the nonzero residues modulo 7 so 3 is a primitive root of 7.
