0

I need to decrypt a message get using a public key in python. I know it is a bad practice and public key shouldn't be used for decryption, but a client demands it! I tried using pycryptodome, but it doesn't support decryption with public key. Is there any way I can use it for decryption? Or is there any other library that can do that ?

razieh babaee
  • 298
  • 5
  • 19
  • My understanding of rsa was that if it was encrypted with the public key it could be decrypted with the private key, and conversely using the private key to encrypt something would allow the public key to decrypt it. This might not be what you want, and I could also just be wrong but I would suggest trying to use the public key where the private key is normally used, as the algorithm should be the same. – Cmd858 Jul 12 '22 at 16:27
  • 1
    Actually, there is no *decryption with the public key*, but only encryption (context confidentiality) and verification (context signing). Decryption with the public key is not standardized, so there is no solid definition for an algorithm. It is either not supported by libraries at all or its logic is not uniformly implemented. So if there should be any chance to find a suitable Python library without guesswork, a specification of the counterpart, i.e. of the *encryption with the private key*, is needed, ideally the encryption code, preferably plus example (key pair, plaintext, ciphertext). – Topaco Jul 12 '22 at 18:53

0 Answers0