We have encountered a very concerning problem regarding web.config encryption in our legacy ASP.NET web environment.
For several years, our web deployment process has involved using TFS (AzureDevOps) to compile our code, merge our web.config files, then invoke aspnet_regiis to encrypt credentials stored therein - all using a common key deployed to all of our servers. This process has worked flawlessly for years - until apparently about two days ago.
Approximately two days ago, we suddenly started seeing app failures traced back to a "Failure to decode OAEP padding" error at runtime on a recently deployed app. Any newly deployed application or web.config file encrypted via aspnet_regiis now will not decrypt on any other server despite specifying the identical key on each target machine.
My theories center around the notion that something in the behavior of aspnet_regiis has changed
Environment: Windows Server 2016 version 1607 w/IIS 10.0 (server) Windows 10 build 22H2 (desktop)
I am looking for any way to restore the behavior wherein a common key deployed to all environments allows for common encryption/decryption, as has been the case for the last several years. I have researched breaking changes to aspnet_regiis and have found nothing.
After nearly two days of research, we were able to track down the problem described above to a corrupted machine key. We do not know how the key became corrupted, but restoring it has solved the issue.
We have turned on file-level auditing on the key file to help identify the source of any subsequent changes.