How to encrypt bytes using the TPM (Trusted Platform Module)
How can I encrypt bytes using a machine's TPM module? CryptProtectData Windows provides a (relatively) simple API to encrypt a blob using the CryptProtectData API, which we can wrap an easy to use function: public Byte[] ProtectBytes(Byte[] plaintext) { //... } The details of ProtectBytes are less important than the idea that you can use it quite easily: here are the bytes I want encrypted by a secret key held in the System give me back the encrypted blob The returned blob is an undocumented documentation structure that contains everything needed to decrypt and return the original data (hash