Cryptographic Solutions

Cryptography: Study of securing communication and data from adversaries.

Encryption: Process of converting plaintext into unintelligible ciphertext.

Key: Essential piece of information that determines the output.

Protect your keys!

  1. Store in secure hardware modules.
  2. Encrypt at rest.
  3. Transmit keys securely when used.
  4. Limit key access to regular audits and monitoring.

Symmetric vs Asymmetric

Symmetric (Private Key)

Symmetric: Uses single key.

Issues:

Common Algorithms

  1. Data Encryption Standard (DES): Breaks input into 64-bit blocks and uses transposition and substitution to create a ciphertext with effective key strength of 56-bits.
  2. Triple DES (3DES): Uses three separate keys to encrypt, decrypt, and then encrypt the plaintext into ciphertext to increase the strength of DES.11. 3DES applies the DES cipher algorithm three times to each data block. It uses three keys. It encrypts with Key 1, decrypts with Key 2, and encrypts with Key 3. The “decryption” step in the middle causes further scrambling if Key 2 is different from Key 1, while allowing backward compatibility with standard DES if all three keys are identical.
  3. International Data Encryption Algorithm (IDEA): Block cipher which uses 64-bit blocks.
  4. Advanced Encryption Standard (AES): Block cipher that uses 128/192/256-bit blocks and a matching encryption key size to encrypt plaintext into ciphertext. Strongest in this list.
  5. Blowfish: Block cipher that uses 64-bit blocks and a variable length encryption key.
  6. Twofish: 128-bit blocks and 128/192/256 bit encryption keys.
  7. RC Cipher Suite:

Asymmetric (Public Key)

Asymmetric: Uses two keys (one for encrypting, another for decrypting).

Example: Digital Signature

Hash ensures message integrity. Encrypting hash with sender’s private key gets non-repudiation. Encrypting message with receiver’s public key gets confidentiality.

Common Algorithms

  1. Diffie-Hellman: Used to conduct key exchanged and secure key distribution over an unsecure network. Used for key exchange inside of creating a VPN tunnel establishment as part of IPSec.
  2. RSA: Relies on mathematical difficulty of factoring prime numbers. Supports 1024 and 2048 bit keys.
  3. Elliptic Curve Cryptography (ECC): Heavily used in mobile devices, based on algebraic structure of elliptical curves over finite fields. Most commonly used for mobile devices and low computer-power devices. ECC with 256 bit key is just as secure as RSA with 2048 bit key.

Hybrid Implementation

Use asymmetric encryption to transfer a private key to do symmetric encryption (to get the speed benefits of symmetric encryption).

Stream v. Block Cipher

Stream Cipher: Utilizes a keystream generator to encrypt data bit-by-bit using a XOR function to create the ciphertext.

Block Cipher: Breaks input into fixed-length blocks of data and performs encryption on each block.

Hashing

One-way cryptographic function that takes an input and produces a unique message digest as its output.

  1. MD5: Creates 128-bit hash. Very prone to collisions.
  2. SHA Family:
  3. RIPEMD (RACE Integrity Primitive Evaluation Message Digest): Comes in 160-bit, 256-bit, and 320-bit versions. RIPEMD-160 is an open-source hashing algorithm that was created as a competitor to the SHA family.
  4. HMAC (Hash-based Message Authentication Code): Used to check integrity of a message and provide some level of assurance of its authenticity. Paired with other algorithms; e.g., HMAC-MD5, HMAC-SHA1, etc.

Increasing Hash Security

Pass the Hash Attack

Hacker authenticates with a remote server/service by using the underlying hash of a user’s password instead of the plaintext password. Mimikatz is a tool that automates the process of harvesting the hashes and conducting the attack. Defense: Only allow trusted Operating Systems to connect, Multi-Factor Authentication, least privilege.

Birthday Attack

When hacker is able to use a collision.

Defense

  1. Key Stretching: Technique used to mitigate a weaker key by increasing time needed to crack it.
  2. Salting: Adding random data to the data before hashing (thwarts dictionary, brute force, and rainbow attacks).
  3. Nonces: Stands for number used once, unique, often random number that is added to password-based authentication process. Basically the stored hash is always changing/ephemeral. Also defends against replay attacks where the attack is trying to record a successful authentication and play it back.
  4. Limit Failed Logins: Drastically increase security.

