Cryptography Notes

Cryptography

3.1: What Is Cryptography?

  • Cryptography:
    • The use of mathematical operations to protect messages traveling between parties or stored on a computer.
  • Confidentiality:
    • Ensures that intercepted communications cannot be read.
  • Encryption for confidentiality:
    • The original purpose of cryptography.
  • Encryption and Ciphertext:
    • Encryption: A cryptographic process that turns plaintext into ciphertext (a seemingly random stream of bits).
    • Sender sends ciphertext to the receiver.
    • Eavesdroppers cannot understand the ciphertext.
    • Receiver decrypts the ciphertext back into plaintext.
  • Cipher:
    • A specific mathematical process used in encryption and decryption.
  • Key:
    • A random string of 40 to 4,000 bits.
  • Kerckhoffs’ Law:
    • Keeping keys secret is crucial for secure encryption.
  • Cryptanalysis:
    • The art of cracking encryption.
    • Simplest type: brute-force key cracking (trying all possible keys).
  • Types of Ciphers:
    • Substitution Ciphers:
      • Substitute one letter (or bit) for another.
      • Example: The cipher in Figure 3-2.
    • Transposition Ciphers:
      • Change the order of letters or bits without changing the letters/bits themselves.
    • Real-world ciphers use both substitution and transposition.
  • Ciphers vs. Codes:
    • Real-world ciphers mix transposition and substitution for randomness.
    • Ciphers can encrypt any message expressed in binary (1s and 0s).
    • Flexibility and speed make ciphers dominant for encryption today.
    • Codes:
      • More specialized, substituting one thing for another (e.g., word for word).
  • Symmetric Key Encryption:
    • Both parties encrypt and decrypt with the same key.
    • Key length:
      • Only the key needs to be kept secret for confidentiality.
      • Exhaustive search: trying all possible keys until success.

3.2: Symmetric Key Encryption Ciphers

  • Common well-tested ciphers:
    • RC4, DES, 3DES, and AES.
  • Other symmetric key encryption ciphers:
    • IDEA (especially in Europe).
    • SEED (in South Korea).
    • GOST (in Russia).
    • Camellia (in Japan).
    • Only a few have survived years of cryptanalysis.

3.3: Cryptographic System Standards

  • Cryptographic Systems:
    • A packaged set of cryptographic countermeasures for protecting dialogues.
    • Parties communicating need to use a specific standard.

3.4: The Negotiation Stage

  • Cipher Suite Options:
    • A specific set of security methods and options for a particular cryptographic system standard (e.g., SSL/TLS).
    • Includes methods and options for initial authentication, key exchange, and ongoing message confidentiality, authentication, and integrity.

3.5: Authentication: Supplicant, Verifier, and Credentials

  • Supplicant:
    • Wishes to prove its identity.
    • Credentials are proofs of identity (passwords, etc.).
  • Verifier:
    • Tests the credentials; accepts or rejects the supplicant.
  • Hashing:
    • A hashing algorithm is applied to a bit string of any length.
    • The result of the calculation is called the hash.
    • For a given hashing algorithm, all hashes are the same short length.
  • Hashing vs. Encryption:
    • Encryption:
      • Result length: About the same length as the plaintext.
      • Reversible: Yes. Decryption.
    • Hashing:
      • Result length: Short fixed length regardless of message length.
      • Reversible: No. There is no way to get from the short hash back to the long original message.
  • Hashing Algorithms:
    • MD5 (128-bit hashes) (should not be used because it has been shown to be unsecure).
    • SHA-1 (160-bit hashes) (should not be used because it has been shown to be unsecure).
    • SHA-2 (Name gives hash length in bits: SHA-224, SHA-256, SHA-384, and SHA-512).

3.6: The Keying Stage

  • Two types of ciphers used for confidentiality:
    • Symmetric key encryption:
      • The two sides use the same key.
      • For each dialogue (session), a new symmetric key is generated: the symmetric session key.
    • Public key encryption:
      • Each party has a public key and a private key that are never changed.
      • A person’s public key is available to anyone.
      • A person keeps his or her private key secret.
  • Diffie-Hellman key exchange:
    • Fast public key encryption.
    • Named for the two creators of public key encryption, who also created this keying method.

