I've been endlessly searching the internet for an answer to this but unfortunately can't seem to find it anywhere.
I'm trying to run the equivalent of this PowerShell command in C#, but without having to import PowerShell libraries into my code:
Get-TpmEndorsementKeyInfo -hashalgorithm sha256
Basically, all I'm trying to get to is the SHA256 representation of my TPM EK. If possible, I'd also like to retrieve the Thumbprint of the same, as the PowerShell command gives when it's run.
I've tried working with Limpet (https://github.com/ms-iot/security/tree/master/Limpet/Limpet.NET) but to no avail.
Why do I need this? I'm trying to use TPM as a mechanism to prove a PC is unique, I could then use that hash which is unique to this computer's TPM device to do other functions including possibly licensing. Either way, I'm trying to do this in C#.
Ideally I also find a way to sign messages using C# and TPM but I'll keep searching for that.
Any clues?