Secret-Key Encryption Lab
Contents
Project Task Screenshots..........................................................................................................................2
Task 1:..................................................................................................................................................3
Task2:...................................................................................................................................................5
Task 3:..................................................................................................................................................6
Task4:...................................................................................................................................................7
Task 5:..................................................................................................................................................7
Task6:...................................................................................................................................................8
Task 7...................................................................................................................................................8
Observations............................................................................................................................................9
Task 1: Frequency Analysis.................................................................................................................9
Task 2: Encryption using Different Ciphers and Modes......................................................................9
Task 3: Encryption Mode – ECB vs. CBC..........................................................................................9
Task 4: Padding....................................................................................................................................9
Task 5: Error Propagation – Corrupted Cipher Text............................................................................9
Task 6: Initial Vector (IV) and Common Mistakes..............................................................................9
Task 7: Programming using the Crypto Library..................................................................................9
Code File Screenshots............................................................................................................................10
Project Task Screenshots
Task 1:
Task2:
]
Task 3:
Key and IV
Key: 00112233445566778889aabbccddeeff (hexadecimal)
IV for CBC: 0102030405060708 (hexadecimal)
Task4:
Task 5:
Task6:
Task 6.1
Task 6.2. Common Mistake: Use the Same IV
Task 6.3. Common Mistake: Use a Predictable IV
Task 7
Observations
Task 1: Frequency Analysis
Observation: Conducting frequency analysis on the monoalphabetic substitution cipher allowed me to
discern consistent patterns in character frequencies, facilitating the identification of frequently
occurring letters and providing insights into potential decryption strategies for the ciphertext.
Task 2: Encryption using Different Ciphers and Modes
Observation: Through experimentation with a range of encryption algorithms and modes, I observed
distinct variations in ciphertext output, illustrating the significant impact of cipher type and mode
selection on both the resulting encryption efficacy and overall security posture.
Task 3: Encryption Mode – ECB vs. CBC
Observation: Encrypting a straightforward picture file using both ECB and CBC modes unveiled stark
differences in ciphertext structure and susceptibility to information leakage. This underscored the
critical importance of thoughtful mode selection in safeguarding data confidentiality and integrity
during encryption processes.
Task 4: Padding
Observation: Examination of padding schemes across different encryption modes revealed diverse
requirements and behaviors, emphasizing the indispensable role of padding in ensuring proper
alignment of plaintext blocks and mitigating potential risks of information leakage inherent in block
ciphers.
Task 5: Error Propagation – Corrupted Cipher Text
Observation: Introducing corruption to a single bit within the encrypted file elucidated the distinct
error propagation characteristics exhibited by various encryption modes. This experiment underscored
the profound impact of mode selection on the resilience of data integrity, highlighting how different
modes respond to and mitigate corruption-induced challenges in plaintext recovery.
Task 6: Initial Vector (IV) and Common Mistakes
Observation: Engaging in experiments involving IV reuse and predictability underscored the critical
importance of employing unique and unpredictable IVs to uphold encryption security. This
highlighted the inherent risks associated with common pitfalls such as IV reuse and predictability,
which can compromise the confidentiality and integrity of encrypted data.
Task 7: Programming using the Crypto Library
Observation: Developing a program Decryption.c./ Script PY. aimed at recovering encryption keys
provided firsthand experience in applying cryptographic principles. This underscored the paramount
importance of meticulous key management and algorithm selection in ensuring robust encryption
security and preserving data confidentiality.
Code File Screenshots
Figure 1 Decrypt.c.
Figure 2 generate_key.py
Figure 3 freq.py
Figure 4 Script.py