Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing cryptographic schemes in sage.crypto #37305

Open
grhkm21 opened this issue Feb 12, 2024 · 1 comment
Open

Implementing cryptographic schemes in sage.crypto #37305

grhkm21 opened this issue Feb 12, 2024 · 1 comment

Comments

@grhkm21
Copy link
Contributor

grhkm21 commented Feb 12, 2024

Problem Description

As it is right now, sage.crypto does not have too many advanced features especially outside symmetric cryptanalysis. It would be great to improve on that.

Proposed Solution

I propose to include implementation of popular and basic cryptography primitives/schemes in that directory. It can serve as a reference implementation, and also help cryptographers prototype new advanced protocols easier.

For basic primitives, there are two directions. One direction is the "structural" side, for example creating classes for encryption schemes, OT, commitment schemes and others. The other direction is the "implementation" side, for example implementing a basic scheme using those classes.

Take encryption schemes as a concrete example. A class for a public key encryption scheme would have methods like .generate_key, .encrypt(msg, pk), .decrypt(msg, sk). An implementation can simply be wrapping around AES.

What do everyone think? Any strong opinion on whether to include this or not?

@grhkm21 grhkm21 changed the title Implementing popular cryptography schemes in sage.crypto Implementing cryptographic schemes in sage.crypto Feb 12, 2024
@vincentmacri
Copy link
Contributor

vincentmacri commented May 21, 2024

I don't have an opinion on how this should be implemented in Sage, but as someone who has used Sage to prototype new cryptographic schemes before, I do think something like this would be nice to have.

I think it would be nice if Sage implemented "toy" implementations (i.e. minimal effort put towards things like side-channel resistance, and not intended for real-world encryption use) of well-known cryptographic schemes (RSA, ECDH, and some of the new post-quantum schemes that are being standardized) to provide something to compare against for correctness if someone is trying to implement some well-known scheme with some improved algorithm.

vbraun pushed a commit to vbraun/sage that referenced this issue Aug 2, 2024
…ellman

    
Motivated by (but does not yet close) sagemath#37305. Closes sagemath#11568.

This PR adds a basic framework to add public key exchange schemes to
Sage, and includes an implementation of the Diffie-Hellman primarily as
an example of this new framework.

Open to suggestions to improve the structure of the code. This code was
based on the existing code for public-key encryption in Sage.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

None
    
URL: sagemath#38374
Reported by: Vincent Macri
Reviewer(s): grhkm21, grnx, Vincent Macri
vbraun pushed a commit to vbraun/sage that referenced this issue Aug 3, 2024
…ellman

    
Motivated by (but does not yet close) sagemath#37305. Closes sagemath#11568.

This PR adds a basic framework to add public key exchange schemes to
Sage, and includes an implementation of the Diffie-Hellman primarily as
an example of this new framework.

Open to suggestions to improve the structure of the code. This code was
based on the existing code for public-key encryption in Sage.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

None
    
URL: sagemath#38374
Reported by: Vincent Macri
Reviewer(s): grhkm21, grnx, Vincent Macri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants