Example #1
0
 /// <summary>
 /// Verify a TPM signature structure of the hash of some data (caller hashes
 /// the data that will be verified).
 /// </summary>
 /// <param name="digest"></param>
 /// <param name="sig"></param>
 /// <returns></returns>
 public bool VerifySignatureOverHash(byte[] digest, ISignatureUnion sig)
 {
     if (Public.type == TpmAlgId.Keyedhash)
     {
         byte[] hmacKey = (Sensitive.sensitive as Tpm2bSensitiveData).buffer;
         return(CryptoLib.VerifyHmac(CryptoLib.SchemeHash(sig),
                                     hmacKey, digest, (TpmHash)sig));
     }
     else
     {
         return(Public.VerifySignatureOverHash(digest, sig));
     }
 }