The client encrypts the message using an X.509 certificate and sends the encrypted message to my web server. The client provided an X.509 certificate without a private key (exported as DER-encoded X.509 binary (.cer)). Now my task is to decrypt the message using the X.509 certificate that I have.
Whenever I try to decrypt a message, I get a "Private key does not exist" exception, which is expected because the certificate does not contain a private key. Is it possible to decrypt a message using an x.509 certificate without a private key?
Secondly, if the client provides the password separately for the certificate, I can create an instance of X509Certificate2 and use it to decrypt the message, for example:
X509Certificate2 c = new X509Certificate2("filename", "password");
Amey source
share