Public Key crypto Flashcards
modular inverse (additive vs multiplicative)
ex: 5 mod 7
Multiplicative question: “what can we multiply 5 by to get 1 mod 7?” (both numbers must share GCD of 1)
https://www.youtube.com/watch?v=FnQNbFl72LY
Additive question: “What number can add to 5 mod 7 that will result in a value of 0?”
primitve root check process
for given number p, choose number x.
Iterate x^n mod p (for n = 1 … n == p-1)
If all results are distinct and all results are less than p, the number is a primitive root.
https://www.youtube.com/watch?v=Ef6YcpmnIqs
EX: To check if 2 is a primitive root of 11:
2^1 mod 11 = 2
2^2 mod 11 = 4
2^3 mod 11 = 8
2^4 mod 11 = 5
2^5 mod 11 = 10
2^6 mod 11 = 9
2^7 mod 11 = 7
2^8 mod 11 = 3
2^9 mod 11 = 6
2^10 mod 11 = 1
totients
modular congruence
Congruence:
A == B mod(C)
means
A mod(C) = B mod(C)
For Example:
(26 mod 5 = 1) and (11 mod 5 = 1) so ….
(26 == 11 mod 5)
c = 7^27 mod 30
using totient function,
c =7 27mod ϕ(30) mod 30
ϕ30 = ϕ10 * ϕ3
ϕ10 = 4
ϕ3 = 2
ϕ30 = 8
so…
c =7 27mod 8 mod 30
c =7 3 mod 30
c = 343 mod 30
c = 13
theoretical basis for RSA
factoring a large number into two primes it very hard
RSA key lengths in practice
1024, 2048, 4096
RSA attributes
- plaintext treated as an integer and must be smaller than the keylength
- ciphertext block is the same as the key length
- supports both public key encryption and digital signatures
Why is RSA secure?
Factoring number at least 512 bits is very hard
issues with normal RSA
- deterministic mapping of plaintext -> ciphertext
- some characters lik 0, 1, -1 are always the same
- malleable on attacker side (can intercept and change ciphertext)
In practice random padding is prefixed to message. This addresses issues listed above
Diffie Hellman Key Exchange
Why is diffie hellman hard to break?
the exponent x is very hard to solve for
limitations of diffie hellman
- expensive exponentiation cycles that present DOS attack vulnerability (attacker requests a bunch of bogus key exchanges)
- it cannot be used for anything other than key exchange
- no authentication
Bucket Brigade attack
Diffie hellman mand in the middle attack
- Party A initiates a session with party B.
- Malicious middle man C sends their bogus Ya value to party B, andB thinks he received the real thing.
- The malicious actor then sends A his own computed Yb value.
- Then the session is in fact between A and C
- And session between B and C
solution to bucket brigade attack
publish Ya and Yb values at a public, trusted site.
or
sign Y values when sending to the other party