Ticket #11565 (new enhancement)
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
Change History
Changed 23 months ago by ajeeshr
-
attachment
rsa_cryptosystem.py
added
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: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).
Note: See
TracTickets for help on using
tickets.

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!!!