3.7: Message-by-Message Authentication

  • Message-by-message authentication can protect messages against man-in-the-middle and replay attacks.
    • Man-in-the-middle (MITM) attack:
      • Form of attack in which an attacker intercepts messages being sent between two parties and forward them on.
    • Replay attack:
      • Occurs when an attacker intercepts an encrypted message and transmits it again later.
  • Electronic signature:
    • Provides both authentication and message integrity.
    • Two common types:
      • Digital signatures.
      • Key-hashed message authentication codes (HMACs).
    • True party:
      • The person the supplicant claims to be.
  • Cannot use the sender’s public key:
    • It would always “validate” the sender’s digital signature.
  • Normally requires a digital certificate:
    • File provided by a certificate authority (CA).
    • The certificate authority must be trustworthy.
    • Digital certificate provides the subject’s (True Party’s) name and public key.
    • Don’t confuse digital signatures and the digital certificates used to test digital signatures!
  • Testing the Digital Signature:
    • The digital certificate has a digital signature of its own.
    • Signed with the Certificate Authority’s (CA’s) private key.
    • Must be tested with the CA’s well-known public key.
    • If the test works, the certificate is authentic and unmodified.
  • Checking the Valid Period:
    • Certificate is valid only during the valid period in the digital certificate (not shown in the figure).
    • If the current time is not within the valid period, reject the digital certificate.
  • Checking for Revocation:
    • Certificates may be revoked for improper behavior or other reasons.
    • Revocation must be tested.
    • Cannot be done by looking at fields within the certificate.
    • Receiver must check with the CA.
    • Verifier may download the entire certificate revocation list from the CA.
      • See if the serial number is on the certificate revocation list.
      • If so, do not accept the certificate.
    • Or the verifier may send a query to the CA.
      • Requires the CA to support the Online Certificate Status Protocol.
  • Also Brings Message Integrity:
    • If the message has been altered, the authentication method will fail automatically.
  • Digital Signature Authentication:
    • Uses public key encryption for authentication.
    • Very strong but expensive.
  • Key-Hashed Message Authentication Codes
    • An alternate authentication method using hashing.
    • Much less expensive than digital signature authentication.
    • Much more widely used.
  • Nonrepudiation:
    • Means that the sender cannot deny that he or she sent a message.
    • With digital signatures, the sender must use his or her private key.
      • It is difficult to repudiate that you sent something if you use your private key.
    • With HMACs, both parties know the key used to create the HMAC.
      • The sender can repudiate the message, claiming that the receiver created it.

3.8: Quantum Security

  • Quantum Mechanics:
    • Describes the behavior of fundamental particles.
    • Complex and even weird results.
  • Quantum Key Distribution:
    • Transmits a very long key—as long as the message.
      • A one-time key that will not be used again.
      • A one-time key as long as a message cannot be cracked by cryptanalysis.
      • If an interceptor reads part of the key in transit, this will be immediately apparent to the sender and receiver.
  • Quantum Key Cracking:
    • Tests many keys simultaneously.
    • If quantum key cracking becomes capable of working on long keys, today’s strong key lengths will offer no protection.

3.9: Cryptographic Systems

  • Cryptographic Systems
    • Combine all cryptographic protections, including confidentiality, authentication, and integrity into a single system.
    • Protect user dialogues from attackers and eliminate the need for users to understand the specific cryptographic details.
  • Virtual Private Networks (VPNs)
    • A VPN is a cryptographic system over an untrusted network (the Internet, a wireless LAN, etc.) that provides secure communication.
  • Host-to-Host SSL/TLS VPN
    • The PC only needs a browser. Nearly all PCs already have browsers. There is no need to install software on clients. This is the main benefit of SSL/TLS.
    • SSL/TLS works at the transport layer. Only protects applications that are SSL/TLS-aware (WWW and sometimes e-mail).
  • IP Security (IPsec) versus SSL/TLS
    • IPSec offers gold standard cryptographic security protections and supports central management whereas SSL/TLS does not.
  • IPsec Operation: Tunnel and Transport Modes
    • Transport Mode
      • Security within site network and on the Internet.
      • Significant setup costs: digital certificate, host configuration
    • Tunnel Mode
      • Security on the Internet.
      • No setup costs, no security within site network
  • Comparing IPsec Transport and Tunnel Modes
    • Transport Mode
      • No VPN gateway.
      • Protection from source host to destination host, including Internet and site networks.
      • High setup costs (digital certificates for each client).
      • Bad firewall friendliness (cannot filter encrypted content).
      • End-to-end security at high cost.
    • Tunnel Mode
      • Uses an IPsec VPN gateway.
      • Protection only over the Internet between IPsec gateways.
      • Low setup costs (only IPsec gateways need configuration).
      • Good firewall friendliness (can filter decrypted packets).
      • Low cost, protects the most dangerous part of the journey.
  • IPsec security association (SA)
    • An IPsec security association (SA) is an agreement about what security methods and options the two hosts or two IPsec gateways will use during their communication