Настройка инструментов для веб-разработки
Decoding ciphers (KSB semester work) — part 1
Взлом шифров (KSB семестралка) - часть 2

Decoding ciphers (KSB semester work) — part 1

During my 5th semester, I worked on a semester project for KSB (Cryptography and Network Security). The project’s primary objective was to decrypt seven encrypted texts provided as part of the assignment.

According to the description provided in the Moodle system, the assignment details are as follows:

Instructions for Decryption

The original text (OT) is in English.
Before encryption, spaces, punctuation, and numbers were removed from the OT.
The following simple cryptographic transformations, discussed during exercises, were used for encryption:

  • Full grid cipher
  • Full grid cipher with a keyword
  • Double grid cipher
  • Caesar cipher (simple shift)
  • Affine cipher
  • Substitution cipher with a key
  • Vigenère cipher
  • Combinations of the above methods (a combination here refers to using one substitution and one transposition technique).

The order of tasks in the assignment does not necessarily correlate with their difficulty. To solve the tasks, you may use not only tools discussed during the exercises but also any other programs you create yourself or find online.
Please note that most programs available on the Internet are not always capable of delivering all required outputs.


Requirements for the Final Report

Prepare a final report containing the following details for each task:

  1. Original text (OT) as it appears directly after decryption (i.e., without spaces).
  2. OT with spaces between words added.
    • If you can reconstruct punctuation, feel free to include it.
  3. Precise identification of the cipher or combination of ciphers used.
    • Use the terminology covered in lectures/exercises.
  4. Precise identification of the encryption key:
    • For the Affine cipher: the coefficients AAA and BBB used during encryption.
    • For the monoalphabetic substitution cipher with a keyword: the keyword used for encryption.
    • For the monoalphabetic substitution cipher with a shift: the coefficient AAA used during encryption.
    • For the Vigenère cipher: the keyword used for encryption.
    • For the full grid cipher without a keyword: the dimensions of the grid used during encryption.
    • For the full grid cipher with a keyword: the dimensions of the grid + the numerical order of columns.
    • For the double grid cipher: the dimensions of both grids used during encryption.
  5. A brief description of the decryption process you followed.
  6. Electronically sign the final document using an X.509 certificate (instructions on obtaining a certificate are included in the description of the second semester project).
    • The signature can be created using tools such as Acrobat Reader.

The scoring for different types of tasks based on difficulty is as follows:

  • 1 point — Monoalphabetic substitution with shift, affine cipher, monoalphabetic substitution with a keyword
  • 2 points — Vigenère cipher, complete table without a keyword
  • 3 points — Complete table with a keyword, double transposition
  • 4 points — Any monoalphabetic substitution + simple table without a keyword
  • 5 points — Any monoalphabetic substitution + table with a keyword
  • 6 points — Any monoalphabetic substitution + double table
  • 7 points — Polyalphabetic substitution + any simple transposition
  • 8 points — Polyalphabetic substitution + double transposition

The total score will be 20 points.


Now, as an example, I will demonstrate how I decrypted one of the ciphers provided in the assignment.

Description

Ciphertext (CT):
OGCOCKNGBZGZZZXPVCJZONVZPGCXOZXXVZNOZZJVGDZRCYWMONXYYBQOVOXIQAXICJJCBQRKHONOIHXPDIZVZDNIJXYDJXZOGZOYZMJVIIIVVZWMVHCOMJZMXVAMXZAMCGJCZZAPJDTMMHCGHZMYJZWMCGZXNJVX

Original Text (OT):
THEOTHERWAGONSWERECRAMMEDTOOSTUHADNTSEENALLTHEPEOPLEINTHEMBUTHEHADSEENALLFIVEOFTHEHODGESFAMILYANDCHRISORTEGABROTHEROFCARLOSTHEVOLUNTEERAMBULANCEDRIVERCCCCCCCCCC

OT with spaces:
THE OTHER WAGONS WERE CRAMMED TOO ST U HADNT SEEN ALL THE PEOPLE IN THEM BUT HE HAD SEEN ALL FIVE OF THE HODGES FAMILY AND CHRIS OR TE GA BROTHER OF CAR LOS THE VOLUNTEER AMBULANCE DRIVER CCCCCCCCCC

