miércoles, 12 de septiembre de 2012

RSA authentication in Python

Hi!, for this week we need to implement an RSA authentication in Python for a client-server system with sockets, so I made 3 scripts, one script is the Server that has the following steps:
  • We need a listener wait for a client
  • Accept a socket
  • We need to load e and n from a file
  • Send a random number and send it to client
  • Compute a y = r^e%n
  • Check if we have the same value
  • We have a login

The other script is the Client that has the following steps:
  • Looking for a socket
  • We need to load d and n from a file
  • Compute y = f(x) and then r = y^d%n
  • Wait for login
Server



Client


Generator keys
Also I made a generator of keys, following the slides from the course.

This is how works my code, for example, if we need a new user:


User.dat = User d n


Claves-Server.txt = User e n 



But, if we try to login with a different user.



1 comentario: