Search code examples
identityserver4

Passing SSL certificate in AddSigningCredential(),getting X509 certificate does not have a private key.How can I resolve for this?


I think AddDeveloperSigningCredential() is not working for deployment.AddDeveloperSigningCredential() is only working for development environment. Therefore I use AddSigningCredential() for production environment, but getting certificate does not have a private key error in log file. How can I continue to resolve it? Please guide me. Thanks.

My code in IdentityServer Startup.cs enter image description here


Solution

  • You are searching for the certificate in StoreName.CertificateAuthority. How did you put the certificate there? Is it imported there without the private key. You can try to create a self-signed certificate in the StoreName.My. And search for it there instead. But if you already have a certificate to use you have to be sure to first export it from the original store and including the private key and then import in the store where you search for it.

    /Hans