Cipher Used:
Monoalphabetic Substitution with a shift, followed by Double Transposition Cipher.

Key:

  • Monoalphabetic Substitutionshift: 5
  • Columnar Transposition Cipher 1: 20×8 (rows x columns)
  • Columnar Transposition Cipher 2: 10×16 (rows x columns)


Decryption Process

1. Analyzing the Ciphertext:
First, I calculated the Index of Coincidence (IC), which was IC=0.06612. This suggested a monoalphabetic cipher with possible shift encryption. I used this website: https://kab-tool.vercel.app/

2. Breaking the Monoalphabetic Cipher with Shift:
Using frequency analysis diagrams (FA diagrams), I systematically tested shifts to determine the most overlap between expected and actual frequency distributions. The best match occurred at a shift of 5.

Decrypting the ciphertext with a simple shift of 5 yielded:
TLHTHPSLGELEEECUAHOETSAEULHCTECCAESTEEOALIEWHDBRTSCDDGVTATCNVFCNHOOHGVWPMTSTNMCUINEAEISNOCDIOCETLETDEROANNNAAEBRAMHTROERCAFRCEFRHLOHEEFUOIYRRMHLMERDOEBRHLECSOAC

3. Applying Double Transposition Cipher (DTC):

To accurately determine the cipher, you can use online tools for cipher identification. Test it on several identifiers first, and then proceed with decryption once you have identified the cipher.

  1. First Transposition:
    I used the Transposition Solver program and tested several table dimensions. I determined the correct dimensions as 20×8 (rows x columns). Reading column by column produced:
    TGAUALTAHMIOLNACHOMHLEHLEISTOTNCENMALIELHLOHSECCOSEDTNHFOYRETEECTWDNHTAIDATRHRDCHETTEHDVGNEOEARCEROSPESEEDGFVMICREOEEMEOSCACOBVCWCSEOBEFFHBALUECARTNPUNTARRRULRC
  1. Second Transposition:
    Using the result from the first transposition, I tested another grid size, settling on 10×16 (rows x columns). Reading column by column produced the final message:
    THEOTHERWAGONSWERECRAMMEDTOOSTUHADNTSEENALLTHEPEOPLEINTHEMBUTHEHADSEENALLFIVEOFTHEHODGESFAMILYANDCHRISORTEGABROTHEROFCARLOSTHEVOLUNTEERAMBULANCEDRIVERCCCCCCCCCC

The remaining ciphers are deciphered in approximately the same way.


How to Obtain an X.509 Certificate

  1. Visit the CESNET PKI Portal:
    Go to CESNET PKI Portal and select «Osobní certifikát» (Personal Certificate).
  2. Select Institution:
    Choose «Czech Technical University in Prague» and log in with your university access password.
  3. Generate the Certificate:
    After authentication, click «Vydat certifikát» (Issue Certificate). Your certificate will be generated in seconds.
  4. Install the Certificate (if needed for Thunderbird):
    If using Thunderbird, install the certificate manually following the instructions on the CESNET website.

How to Add an Electronic Signature and Timestamp to a Document

Adding an Electronic Signature

  1. Create the PDF:
    Export your document as PDF (e.g., from Word).
  2. Sign the PDF:
    Open it in Acrobat Reader. Go to Tools > Certificates > Digitally Sign. Place the signature box on the page.
  3. Use Your Certificate:
    Choose your certificate to sign the document.
  4. Enable Signature Verification (if needed):
    If Acrobat can’t verify the signature, go to Edit > Preferences > Signatures > Verification > Integration with Windows and enable both options.


Adding a Timestamp

  1. Register a Timestamp Authority (TSA):
    Go to Edit > Preferences > Signatures > Timestamp > Add. Enter a TSA name, such as Sectigo, and its URL (e.g., http://timestamp.sectigo.com/qualified). Use CTRL + K to open «Preferences«.
  2. Set as Default:
    Click OK and set it as the default TSA.
  3. Add the Timestamp:
    Go to Tools > Certificates > Timestamp to add the timestamp to the document.

Good luck!


If you have any other questions or ideas for what I could add, you can write me here.

More articles will be in this group.

Add a comment

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *