You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
836B

  1. public class RSA {
  2. // p = 5, q = 11
  3. // RSA-Modul N = p * q = 55
  4. // Phi(N) = Phi(p)*Phi(q) | weil eigenschaft eulersche phi funktion und p,q teilerfremd
  5. // = (p-1)*(q-1) | p,q primzahlen, daher nur durch 1 und sich selbst teilbar und alle anderen teilerfremd
  6. // = 4*10 = 40
  7. // e: 1 < e < Phi(N) und ggT(e, Phi(N)) = 1
  8. // e elem aus {3,..} => e = 3
  9. // (e,N) = (3, 55) public key
  10. // -----
  11. // d: e*d kongr 1 mod Phi(N) => e*d mod Phi(N) = 1
  12. // 3*d mod 40 = 1
  13. // Durch probieren: d=27 => (27, 55) private key
  14. //
  15. // ----
  16. // Verschlüsseln
  17. // 13
  18. // c = m^e (mod N) => 13^3 (mod 55) = 52 = c
  19. // ----
  20. // Entschlüsseln
  21. // m = c^d (mod N) => 52^27 (mod 55) = 13 = m
  22. public RSA() {
  23. }
  24. }