Java – public key encryption and private key encryption
I implemented asymmetric encryption in the project, using "public key" to "Encrypt" messages and "private key" to "decrypt" messages
Have we ever used "private key" to "Encrypt" messages and "public key" to "decrypt" messages If so, someone can give me a use case. This cryptography is also called "asymmetric encryption"
Solution
As for the term encryption, which is considered to be on the message itself, the answer is no, because such encryption is completely useless Because the public key should be public, everyone can decrypt it Therefore, private key encryption cannot provide confidentiality
On the other hand, signature, as others have mentioned, is the only use case It does not apply encryption to the actual payload (message) It uses different padding schemes to encrypt the encrypted hash on the message (which can be reproduced only from the same message) In this way, you can ensure that the actual party with the private key signs the message