Public Key Infrastructure (PKI)

Entire system of hardware, software, policies, procedures, and people based on asymmetric encryption.

Example: Visiting a Website

When visiting a website for the first time, your browser will hit up a trusted third party for a copy of the website’s public key. Then the browser will generate a shared secret key for bulk symmetric encryption to transfer data back-and-forth. To do the key exchange, we will use an asymmetric encryption method (encrypt with public key and send to server for it to decrypt). After server has the shared secret key we can use symmetric encryption to efficiently send encrypted data back and forth across a tunnel (hybrid method, e.g., using AES to create a SSL or TLS tunnel). The asymmetric keys ensure authentication, the encrypted tunnel ensures confidentiality.

PKI and Public Key Cryptography are related but NOT the same.

Digital Certificates

Digitally signed electronic document that binds a public key with a user’s identity.

Certificates

Blockchain

Shared immutable ledger for recording transactions, tracking assets, and building trust.

Public Ledger: Record-keeping system that maintains participants’ identities in a secure and anonymous format.

Smart Contracts: Self-executing contracts where the terms of agreement or conditions are written directly into lines of code.

Permissioned Blockchain: Used for business transactions.

Encryption Tools

Trusted Platform Module (TPM)

Dedicated microcontroller designed to secure hardware through integrated cryptographic keys (e.g., Windows Bitlocker).

Hardware Security Module (HSM)

Physical device that safeguards and manages digital keys for mission critical situations like financial transactions.

Key Management Systems

Integrated approach for generating, distributing, and managing cryptographic keys for devices and applications.

Secure Enclave

Co-processor integrated in the main processor of some device designed with sole purpose of protecting information.

Obfuscation

Steganography

Concealing a message within another so the existence of a message is hidden.

Tokenization

Substituting sensitive data elements with non-sensitive equivalents (tokens) that have no meaningful value.

Example:

When using credit card, a merchant stores tokenized version of credit card details. Internally, the token the merchant is using will be just a string of random characters.

Data Masking

Ensure data is recognizable but does not include sensitive information.

Cryptographic Attacks

Techniques and strategies that adversaries employ to exploit vulnerabilities in cryptographic systems with intent to compromise the Confidentiality, Integrity, or Availability of data.

Downgrade Attacks

Aims to force a system to use a weaker/older cryptographic standard/protocol than it is currently using.

Example:

POODLE attack (Padding Oracle on Downgraded Legacy Encryption) made systems that supported TLS downgrade to SSL v3.0 (was provided for backwards compatibility) and exploit known vulnerabilities.

Defenses:

Collision Attacks

Aims to find two different inputs that produce the same hash output.

Birthday Attack: Probability that two distinct inputs will produce a collision.

Quantum Computing

Quantum computing is designed for very specific use cases and has enormous computation power. Cryptography relies on doing simple math problems to create a very complex thing; but quantum computers have been shown to be capable of breaking the asymmetric key exchange the entire PKI relies on.

Post-Quantum Cryptography: New kind of cryptographic algorithm that can be implemented using today’s classical computers but is also impervious to attacks from future quantum computers.

Methods:

  1. Increase key size to combat brute force (Works well for symmetric).
  2. Other approaches (e.g., lattice-based cryptography, super singular isogeny key exchange).

Current Post-Quantum Standards:


  1. 3DES applies the DES cipher algorithm three times to each data block. It uses three keys. It encrypts with Key 1, decrypts with Key 2, and encrypts with Key 3. The “decryption” step in the middle causes further scrambling if Key 2 is different from Key 1, while allowing backward compatibility with standard DES if all three keys are identical.↩︎

  2. SHA-2 uses 64 rounds of logical functions and modular additions for SHA-256, and 80 rounds for SHA-512.↩︎

  3. A wildcard certificate applies to the primary domain and all its first-level subdomains (e.g., *.domain.com covers mail.domain.com and www.domain.com).↩︎