public void TakeOwnership(ProtectedPasswordStorage ownerSecret, ProtectedPasswordStorage srkSecret) { _tpmSession.SetValue("secret_" + TPMSession.PARAM_AUTH_OWNER, ownerSecret); _tpmSession.SetValue("secret_" + TPMSession.PARAM_AUTH_SRK, srkSecret); IAsymmetricBlockCipher ekEncryptor = _tpmSession.EndorsementKeyHandling.PublicKey.CreateRSAEncrypter(); ownerSecret.DecryptHash(); byte[] encOwnerSecret = ekEncryptor.ProcessBlock(ownerSecret.HashValue, 0, ownerSecret.HashValue.Length); ownerSecret.ClearHash(); srkSecret.DecryptHash(); byte[] encSrkSecret = ekEncryptor.ProcessBlock(srkSecret.HashValue, 0, srkSecret.HashValue.Length); srkSecret.ClearHash(); Parameters parameters = new Parameters(); parameters.AddPrimitiveType(PARAM_OWNERAUTH, encOwnerSecret); parameters.AddPrimitiveType(PARAM_SRKAUTH, encSrkSecret); /*TPMCommandResponse response = */ BuildDoVerifyRequest(TPMCommandNames.TPM_CMD_TakeOwnership, parameters); }
/// <summary> /// Constructs a new SealBlockCipher with the specified arguments and caches the specified seal auth value /// </summary> /// <param name="keyHandle"></param> /// <param name="session"></param> /// <param name="sealAuth"></param> public SealBlockCipher(ClientKeyHandle keyHandle, TPMSession session, TPMPCRSelection pcrSelection, ProtectedPasswordStorage sealAuth) : this(keyHandle, session, pcrSelection) { _session.SetValue("secret_seal_" + _keyHandle.FriendlyName + "_" + _myId.ToString(), sealAuth); }