I am trying to signin certificate (OpenIddict), but I get error when trying with thumbprint:
options.AddSigningCertificate(Configuration["Certificate"]/* db b9 12 .... 22 */);
and the error:
Application startup exception: System.Security.Cryptography.CryptographicException: OpenCSP failed with error code 2148073494.
in this line:
app.UseOpenIddict();
If I tried with X509Certificate2 I also get error:
var cert = new X509Certificate2(Configuration["Certificate"]/*path to file.cer*/);
options.AddSigningCertificate(cert);
and the error:
System.InvalidOperationException: The certificate doesn't contain the required private key.
in same line app.UseOpenIddict();
.
I am using the same certificate that I am using for https protocol. Is this OK?
My active tokens are randomly gone (and I get invalid_token when trying to refresh the token). I find somewhere that this happens if AddEphemeralSigningKey
is used, because when connection is dropped (because of IIS idle timeout), all tokens are lost. Because of that I am trying to use AddSigningCertificate
.
Is there another way? Can someone tell me, what is wrong with certificate? Thank you.
I am using ASP.NET Core 1.1.1.
I add read rights to IIS user for .cer file.