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

How can I use RSA_private_encrypt in cryptography when I migrate from M2Crypt? #11591

Open
hirorogithub opened this issue Sep 13, 2024 · 2 comments
Labels
Stale waiting-on-reporter Issue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply.

Comments

@hirorogithub
Copy link

python 3.11/2.7
cryptography: just pip install latest version

I have some code implement by M2Crypto`s RSA, which has used rsa private key to encrypt data.

I know that in general, the signature function should be used directly, but I can only migrate the logic in the original way.
I tried to use sign+prehashed to bypass the hash algorithm that sign must provide, attempting to implement private encryption, but this does not seem to work.
I checked the source code of M2Crpto. RSA_private_encrypt is provided by openssl. It seems that cryptography does not support this function now? How can I implement it?

@alex
Copy link
Member

alex commented Sep 13, 2024

To migrate your code, you'll need to establish which padding mode you're using, and then convert that to the equivalent pyca/cryptography API: https://cryptography.io/en/latest/hazmat/primitives/asymmetric/rsa/#signing

@alex alex added the waiting-on-reporter Issue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply. label Sep 13, 2024
Copy link

This issue has been waiting for a reporter response for 3 days. It will be auto-closed if no activity occurs in the next 5 days.

@github-actions github-actions bot added the Stale label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale waiting-on-reporter Issue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply.
Development

No branches or pull requests

2 participants