IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

Signing Key Rollover

Open rexdefuror opened this issue 9 years ago • 2 comments

Hey everyone,

First of, I have to say that you did a most amazing job of IDS4. It's a great tool!

The trouble I'm having at the moment is with my implementation of rolling certificates. I've implemented 2 stores SigningCredentialStore and ValidationKeysStore. There I'm grabing the latest generated self signed certificate from a database where i store them.

public async Task<SigningCredentials> GetSigningCredentialsAsync()
{
    var certificate = new X509Certificate2(await _certificateStore.GetSigningCertificate());

    if (certificate == null) throw new ArgumentNullException(nameof(certificate));

    if (!certificate.HasPrivateKey)
    {
        throw new InvalidOperationException("X509 certificate does not have a private key.");
    }

    var credential = new SigningCredentials(new X509SecurityKey(certificate), "SHA256WithRSA");
    return await Task.FromResult(credential);
}

This is how I implemented the method in SigningCredentialStore.

My issue

I can't seem to find any related info on how to make IDS4 retake the newly generated certificate for signing. Can you please just point me in a direction where can I find in code what determines how those Signing Certificates are resigned?

Error I get

ArgumentException: IDX10634: Unable to create the SignatureProvider.
Algorithm: 'SHA256WithRSA', SecurityKey: 'Microsoft.IdentityModel.Tokens.X509SecurityKey'
is not supported.
Microsoft.IdentityModel.Tokens.CryptoProviderFactory.CreateSignatureProvider(SecurityKey key, string algorithm, bool willCreateSignatures)

rexdefuror avatar Nov 17 '17 09:11 rexdefuror

This seems to be a general question about IdentityServer - not a bug report or an issue.

Please use one of the our free or commercial support options

See here for more details.

Thanks!

brockallen avatar Nov 19 '17 13:11 brockallen

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 14 '20 01:01 lock[bot]