policy¶
- class tpm2_pytss.policy(policy, hash_alg)[source]¶
Initialize policy object.
- Parameters:
policy (Union(bytes, str]) – The JSON policy to calculate or execute.
hash_alg (TPM2_ALG) – The hash algorithm to use for policy calculations.
- Returns:
An instance of the policy object.
This class implements the policy part of the TCG TSS 2.0 JSON Data Types and Policy Language Specification.
The specification can be found at https://trustedcomputinggroup.org/resource/tcg-tss-json/
- property description¶
The policy description.
- Type:
bytes
- execute(esys_ctx, session)[source]¶
Executes the policy
- Parameters:
- Raises:
TSS2_Exception or any possible exception from a callback function. –
- get_calculated_digest()[source]¶
Get the digest of the calculated policy
- Returns:
The digest as a TPM2B_DIGEST.
- Raises:
- get_calculated_json()[source]¶
Get the calculated policy as JSON
- Returns:
The calculated JSON policy as bytes
- Raises:
- property policy¶
The JSON policy.
- Type:
bytes