Decrypting using either RSAKeys
KenV1040 opened this issue · comments
Hello,
Looking through the documentation and examples, I can't find a way of decrypting an RSA encrypted message with someone's public key, since the decrypt function specifically specifies RSAPrivateKey. This function would be useful for when implementing end-to-end encryption where the sender encrypts with their private key, and the other receiver decrypts with the sender's public key. Is it possible for you to implement this feature? And hopefully also on the encryption function as well so it supports encrypting/decrypting with both RSAPublicKey and RSAPrivateKey.
Thanks!
Edit: I just made my own function to do this, so no need to rush this
Hmmm...
You should never be able to decrypt with a Public Key. That's one of the core tenets of asymmetric encryption.
But isn't the whole purpose of signing involves decrypting with public key?
You encrypt with a publicKey. Decrypt with a privateKey.
If you could decrypt with the same key that you encrypt with, it's no longer asymmetric. It's a symmetric algorithm.