I'm creating this tool in C# that would take a .gpg file and decrypt it using Windows CNG. I get a .gpg file as my input parameter and it is encrypted with my key using WinPT. Decrypting it works with the tool and I can also decrypt using BouncyCastle and my secret key. The receiving party of the file will always have the rights / key to decrypt it (this is an assumption). We do not want to use the secret key anymore, but would instead like to use the key from Windows CNG store OR the ProtectedData class (preferably). The thing we would like to avoid is sharing the secret key.
I've checked this post, where it more or less explains how the encryption and decryption works using Unprotect and Protect, but i cannot get it working when the input file is a .gpg. It does work with byte arrays, and converting the .gpg data to a byte array does not help either.
Is it even possible to decrypt a .gpg using this method?
Let's say the file gets encrypted by John using WinPT on his laptop. He then uploads it to a folder on some server. When he downloads a tool, the proper encrypted file he previous uploaded also gets downloaded. He does not have the secret key on the PC he is currently on, at least not exported. So it should be saved somewhere in the machine registry/container, it is visible in WinPT. Is it possible to decrypt the file without the secret key exported? So that the c# program would know what key to take from the windows key store and decrypt it that way. TL;DR: Encrypt with WinPT, decrypt with ProtectedData / CNG