All exams← All Certified Ethical Hacker (CEH) notes

Cryptography: Certified Ethical Hacker (CEH) revision notes

Revision notes

## Introduction to Cryptography

Cryptography is the practice and study of techniques for secure communication in the presence of adversarial behavior. It aims to achieve four primary security goals:

  • Confidentiality: Keeping information secret from unauthorized individuals.
  • Integrity: Ensuring that information has not been altered or tampered with.
  • Authentication: Verifying the identity of a user, process, or device.
  • Non-repudiation: Preventing an entity from denying previous actions or commitments.

## Types of Cryptographic Algorithms

Symmetric-Key Cryptography

  • Uses a single shared secret key for both encryption and decryption. This key must be securely exchanged between communicating parties.
  • Advantages: Very fast and efficient for encrypting large amounts of data.
  • Disadvantages: The secure distribution and management of the shared key is a significant challenge.
  • Algorithms: AES (Advanced Encryption Standard) is the current industry standard, supporting 128, 192, and 256-bit keys. DES (Data Encryption Standard) and 3DES (Triple DES) are older and less secure, primarily for legacy systems.

Asymmetric-Key (Public-Key) Cryptography

  • Uses a pair of mathematically linked keys: a public key (freely shared) and a private key (kept secret by its owner).
  • Advantages: Solves the key distribution problem, enables digital signatures, and facilitates secure key exchange for symmetric encryption.
  • Disadvantages: Significantly slower than symmetric encryption, making it unsuitable for bulk data encryption.
  • Algorithms: RSA (Rivest-Shamir-Adleman) is widely used for encryption, digital signatures, and key exchange. ECC (Elliptic Curve Cryptography) provides comparable security with smaller key sizes, making it efficient for mobile and constrained environments.

Hashing

  • A one-way function that transforms input data of any size into a fixed-size string, called a hash value or message digest.
  • Purpose: Primarily used for integrity checking (detecting data tampering) and secure password storage.
  • Properties: Deterministic (same input always yields same output), computationally infeasible to reverse, and collision resistance (extremely difficult to find two different inputs that produce the same hash).
  • Algorithms: SHA-256 (Secure Hash Algorithm 256) is widely used. MD5 (Message Digest 5) and SHA-1 are considered cryptographically broken due to known collision vulnerabilities and should not be used for new applications.

## Digital Signatures and PKI

  • Digital Signatures: Provide integrity, authentication, and non-repudiation. They are created by hashing a document and then encrypting that hash with the sender's private key. The signature is verified using the sender's public key.
  • Public Key Infrastructure (PKI): A framework that manages digital certificates and public-key encryption. It binds public keys with respective user identities through a Certificate Authority (CA). X.509 is the standard for digital certificates.

## Cryptographic Attacks

  • Brute-force attack: Trying every possible key until the correct one is found.
  • Known-plaintext attack: Attacker has access to both plaintext and its corresponding ciphertext.
  • Chosen-plaintext attack: Attacker can choose arbitrary plaintexts to be encrypted and obtain the corresponding ciphertexts.
  • Frequency analysis: Exploiting statistical patterns in ciphertext to deduce the plaintext (e.g., common letters in a language).
  • Side-channel attacks: Exploiting information leaked from the physical implementation of a cryptosystem (e.g., timing, power consumption, electromagnetic radiation).

Key facts

Flashcards

What are the four core security goals achieved by cryptography?
Confidentiality, Integrity, Authentication, and Non-repudiation (CIAN).
tap to reveal
Which type of cryptography uses a single shared key for both encryption and decryption?
Symmetric-key cryptography.
tap to reveal
Name a widely used symmetric encryption algorithm that is considered current and secure.
AES (Advanced Encryption Standard).
tap to reveal
Which type of cryptography uses a public/private key pair?
Asymmetric-key (or Public-key) cryptography.
tap to reveal
What is the primary purpose of a cryptographic hash function?
To ensure data integrity (detect unauthorized alterations) and for password storage.
tap to reveal
What cryptographic primitive provides integrity, authentication, and non-repudiation?
Digital signatures.
tap to reveal
What standard defines the format for digital certificates in a Public Key Infrastructure (PKI)?
X.509.
tap to reveal
Why are MD5 and SHA-1 considered insecure for new cryptographic applications?
They are vulnerable to collision attacks, meaning different inputs can produce the same hash output.
tap to reveal
Practice questions

Cryptography: 5 practice questions

Q1. Which of the following is a fundamental characteristic of symmetric-key cryptography?
  • A.  It uses a single, shared secret key for both encryption and decryption.
  • B.  It uses two different but mathematically related keys for encryption and decryption.
  • C.  It relies on a Public Key Infrastructure (PKI) for key distribution.
  • D.  It is primarily used for creating digital signatures to ensure non-repudiation.
Show answer & explanation
✓ Answer: A. It uses a single, shared secret key for both encryption and decryption.
Symmetric cryptography, like AES, uses one shared key for both encrypting and decrypting data, making it fast but posing a key distribution challenge.
Q2. An ethical hacker wants to verify the integrity of a downloaded firmware file by comparing its calculated value to the one provided by the vendor. Which cryptographic function is most suitable for this purpose?
  • A.  Asymmetric encryption (RSA)
  • B.  Steganography
  • C.  Hashing (SHA-256)
  • D.  Symmetric encryption (AES)
Show answer & explanation
✓ Answer: C. Hashing (SHA-256)
Hashing creates a unique fixed-size fingerprint of data. Comparing the hash of a downloaded file to the original ensures it has not been altered during transit.
Q3. How is a digital signature correctly created to provide authenticity, integrity, and non-repudiation for a message?
  • A.  A hash of the message is encrypted with the sender's private key.
  • B.  The message is encrypted with the recipient's public key.
  • C.  The entire message is encrypted with a shared symmetric key.
  • D.  A hash of the message is encrypted with the recipient's public key.
Show answer & explanation
✓ Answer: A. A hash of the message is encrypted with the sender's private key.
A digital signature involves hashing the message and then encrypting that hash with the sender's private key. It can be verified by anyone with the sender's public key.
Q4. A 'birthday attack' is a type of cryptanalytic attack that exploits probability theory to find collisions. This attack is most effective against which of the following?
  • A.  Key exchange protocols like Diffie-Hellman
  • B.  Asymmetric encryption algorithms like RSA
  • C.  Symmetric block ciphers like AES
  • D.  Hashing algorithms like SHA-1 or MD5
Show answer & explanation
✓ Answer: D. Hashing algorithms like SHA-1 or MD5
The birthday attack exploits the mathematics behind the birthday problem to find collisions in hash functions more quickly than a brute-force attack would.
Q5. Within a Public Key Infrastructure (PKI), which component is primarily responsible for verifying an individual's identity before a certificate is issued by the Certificate Authority (CA)?
  • A.  Certificate Revocation List (CRL)
  • B.  Registration Authority (RA)
  • C.  Subordinate Certificate Authority
  • D.  Online Certificate Status Protocol (OCSP) Responder
Show answer & explanation
✓ Answer: B. Registration Authority (RA)
The Registration Authority (RA) is the PKI component that acts as a verifier for the CA. It performs the necessary identity checks on the entity requesting a certificate.
Test yourself
See the Certified Ethical Hacker (CEH) page

More Certified Ethical Hacker (CEH) topics