Rob Wehrstein wrote:I'm working on a security app and want to use RSA to encrypt with a private key and decrypt with a public key.
Greg Charles wrote:I don't think this is possible.
Technically, in theory, it is possible, but it wouldn't be very useful. Basically, RSA encryption uses two keys -- that has a few properties.
First, given any key, it should not be possible to determine the other key in the pair. The algorithm that generate the keys generates the pair from a random number, and should not be reversible.
Second, encryption with either key can only be decrypted by the other key. It actually doesn't matter which key you make the public key -- just pick one as the public key and one as the private key. The public key can be released without any concern for security, while the private key should *never* be released.
So, encypting with the private key is not very useful, because the public key is ... well ... public, so anyone can decrypt the cipher text. The correct practice is to encrypt with the receiver's public key, so that the receiver can decrypt it with its private key.
Henry