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

Usage instructions for encryption with public key and decryption with private key? #2

Open
sgbaird opened this issue Nov 22, 2022 · 0 comments

Comments

@sgbaird
Copy link

sgbaird commented Nov 22, 2022

What I could gather is that there is functionality for signing an "unaltered message":

from rsa.key import PrivateKey
from rsa import pkcs1

q=1640646288909657487095359180022062734411738001375224362146789767743298223
e=65537
d=3932070503866894845499545149242528634855814001291977329776170446942801119476224356319257882634777292449414158422402140416944887130847435068069262510801361
p=4287309565142106169103473694063731192260977968066421817319213385543808560298868219
n=7033958527457273924268579824377868739560691183608262863345913379771000030685205506298398376078296576269289512487456279410830335887754385753052069093874837

privkey = PrivateKey(n, e, d, p, q)

signature = pkcs1.sign("hello".encode('utf8'), privkey, 'SHA-256')

print(signature)

(where the integers were generated via https://colab.research.google.com/drive/1uDH-Vqq5fdKBcKa-Ha9OfO3DBpf042CB?usp=sharing).

However, I'm not seeing a PublicKey class nor any decrypt options. Also, decrypt for PrivateKey seems to only take integers (?).

@sgbaird sgbaird changed the title Usage instructions? Usage instructions for encryption with public key and decryption with private key? Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant