'How to create RsaSecurityKey.KeyId with IdentityServer4

I'm using IdentiyServer4 to generate tokens, I'm using the AddDeveloperSigningCredential() method to generate my RSA key with a KeyId.

But, in production, I'm using AddSigningCredential(CreateSigningCredential()), to generate a key like this :

private SigningCredentials CreateSigningCredential()
        {
            var signinkey = new RsaSecurityKey(RSA.Create());
            signinkey.KeyId = "abcdefghijklmnopqrstuvwxyz";//How to generate KeyId ??
            var credentials = new SigningCredentials(signinkey,
                SecurityAlgorithms.RsaSha256);

            return credentials;
        }

How can I generate a KeyId? Can I set it to any arbitrary value?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source