Modern cryptography is based on publicly known mathematical algorithms that operate on binary bit sequences and utilitize secret keys. This section will describe concepts for the following three types of modern cryptography;

  • Symmetric (Secret Key) Cryptography – Same key is used to encrypt and decrypt
  • Asymmetric (Public Key) Cryptography – Key Pair (public key and private key) is used to encrypt and decrypt. 
  • Hashing (aka checksum) – One-way mathematical value computed to verify the data integrity of a message.

Symmetric (Secret Key) Cryptography Concepts: 

Symmetric Key Encryption
  • Advantage: Fast and efficient encryption of large amounts of data. Easy to implement at the hardware level.
  • Disadvantage: Single key is used for both encryption and decryption (potential for compromise).

Asymmetric (Public Key) Encryption Concepts:

Public Key Encryption

Public Key Encryption (cont) – Key Management:

  •  Public Key Infrastructure (PKI); a set of roles, policies, and procedures needed to create, manage, distribute, use, store and revoke digital certificates and manage public-key encryption. 
  • Private key – part of the asymmetric key pair that is used with a public key algorithm to provide assurance as to the integrity of information, 
  • Public Key Certificate – (aka digital certificate) – electronic document used to prove the ownership of a public key.
  • Certificate Authorities – entity that issues digital certificates to certify the ownership of a public keys

Public Key Infrastructure

Hashing Concepts:

  • Hash –  one-way encryption algorithm used on a message of any length to produce a fixed length hash number (aka checksum) which is used to verify the data integrity of message.  
  • Salt – random data added to hashed data, passwords or passphrases to safeguard passwords in plain text storage.
  • Password hash – Usually stored in the format $id$salt$hash in the etc/shadow file where the id identifies the hashing algorithm (e.g., MD4, MD5, SHA, XOR, etc)  
  • Message Authentication Codes (MAC) – short piece of information used to authenticate a message is from the stated sender (non repudiation)

CTF Evaluation Steps (advanced)

In a CTF. you will most likely get basic exercises like the following:

  1. basic substitution and XOR
  2. pseudo-random number generators
  3. stream and block ciphers, and their modes of operation
  4. message authentication codes
  5. Diffie-Hellman key exchange
  6. RSA (public-key cryptography)

Practice Challenge Platforms

  • TryHackMe – See the free ‘Encryption – Crypto 101’ module .  Includes instruction and challenges for novices.
  • PicoCTF – See the Cryptography section under the practice tab for challenges.  
  • CryptoPals –  site hosts the following eight sets crypto of challenging with solutions;  1) Basics; 2) Block crypto; 3) Block & stream crypto; 4) Stream crypto and randomness; 5) Diffie-Hellman ; 6) RSA and DSA; 7) Hashes; 8) Abstract Algebra
  • Cryptohack – Design for people also learning some python skills but most of the initial challenges can be done using web based tools.) 

Recommendations for CTF Challenges

  1. Focus on discovering patterns in the ciphertext to comprehend how encryption transpired.
  2. Unlike hashing, encryption is not a one-way process, so we can reverse it to obtain the plaintext.
  3. Brute force is the last choice during cryptanalysis, since modern ciphers can have extremely large key sizes. While solving these challenges, you should refrain from mindless brute forcing or using automated tools as far as possible.
  4. Instead, it is best to study the cryptosystem as intricately as possible and develop code breaking skills along the way.