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