Ticket #11565 (new enhancement)

Opened 23 months ago

Last modified 23 months ago

RSA Cryptosystem

Reported by: ajeeshr Owned by: mvngu
Priority: major Milestone: sage-5.10
Component: cryptography Keywords: RSA, crypto, public key encryption
Cc: nguyenminh2@… Work issues:
Report Upstream: N/A Reviewers:
Authors: Ajeesh Ravindran Merged in:
Dependencies: Stopgaps:

Description (last modified by leif) (diff)

The Rivest, Shamir and Adleman encryption system is a widely accepted public key encryption scheme. This was based on the thesis published by Minh Nguyen about Number Theory. The security depends on factoring Mersenne primes.

Attachments

rsa_cryptosystem.py Download (14.3 KB) - added by ajeeshr 23 months ago.
This is the python code I implemented in python. Just copy this into the public_key folder in crypto, import the class in this code into all.py in the public_key and re-build sage and run it in a worksheet, its simple!!!

Change History

Changed 23 months ago by ajeeshr

This is the python code I implemented in python. Just copy this into the public_key folder in crypto, import the class in this code into all.py in the public_key and re-build sage and run it in a worksheet, its simple!!!

comment:1 Changed 23 months ago by ajeeshr

  • Owner changed from tbd to mvngu
  • Component changed from PLEASE CHANGE to cryptography

comment:2 Changed 23 months ago by ajeeshr

  • Description modified (diff)
  • Milestone changed from sage-4.7.2 to sage-4.7.1

comment:3 Changed 23 months ago by tevinjoseph

well done, keep working

comment:4 Changed 23 months ago by leif

  • Description modified (diff)
  • Authors changed from ajeesh r to Ajeesh Ravindran

comment:5 Changed 23 months ago by nbruin

Just a few quick observations:

  • What is the intended use of the code one included in Sage? If it's for teaching you would probably want to expose more of the details. In fact, for educational purposes it's probably better to do the whole construction "in the open" instead of wrapping it in a class, unless the educational part is wrapping things in classes. For actual cryptographic use, one would probably prefer a whole protocol library. The algorithm is a very small part of deploying cryptography in a secure manner.
  • In your code you call euler_phi(n) to compute the private key d from e. Since the public key is (n,e), anyone could do that same calculation. That means that if it is doable for you to compute the private part of the key, then it is also doable for anyone. You don't have an advantage. (HINT: the key is that euler_phi computes the factorisation of n. If you would make sure that 2p-1 and 2q-1 are actually prime, you would know the factorization of n and hence euler_phi(n). But you should not call euler_phi(n), because that throws away your advantage).

comment:6 Changed 23 months ago by ajeeshr

Thank you nbruin. This was a valid information for me. I will correct it very soon. Keep supporting me in future also

Note: See TracTickets for help on using tickets.