title: AddSigningCredential for IdentityServer4
body: <p>We are using IdentityServer4 with .NET Core Web Application("<a href="http://docs.identityserver.io/en/release/quickstarts/0_overview.html" rel="noreferrer">http://docs.identityserver.io/en/release/quickstarts/0_overview.html</a>"). We have replaced <code>AddDeveloperSigningCredential</code> with <code>AddSigningCredential(CreateSigningCredential())</code>. As we cannot use <code>AddDeveloperSigningCredential</code> for production environment because on production  needs to be replaced by some persistent key material. We are new to IdentityServer4 and our question is that, Is following approach fine to create signing credentials on production environment? Or do we need to made some changes in this?</p>
  
  <p>Here is our startup.cs file:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddSingleton&lt;IConfiguration&gt;(Configuration);
  
      //connection string
      string connectionString = Configuration.GetConnectionString("IdentityServer");
  
      var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
  
      services.AddIdentityServer().AddDeveloperSigningCredential
      .AddSigningCredential(CreateSigningCredential())
      // this adds the config data from DB (clients, resources)
      .AddConfigurationStore(options =&gt;
      {
          options.ConfigureDbContext = builder =&gt;
          builder.UseSqlServer(connectionString,
              sql =&gt; sql.MigrationsAssembly(migrationsAssembly));
                  }) // this adds the operational data from DB (codes, tokens, consents)
      .AddOperationalStore(options =&gt;
      {
          options.ConfigureDbContext = builder =&gt;
          builder.UseSqlServer(connectionString,
              sql =&gt; sql.MigrationsAssembly(migrationsAssembly));
  
          // this enables automatic token cleanup. this is optional.
          options.EnableTokenCleanup = true;
          options.TokenCleanupInterval = 30;
          });
  }
  
  private SigningCredentials CreateSigningCredential()
  {
      var credentials = new SigningCredentials(GetSecurityKey(), SecurityAlgorithms.RsaSha256Signature);
  
      return credentials;
  }
  private RSACryptoServiceProvider GetRSACryptoServiceProvider()
  {
      return new RSACryptoServiceProvider(2048);
  }
  private SecurityKey GetSecurityKey()
  {
      return new RsaSecurityKey(GetRSACryptoServiceProvider());
  }
  </code></pre>