jueves, 13 de septiembre de 2012

RSA Authentication

For this week, we had to do the following:
  •  Implement RSA authentication in Python for a client-server system with sockets.

Key generation
RSA involves a public key and a private key. The public key can be known to everyone and is used for encrypting messages. Messages encrypted with the public key can only be decrypted using the private key. 

So, the algorithm is:

    * Generate n = p × q, where both p and q are prime.
    * (e, n) is the public key; c = m^e mod n.
    * e is to be relatively prime with ɸ(n)
    * (d, n) is the private key; m = c^d mod n.
          o Requirement: e × d ≣ 1 mod ɸ(n) (or in other words d needs to be the inverse multiplicative of e);
    * ɸ(n) = (p - 1) × (q - 1).
    * m^(e×d)≣ m mod n due to Euler’s theorem.

 
These are the results.


Code RSAKeys: 






Server:



Cliente: 
 Here I have a difficult with of server, this is the code but it hasn´function

1 comentario:

  1. No elevar a exponentes directo (es indificiente) y además en "y = (int(request)**e)%n" no parece estar definida la variable request... Lo mismo ocurre en en cliente. La comunicación esperaría que pase con send() y recv() ... Van 4 pts.

    ResponderEliminar