First off, that is not a typo, I want to decrypt using a public key. The purpose for doing this is to challenge a third party to ensure they do, in fact, have the private key that corresponds to the public key. Basically, I would send some random data, they would encrypt it with their private key, I would decrypt it using the public key and compare the decrypted value to the random data that I sent. I believe this is a pretty standard procedure in public key crypto but for some reason decrypting with a public key seems to be taboo.
I am simply using the RSACryptoServiceProvider
in .NET 2.0. However, when I call Decrypt
it throws a CryptographicException
with message Bad Key
. The key is not bad (I can Encrypt
with no problem), but it appears as though it will not let me decrypt with just the public key. What gives? This must be possible to do.