This would be the second part of the blog post where we used powershell to store some secure data into our registry and have used DPAPI to encrypt the data. I wanted to cover how I would read the data back from the registry in my C# application. An example of C# using DPAPI to read data from Registry.
Feel free to read the blog post on Powershell using DPAPI to store secure data in Registry

I am using .NET Framework 4.6 rather than dotnet core, there is no DPAPI in dotnet core

C# using DPAPI to read data from Registry

I will be using a Console application with .NET Framework 4.6 just to show how I would read the registry and use System.Security.Cryptography to decrypt the data.

If we run this application we will see the data that we have stored in the registry.