CRY Flashcards
cryptography and cryptanalysis
- Cryptography is the science and study of secret writing
- Cryptoanalysis is the science and study of methods of breaking ciphers
Today:
- cryptography is the study of mathematical techniques related to aspects of information security, such as confidentiality, data integrity, entity authentication, and data origin authentication
Cryptography does not solve security problems; it just transforms them into other problems, which are hopefully easier to handle.
Law enforcement Key recovery Key escrow
- In many countries laws regulate how a law enforcement agency (LEA) can intercept traffic.
- Key recovery makes cryptographic keys available to their owner.
- Key escrow makes keys available to a LEA
cryptographic security
Cryptographic Security
- Unconditional Security
- Conditional Security
Unconditional Security
- Unconditional Security: System is secure even if adversary has unbounded computing power.
→ Security can be measured using information theory
Conditional Security
- Conditional Security: System can be broken in principle, but this requires more computing power than a realistic adversary would have.
→ Security can be measured using complexity theory
Cryptographic security services
- Data confidentiality: encryption hides the content of messages → only authorized users get the content
- Data integrity: integrity check functions (hash functions) detect changes to data → verify that data is correct & complete, or detect that this is not the case
- DOA: digital signatures and message MACs verify the source and integrity of data → verify that data is original and comes from a specific source, or detect that this is not the case
cryptographic hash functions
- often used for integrity checks
- apply hash function h to a document x and store the result h(x) in a secure place
- result h(x) is called “hash value”, “message digest” or “checksum”
- changes to x can be detected by re-computing the hash of x and comparing the result with the stored value
Definition hash function
hash function is a function h which has, as a minimum, following two properties
- Ease of computation: Given h and an input x, it is easy to compute h(x)
- Compression: the hash function maps inputs of arbitrary length to fixed length results
Note: hash function usually implies an unkeyed hash function.
a keyed hash function is a function h(x,k) that takes some arbitrary-length input x and a fixed-length key k as input
Manipulation detection codes (MDCs)
Used to detect changes to a document; unkeyed hash
Two types of MDCs:
- One-way hash function (OWHF): finding an input which hashes to a pre-specified hash-value is difficult
- Collision resistant hash function (CRHF): finding any two inputs having the same hash value is difficult
Message authentication codes (MACs)
Used to assure both the source of a message and its integrity; keyed hash function
Security properties of hash functions (see HAC)
- Pre-image resistance (one-way): for any given y, it is computationally infeasible to find x so that h(x)=y
- 2nd pre-image resistance: given x, it is computationally infeasible to find x’, x ≠ x’, so that h(x)=h(x’)
- Collision resistance: it is computationally infeasible to find x and x’, x ≠ x’, so that h(x)=h(x’)
Properties of one-way functions
Hash functions
OWHF:
- ease-of-computation, compression,
pre-image resistance, 2nd-preimage resistance - One-way functions can e.g. be used for storing passwords
CRHF:
- ease-of-computation, compression, 2nd-preimage resistance, collision resistance
- Collision resistance implies 2nd-preimage resistance
- In practice, CRHF usually are preimage resistant as well
- Some pathological examples are collision resistant but not preimage resistant
Well known hash functions: SHA-1, RIPEMD-160, MD5
Properties of cryptographic hash functions
Checksums
The result of applying a hash function is called hash value, message digest, or checksum.
The last term creates frequent confusion:
- In communications, checksums often refer to error correcting codes, typically a cyclic redundancy check (CRC).
- Checksums used by anti-virus products, on the other hand, must not be computed with a CRC but with a cryptographic hash function.
Note: A cyclic redundancy check (CRC) is not a cryptographic hash function: CRC’s are designed for detecting transmission errors
Some use cases of crytographic hashes (OWHF, CRHF)
CRHF:
- Verification of data integrity, signatures
- File identification (P2P, git)
OWHF:
- Password Storage
- Key derivation
Birthday paradox
- Given an n-bit hash y, the expected number of tries before an x with h(x)=y is found is 2n.
- Given n-bit hash values, a set of 2n/2 inputs is likely to contain a pair causing a collision
- Birthday paradox: put m balls numbered 1 to m into an urn; draw a ball, list its number, and put it back; repeat; for m → ∞, the expected number of draws before a previously drawn number appears is
√0.5*π*m
Complexity of brute-force attacks
Output size of hash function: n bit Pre-image and 2nd pre-image:
- Average complexity: O(2n)
Collision: birthday „attack“:
- Average complexity: O(20.5n)
Illustration of complexity:
1 Gops/s, 100 parallel ops/unit, 1000 units:
264 ops in about 50 hours
280 ops in about 380 years
2128 ops in about 1017 years
Construction Hash function
Pattern for the design of fast hash functions:
- The core of the hash function is a compression function f that works on fixed size input blocks.
- An input x of arbitrary length is broken up into blocks x1,…, xm of the given block size; the last block has to be padded.
- Compute the hash of x by repeatedly applying the compression function: with a (fixed) initial value h0, compute hi = f(xi||hi-1) for i=1,…, m and take hm as the hash value of x.
The symbol “||” denotes concatenation.
Hash Functions: A Typical Architecture
Hash function constructions examples
Current generation: SHA-512
- Whirlpool, …
SHA-3 (Keccak)
What if input data is not a multiple of compress function input data size n?
Trivial padding: add as many 0-bit as necessary to obtain a multiple of n (Example: n=64)
- „0x45“ => „0x4500000000000000“
- „0x4500“ => „0x4500000000000000“
- Result: H(„0x45“) = H(„0x4500“)
Improved padding: add 1 single 1-bit and, after that, as many 0-bit as necessary to obtain a multiple of n
- „0x45“ => „0x4580000000000000“ „0x4500“ => „0x4500800000000000“ Result: H(„0x45“) ≠ H(„0x4500“)
MD-Strengthening:
MD-Strengthening:
- Add as many 0-bit as necessary to obtain a multiple of n
- Add another block that encodes the full message length
- Avoids simple 2nd preimage attack
Some additional benefits
- Avoids long message attacks
Avoids fixed-point attacks
Avoids trivial collisions for free choice of IV
Input Message Size: Padding
Padding as defined for MD5, SHA-1, SHA-224, SHA-256
- Add a single 1-bit, then as many 0-bit as necessary to obtain input size congruent 448 (mod 512)
- Add a 64-bit word indicating total input data size (mod 264)
SHA-384/SHA-512:
- Same idea, but 1024 bit blocks and 128 bit for length
Message Authentication Codes
Cryptographic Hash:
- Do not depend on any secret key
- I.e., anyone key calculate the hash
- For integrity checks, hash values have to be protected!
Message Authentication Code (MAC)
- Similar to cryptographic hash
- But: dependent on a secret key
- Knowledge of key necessary for calculating (or verifying) the message authentication code
- keyed hash function for data origin authentication
Message authentication codes (2)
Simple constructions:
- “secret prefix”: calculate h(k || m)
- “secret suffix”: calculate h(m || k)
- “secret envelope”: calculate h(k1 || m || k2)
Message authentication codes (3)
HMAC construction: take a hash function h, for a key k and a document x, compute
HMAC(x) = h(k × o_pad || h(k × i_pad || x))
(i_pad, o_pad are padding fields, “||“ means concatentation)
Encryption
Encryption algorithms (ciphers) protect the confidentiality of data
Some encryption algorithms can also be used for integrity checks
A plaintext (clear text) x is converted into a ciphertext under the control of a key K
- we write eK(x)
Decryption with an appropriate key computes the plaintext from the ciphertext
- we write dK(x)
Symmetric key encryption
Symmetric key encription
Cryptoanalysis
Cryptanalysis: science of recovering the plaintext from ciphertext without the key.
Always assume attackers know the algorithms used
- Algorithms can be published to facilitate the evaluation of their security
- Security should depend on secrecy of the key, not the algorithm
Contrast with security by obscurity.
- Analogy: Hide a letter under your mattress versus lock it in a safe, whose design has been published and whose locking mechanism has withstood attacks from the world’s best safecrackers.
Defining Security with Games
Games are frequently used to model formal security properties!
- Cryptosystem is considered secure if no adversary can win the game with significantly greater probability than an adversary who just guesses randomly
Model of Attack
We can think of the adversary as playing a game:
- Input: Whatever adversary necessarily knows from the beginning, e.g., public key, distribution of plain texts, etc.
- Oracle: Models information adversary can obtain during an attack. Different kinds of information characterise different types of attacks.
- Output: Whatever the adversary wants to compute, e.g., secret key, partial information on plain text, etc. He wins if he succeeds.
Attacks
- Cyphertext Attack
Given: eK(x1), eK(x2) …
Goal: deduce x1, x2 ,…, or K
- Known Plaintext Attack
Given: (x1, eK(x1)), x2, eK(x2)), … Goal: deduce K - Chosen Plaintext Attack
like 2, but the attacker can choose xi - Adaptive Chosen Plaintext Attack
can not only choose plaintext, but can modify the plaintext based on encryption results - Chosen ciphertext
Attacker can chose different ciphertexts to be decrypted and gets access to the decrypted plaintext.