everything compiles fine and the initial page runs fine but when I call the page that makes the connection to my DB it failes because the key is still encrypted..
Edited....(Oct 10)
Just a FYI here is the code I am using in my Startup.cs to use the key.
services.AddDbContext<HazidExternalData>(options => options.UseOracle(Configuration.GetConnectionString("HazidExternalData")));
I am trying to use your product to read an encrypted appsettings.{environment}.json file.
Using the console part I am able to encrypt and decrypt the file fine but in my Program.cs I am not get the key decrypted...
I hope someone will be able to help me
Here is the code I am using the Program.cs
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); }) .ConfigureLogging(logging => { logging.ClearProviders(); logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); }) .ConfigureAppConfiguration((hostingContext, cfg) => { cfg.AddEncryptedAppSettings(hostingContext.HostingEnvironment, crypter => { crypter.CertificateSubjectName = "Hazard Identification Cert - DTI"; crypter.KeysToDecrypt = new List<string> { "ConnectionStrings:HazardExternalData" }; }); }) .UseNLog(); // NLog: Setup NLog for Dependency injection; }
everything compiles fine and the initial page runs fine but when I call the page that makes the connection to my DB it failes because the key is still encrypted..
Edited....(Oct 10) Just a FYI here is the code I am using in my Startup.cs to use the key.
services.AddDbContext<HazidExternalData>(options => options.UseOracle(Configuration.GetConnectionString("HazidExternalData")));