# Types

The types module contains types for each of the corresponding TPM types from the following TCG specifications:

- https://trustedcomputinggroup.org/resource/tpm-library-specification/. See Part 2 “Structures”.

- https://trustedcomputinggroup.org/resource/tss-overview-common-structures-specification

The classes contained within can be initialized based on named argument value pairs or dictionaries of key-value objects where the keys are the names of the associated type.

exception tpm2_pytss.types.ParserAttributeError

  Exception ocurred when when parsing.

  __str__()

    Return str(self).

  add_note(note, /)

    Add a note to the exception

  args
  with_traceback(tb, /)

    Set self.__traceback__ to tb and return self.

class tpm2_pytss.types.TPM2B_ATTEST(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_AUTH(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_CONTEXT_DATA(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_CONTEXT_SENSITIVE(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_CREATION_DATA(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_DATA(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_DIGEST(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_ECC_PARAMETER(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_ECC_POINT(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_ENCRYPTED_SECRET(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_EVENT(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_ID_OBJECT(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_IV(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_MAX_BUFFER(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_MAX_NV_BUFFER(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_NAME(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_NONCE(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_NV_PUBLIC(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  get_name()

    Get the TPM name of the NV public area.

    This function requires a populated TPM2B_NV_PUBLIC and will NOT go to the TPM to retrieve the name, and instead calculates it manually.

    Returns:

      Returns TPM2B_NAME.

    Raises:

      ValueError – Unsupported name digest algorithm.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_OPERAND(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_PRIVATE(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_PRIVATE_KEY_RSA(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_PRIVATE_VENDOR_SPECIFIC(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_PUBLIC(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  classmethod from_pem(data, nameAlg=11, objectAttributes=393280, symmetric=None, scheme=None, password=None)

    Decode the public part from standard key encodings.

    Currently supports PEM, DER and SSH encoded public keys.

    Parameters:

      - data (bytes) – The encoded public key.

      - nameAlg (TPM2_ALG, int) – The name algorithm for the public area, default is TPM2_ALG.SHA256.

      - objectAttributes (TPMA_OBJECT, int) – The object attributes for the public area, default is (TPMA_OBJECT.DECRYPT | TPMA_OBJECT.SIGN_ENCRYPT | TPMA_OBJECT.USERWITHAUTH).

      - symmetric (TPMT_SYM_DEF_OBJECT) – The symmetric definition to use for the public area, default is None.

      - scheme (TPMT_ASYM_SCHEME) – The signing/key exchange scheme to use for the public area, default is None.

      - password (bytes) – The password used to decrypt the key, default is None.

    Returns:

      Returns a TPMT_PUBLIC instance.

    Raises:

      ValueError – If key parameters are not supported.

    Example

        ecc_key_pem = open('path/to/myecckey.pem').read().encode()
        TP2B_PUBLIC.from_pem(ecc_key_pem)

  get_name()

    Get the TPM name of the public area.

    This function requires a populated TPM2B_PUBLIC and will NOT go to the TPM to retrieve the name, and instead calculates it manually.

    Returns:

      Returns TPM2B_NAME.

    Raises:

      ValueError – Unsupported name digest algorithm.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod parse(alg='rsa', objectAttributes=393330, nameAlg='sha256', authPolicy=None)

    Builds a TPM2B_PUBLIC from a tpm2-tools like specifier strings.

    This builds the TPM2B_PUBLIC structure which can be used in TPM2_Create and TPM2_CreatePrimary commands that map into the tpm2-tools project as tpm2 create and createprimary commandlets. Those commands take options: -G, -n, -L and -a option to specify the object to create. This method converts those options, but does not create the object like tpm2-tools.

    Parameters:

      - alg (str) – The string specifier for the objects algorithm type, bitsize, symmetric cipher and scheme. This is tpm2-tools option “-G” as described in: https://github.com/tpm2-software/tpm2-tools/blob/master/man/common/alg.md#complex-specifiers.

      - objectAttiributes (TPMA_OBJECT, int, str) – The objects attributes whihch can either the object attributes themselves or a nice name string value. This is tpm2-tools option “-a as described in: https://github.com/tpm2-software/tpm2-tools/blob/master/man/common/obj-attrs.md.

      - nameAlg (TPM2_ALG, int, str) – The hashing algorithm for the objects name, either the TPM2_ALG constant, integer value or a friendly name string. This is tpm2-tools option “-n” as described in: https://github.com/tpm2-software/tpm2-tools/blob/master/man/common/alg.md#hashing-algorithms

      - authPolicy (bytes) – The policy digest of the object. This is tpm2-tools option “-L”.

    Returns:

      A populated TPMT_PUBLIC for use.

    Raises:

      ValueError – If a string value is not of an expected format.

    Examples

        TPM2B_PUBLIC.parse(
            "ecc:ecdh-sha384",
            objectAttributes=TPMA_OBJECT.DEFAULT_TPM2_TOOLS_CREATEPRIMARY_ATTRS)

        TPM2B_PUBLIC.parse(
            alg="xor:sha512",
            nameAlg="sha256",
            authPolicy=b'ÅsSòcrßÓºowMQ¯îKEOþVó^[')

  to_der()

    Encode the public key as DER encoded ASN.1.

    Returns:

      Returns the DER encoded key as bytes.

    Raises:

      ValueError – If key type is not supported.

    Example

        with ESAPI() as e:
            # public parameter is index 1 in the return tuple
            pub = e.create_primary(None)[1]
            pub.to_der()

  to_pem()

    Encode the public key as PEM encoded ASN.1.

    Returns:

      Returns the PEM encoded key as bytes.

    Raises:

      ValueError – If key type is not supported.

    Example

        with ESAPI() as e:
            # public parameter is index 1 in the return tuple
            pub = e.create_primary(None)[1]
            pub.to_pem()

  to_ssh()

    Encode the public key in OpenSSH format

    Returns:

      Returns the OpenSSH encoded key as bytes.

    Raises:

      ValueError – If key type is not supported.

    Example

        with ESAPI() as e:
            # public parameter is index 1 in the return tuple
            pub = e.create_primary(None)[1]
            pub.to_ssh()

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_PUBLIC_KEY_RSA(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_SENSITIVE(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  classmethod from_pem(data, password=None)

    Decode the private part from standard key encodings.

    Currently supports PEM, DER and SSH encoded private keys.

    Parameters:

      - data (bytes) – The encoded key as bytes.

      - password (bytes) – The password used to decrypt the key, default is None.

    Returns:

      Returns an instance of TPM2B_SENSITIVE.

    Raises:

      ValueError – If key parameters are not supported.

    Example

        rsa_private_key = open('path/to/my/rsaprivatekey.pem').read().encode()
        TPM2B_SENSITIVE.from_pem(rsa_private_key)

  classmethod keyedhash_from_secret(secret, nameAlg=11, objectAttributes=393280, scheme=None, seed=None)

    Generate the private and public part for a keyed hash object from a secret.

    Parameters:

      - secret (bytes) – The HMAC key / data to be sealed.

      - nameAlg (TPM2_ALG, int) – The name algorithm for the public part, default is TPM2_ALG.SHA256.

      - objectAttributes (TPMA_OBJECT, int) – The object attributes for the public area, default is (TPMA_OBJECT.DECRYPT | TPMA_OBJECT.SIGN_ENCRYPT | TPMA_OBJECT.USERWITHAUTH).

      - scheme (TPMT_KEYEDHASH_SCHEME) – The signing/key exchange scheme to use for the public area, default is None.

      - seed (bytes) – The obfuscate value, default is a randomized value.

    Returns:

      A tuple of TPM2B_SENSITIVE and TPM2B_PUBLIC

    Raises:

      ValueError – If key parameters are not supported.

    Example

        secret = b"secret key"
        scheme = TPMT_KEYEDHASH_SCHEME(scheme=TPM2_ALG.HMAC)
        scheme.details.hmac.hashAlg = TPM2_ALG.SHA256
        (sens, pub) = TPM2B_SENSITIVE.keyedhash_from_secret(secret, scheme=scheme)

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod symcipher_from_secret(secret, algorithm=6, mode=67, nameAlg=11, objectAttributes=393280, seed=None)

    Generate the private and public part for a symcipher object from a secret.

    Parameters:

      - secret (bytes) – the symmetric key.

      - algorithm (TPM2_ALG, int) – The symmetric cipher algorithm to use, default is TPM2_ALG.AES.

      - mode (TPM2_ALG, int) – The symmetric mode to use, default is TPM2_ALG.CFB.

      - nameAlg (TPM2_ALG, int) – The name algorithm for the public part, default is TPM2_ALG.SHA256.

      - objectAttributes (TPMA_OBJECT, int) – The object attributes for the public area, default is (TPMA_OBJECT.DECRYPT | TPMA_OBJECT.SIGN_ENCRYPT | TPMA_OBJECT.USERWITHAUTH).

      - seed (bytes) – The obfuscate value, default is a randomized value.

    Returns:

      A tuple of TPM2B_SENSITIVE and TPM2B_PUBLIC

    Example

        secret = b"ñ" * 32
        sens, pub = TPM2B_SENSITIVE.symcipher_from_secret(secret)

  to_der(public)

    Encode the key as DER encoded ASN.1.

    public(TPMT_PUBLIC): The corresponding public key.

    Returns:

      Returns the DER encoding as bytes.

    Raises:

      ValueError – Unsupported key type.

    Example

        rsa_private_key = open('path/to/my/rsaprivatekey.pem').read().encode()
        priv = TPM2B_SENSITIVE.from_pem(rsa_private_key)
        pub = TPM2B_PUBLIC.from_pem(rsa_private_key)
        priv.to_der(pub.publicArea)

  to_pem(public, password=None)

    Encode the key as PEM encoded ASN.1.

    Parameters:

      - public (TPMT_PUBLIC) – The corresponding public key.

      - password (bytes) – An optional password for encrypting the PEM with.

    Returns:

      Returns the PEM encoding as bytes.

    Raises:

      ValueError – Unsupported key type.

    Example

        rsa_private_key = open('path/to/my/rsaprivatekey.pem').read().encode()
        priv = TPM2B_SENSITIVE.from_pem(rsa_private_key)
        pub = TPM2B_PUBLIC.from_pem(rsa_private_key)
        priv.to_pem(pub.publicArea)

  to_ssh(public, password=None)

    Encode the key as OPENSSH PEM format.

    Parameters:

      - public (TPMT_PUBLIC) – The corresponding public key.

      - password (bytes) – An optional password for encrypting the PEM with.

    Returns:

      Returns the PEM OPENSSH encoding as bytes.

    Raises:

      ValueError – Unsupported key type.

    Example

        rsa_private_key = open('path/to/my/rsaprivatekey.pem').read().encode()
        priv = TPM2B_SENSITIVE.from_pem(rsa_private_key)
        pub = TPM2B_PUBLIC.from_pem(rsa_private_key)
        priv.to_ssh(pub.publicArea)

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_SENSITIVE_CREATE(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_SENSITIVE_DATA(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_SIMPLE_OBJECT(_cdata=None, **kwargs)

  Abstract Base class for all TPM2B Simple Objects. A Simple object contains only a size and byte buffer fields. This is not suitable for direct instantiation.

  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_SYM_KEY(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_TEMPLATE(_cdata=None, **kwargs)
  __str__()

    Returns a hex string representation of the underlying buffer.

    This is the same as:

        bytes(tpm2b_type).hex()

    Returns (str):

      A hex encoded string of the buffer.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2B_TIMEOUT(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM2_HANDLE

  A handle to a TPM address

  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_AC_CAPABILITIES(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_ALG(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod parse(algorithms)

    Convert an comma separated list of algorithm friendly string names to a list of numeric constants.

    Friendly algorithm names are the constants representing algorithms found in the TPM2_ALG class. The string identifiers are those understood by TPM2_ALG.parse.

    Parameters:

      algorithms (str) – A comma separated list of algorithm friendly names. May be a list of one item with no comma.

    Returns:

      A populated TPML_ALG

    Raises:

      ValueError – Invalid algorithms list.

    Example

        TPML_ALG("aes")
        TPML_ALG("aes,sha256")

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_ALG_PROPERTY(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_CC(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_CCA(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_DIGEST(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_DIGEST_VALUES(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_ECC_CURVE(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_HANDLE(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_INTEL_PTT_PROPERTY(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_Iterator(tpml)

  Iterator class for iterating over TPML data types.

  This class is used in enumerated for loops, such as: .. code-block:: python

  for alg in TPML_ALG:

    do_something(alg)

  __str__()

    Return str(self).

class tpm2_pytss.types.TPML_OBJECT(_cdata=None, **kwargs)

  Abstract Base class for all TPML Objects. A TPML object is an object that contains a list of objects. This is not suitable for direct instantiation.

  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_PCR_SELECTION(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  static parse(selections)

    Convert a PCR selection string into the TPML_PCR_SELECTION data structure.

    PCR Bank Selection lists follow the below specification:

        <BANK>:<PCR>[,<PCR>] or <BANK>:all

    multiple banks may be separated by ‘+’.

    For Example “sha1:3,4+sha256:all”, will select PCRs 3 and 4 from the SHA1 bank and PCRs 0 to 23 from the SHA256 bank.

    Parameters:

      algorithms (str) – A comma separated list of algorithm friendly names. May be a list of one item with no comma.

    Returns:

      A populated TPML_PCR_SELECTION

    Raises:

      ValueError – Invalid algorithms list.

    Example

        TPML_PCR_SELECTION.parse("sha256:1,3,5,7")
        TPML_PCR_SELECTION.parse("sha1:3,4+sha256:all")

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_TAGGED_PCR_PROPERTY(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPML_TAGGED_TPM_PROPERTY(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_AC_OUTPUT(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_ALGORITHM_DESCRIPTION(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_ALGORITHM_DETAIL_ECC(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_ALG_PROPERTY(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_ASYM_PARMS(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_ATTEST(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_AUTH_COMMAND(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_AUTH_RESPONSE(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_CAPABILITY_DATA(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_CERTIFY_INFO(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_CLOCK_INFO(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_COMMAND_AUDIT_INFO(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_CONTEXT(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  classmethod from_tools(data)

    Unmarshal a tpm2-tools context blob.

    Parameters:

      data (bytes) – The bytes from a tpm2-tools context file.

    Returns:

      Returns a TPMS_CONTEXT instance.

    Raises:

      ValueError – if the header contains bad values

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  to_tools(session_type=None, auth_hash=None)

    Marshal the context into a tpm2-tools context blob.

    Parameters:

      - session_type (TPM2_SE) – The session type, default is None.

      - auth_hash (TPM2_ALG) – The session hash algorithm, default is None.

    Note

    Both session_type and auth_hash are required for HMAC and policy sessions.

    Returns:

      The context blob as bytes

    Raises:

      TypeError – if session_type and auth_hash is missing for a session context.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_CONTEXT_DATA(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_CREATION_DATA(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_CREATION_INFO(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_ECC_PARMS(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_ECC_POINT(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_EMPTY(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_ID_OBJECT(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_KEYEDHASH_PARMS(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_NV_CERTIFY_INFO(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_NV_PIN_COUNTER_PARAMETERS(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_NV_PUBLIC(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  get_name()

    Get the TPM name of the NV public area.

    Returns:

      Returns TPM2B_NAME.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_PCR_SELECT(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_PCR_SELECTION(pcrs=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  static parse(selection)

    Given a PCR selection string populate a TPMS_PCR_SELECTION structure.

    A PCR Bank selection lists:

        <BANK>:<PCR>[,<PCR>] or <BANK>:all

    For Example “sha1:3,4”, will select PCRs 3 and 4 from the SHA1 bank.

    Parameters:

      selection (str) – A PCR selection string.

    Returns:

      A populated TPMS_PCR_SELECTION

    Raises:

      ValueError – Invalid PCR specification.

    Example

        TPMS_PCR_SELECTION.parse("sha256:1,3,5,7")
        TPMS_PCR_SELECTION.parse("sha1:all")

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_QUOTE_INFO(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_RSA_PARMS(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SCHEME_ECDAA(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SCHEME_HASH(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SCHEME_HMAC(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SCHEME_XOR(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SENSITIVE_CREATE(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SESSION_AUDIT_INFO(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SIGNATURE_ECC(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SIGNATURE_RSA(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SIG_SCHEME_ECDAA(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SIG_SCHEME_ECDSA(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SIG_SCHEME_ECSCHNORR(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SIG_SCHEME_RSAPSS(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SIG_SCHEME_RSASSA(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SIG_SCHEME_SM2(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_SYMCIPHER_PARMS(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_TAGGED_PCR_SELECT(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_TAGGED_PROPERTY(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_TIME_ATTEST_INFO(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMS_TIME_INFO(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_ASYM_SCHEME(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_ECC_SCHEME(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_HA(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_KDF_SCHEME(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_KEYEDHASH_SCHEME(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_PUBLIC(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  classmethod from_pem(data, nameAlg=11, objectAttributes=393280, symmetric=None, scheme=None, password=None)

    Decode the public part from standard key encodings.

    Currently supports PEM, DER and SSH encoded public keys.

    Parameters:

      - data (bytes) – The encoded public key.

      - nameAlg (TPM2_ALG, int) – The name algorithm for the public area, default is TPM2_ALG.SHA256.

      - objectAttributes (TPMA_OBJECT, int) – The object attributes for the public area, default is (TPMA_OBJECT.DECRYPT | TPMA_OBJECT.SIGN_ENCRYPT | TPMA_OBJECT.USERWITHAUTH).

      - symmetric (TPMT_SYM_DEF_OBJECT) – The symmetric definition to use for the public area, default is None.

      - scheme (TPMT_ASYM_SCHEME) – The signing/key exchange scheme to use for the public area, default is None.

      - password (bytes) – The password used to decrypt the key, default is None.

    Returns:

      Returns a TPMT_PUBLIC instance.

    Raises:

      ValueError – If key parameters are not supported.

    Example

        ecc_key_pem = open('path/to/myecckey.pem').read().encode()
        TPMT_PUBLIC.from_pem(ecc_key_pem)

  get_name()

    Get the TPM name of the public area.

    This function requires a populated TPMT_PUBLIC and will NOT go to the TPM to retrieve the name, and instead calculates it manually.

    Returns:

      Returns TPM2B_NAME.

    Raises:

      ValueError – Unsupported name digest algorithm.

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod parse(alg='rsa', objectAttributes=393330, nameAlg='sha256', authPolicy=None)

    Builds a TPMT_PUBLIC from a tpm2-tools like specifier strings.

    This builds the TPMT_PUBLIC structure which can be used in TPM2_Create and TPM2_CreatePrimary commands that map into the tpm2-tools project as tpm2 create and createprimary commandlets. Those commands take options: -G, -n, -L and -a option to specify the object to create. This method converts those options, but does not create the object like tpm2-tools.

    Parameters:

      - alg (str) – The string specifier for the objects algorithm type, bitsize, symmetric cipher and scheme. This is tpm2-tools option “-G” as described in: https://github.com/tpm2-software/tpm2-tools/blob/master/man/common/alg.md#complex-specifiers.

      - objectAttiributes (TPMA_OBJECT, int, str) – The objects attributes whihch can either the object attributes themselves or a nice name string value. This is tpm2-tools option “-a as described in: https://github.com/tpm2-software/tpm2-tools/blob/master/man/common/obj-attrs.md.

      - nameAlg (TPM2_ALG, int, str) – The hashing algorithm for the objects name, either the TPM2_ALG constant, integer value or a friendly name string. This is tpm2-tools option “-n” as described in: https://github.com/tpm2-software/tpm2-tools/blob/master/man/common/alg.md#hashing-algorithms

      - authPolicy (bytes) – The policy digest of the object. This is tpm2-tools option “-L”.

    Returns:

      A populated TPMT_PUBLIC for use.

    Raises:

      ValueError – If a string value is not of an expected format.

    Examples

        TPMT_PUBLIC.parse(
            "ecc:ecdh-sha384",
            objectAttributes=TPMA_OBJECT.DEFAULT_TPM2_TOOLS_CREATEPRIMARY_ATTRS)

        TPMT_PUBLIC.parse(
            alg="xor:sha512",
            nameAlg="sha256",
            authPolicy=b'ÅsSòcrßÓºowMQ¯îKEOþVó^[')

  to_der()

    Encode the public key as DER encoded ASN.1.

    Returns:

      Returns the DER encoded key as bytes.

    Raises:

      ValueError – If key type is not supported.

    Example

        with ESAPI() as e:
            # public parameter is index 1 in the return tuple
            pub = e.create_primary(None)[1]
            pub.publicArea.to_der()

  to_pem()

    Encode the public key as PEM encoded ASN.1.

    Returns:

      Returns the PEM encoded key as bytes.

    Raises:

      ValueError – If key type is not supported.

    Example

        with ESAPI() as e:
            # public parameter is index 1 in the return tuple
            pub = e.create_primary(None)[1]
            pub.publicArea.to_pem()

  to_ssh()

    Encode the public key in OpenSSH format

    Returns:

      Returns the OpenSSH encoded key as bytes.

    Raises:

      ValueError – If key type is not supported.

    Example

        with ESAPI() as e:
            # public parameter is index 1 in the return tuple
            pub = e.create_primary(None)[1]
            pub.publicArea.to_ssh()

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_PUBLIC_PARMS(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_RSA_DECRYPT(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_RSA_SCHEME(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_SENSITIVE(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  classmethod from_pem(data, password=None)

    Decode the private part from standard key encodings.

    Currently supports PEM, DER and SSH encoded private keys.

    Parameters:

      - data (bytes) – The encoded key as bytes.

      - password (bytes) – The password used to decrypt the key, default is None.

    Returns:

      Returns an instance of TPMT_SENSITIVE.

  classmethod keyedhash_from_secret(secret, nameAlg=11, objectAttributes=393280, scheme=None, seed=None)

    Generate the private and public part for a keyed hash object from a secret.

    Parameters:

      - secret (bytes) – The HMAC key / data to be sealed.

      - nameAlg (int) – The name algorithm for the public part, default is TPM2_ALG.SHA256.

      - objectAttributes (int) – The object attributes for the public area, default is (TPMA_OBJECT.DECRYPT | TPMA_OBJECT.SIGN_ENCRYPT | TPMA_OBJECT.USERWITHAUTH).

      - scheme (TPMT_KEYEDHASH_SCHEME) – The signing/key exchange scheme to use for the public area, default is None.

      - seed (bytes) – The obfuscate value, default is a randomized value.

    Returns:

      A tuple of of TPMT_SENSITIVE and TPMT_PUBLIC

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod symcipher_from_secret(secret, algorithm=6, mode=67, nameAlg=11, objectAttributes=393280, seed=None)

    Generate the private and public part for a symcipher object from a secret.

    Parameters:

      - secret (bytes) – the symmetric key.

      - algorithm (int) – The symmetric cipher algorithm to use, default is TPM2_ALG.AES.

      - mode (int) – The symmetric mode to use, default is TPM2_ALG.CFB.

      - nameAlg (int) – The name algorithm for the public part, default is TPM2_ALG.SHA256.

      - objectAttributes (int) – The object attributes for the public area, default is (TPMA_OBJECT.DECRYPT | TPMA_OBJECT.SIGN_ENCRYPT | TPMA_OBJECT.USERWITHAUTH).

      - seed (bytes) – The obfuscate value, default is a randomized value.

    Returns:

      A tuple of TPMT_SENSITIVE and TPMT_PUBLIC

  to_der(public)

    Encode the key as DER encoded ASN.1.

    public(TPMT_PUBLIC): The corresponding public key.

    Returns:

      Returns the DER encoding as bytes.

  to_pem(public, password=None)

    Encode the key as PEM encoded ASN.1.

    public(TPMT_PUBLIC): The corresponding public key. password(bytes): An optional password for encrypting the PEM with.

    Returns:

      Returns the PEM encoding as bytes.

  to_ssh(public, password=None)

    Encode the key as SSH format.

    public(TPMT_PUBLIC): The corresponding public key. password(bytes): An optional password for encrypting the PEM with.

    Returns:

      Returns the DER encoding as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_SIGNATURE(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

  verify_signature(key, data, prehashed=False)

    Verify a TPM generated signature against a key.

    Parameters:

      - key (TPMT_PUBLIC, TPM2B_PUBLIC or bytes) – The key to verify against, bytes for HMAC, the public part for asymmetric key.

      - data (bytes) – The signed data to verify or the digest if prehashed is True.

      - prehashed – (bool): If True the data should be the digest of the signed data, defaults to False.

    Raises:

      cryptography.exceptions.InvalidSignature – when the signature doesn’t match the data.

class tpm2_pytss.types.TPMT_SIG_SCHEME(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_SYM_DEF(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod parse(alg, is_restricted=False, is_rsapss=False)

    Builds a TPMT_SYM_DEF from a tpm2-tools like specifier strings.

    TPMT_SYM_DEF can be built from the symmetric algorithm string specifiers that the tpm2-tools project uses, for example, strings like “aes128cbc”.

    Parameters:

      - alg (str) – The string specifier for the algorithm type, bitsize, and mode. Note strings

      - "aes128cfb". ("aes" and "aes128" are shorthand for)

    Returns:

      A populated TPMT_SYM_DEF for use.

    Raises:

      ValueError – If a string value is not of an expected format.

    Examples

        TPMT_SYM_DEF.parse("aes256cfb")
        TPMT_SYM_DEF.parse("aes")
        TPMT_SYM_DEF.parse("aes128cbc")

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_SYM_DEF_OBJECT(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod parse(alg, is_restricted=False, is_rsapss=False)

    Builds a TPMT_SYM_DEF from a tpm2-tools like specifier strings.

    TPMT_SYM_DEF can be built from the symmetric algorithm string specifiers that the tpm2-tools project uses, for example, strings like “aes128cbc”.

    Parameters:

      - alg (str) – The string specifier for the algorithm type, bitsize, and mode. Note strings

      - "aes128cfb". ("aes" and "aes128" are shorthand for)

    Returns:

      A populated TPMT_SYM_DEF for use.

    Raises:

      ValueError – If a string value is not of an expected format.

    Examples

        TPMT_SYM_DEF.parse("aes256cfb")
        TPMT_SYM_DEF.parse("aes")
        TPMT_SYM_DEF.parse("aes128cbc")

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_TK_AUTH(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_TK_CREATION(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_TK_HASHCHECK(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMT_TK_VERIFIED(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_ASYM_SCHEME(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_ATTEST(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_CAPABILITIES(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_HA(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_KDF_SCHEME(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_OBJECT(_cdata=None, **kwargs)

  Base class for union types, not suitable for direct instantiation.

  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_PUBLIC_ID(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_PUBLIC_PARMS(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_SCHEME_KEYEDHASH(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_SENSITIVE_COMPOSITE(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_SIGNATURE(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_SIG_SCHEME(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_SYM_KEY_BITS(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPMU_SYM_MODE(_cdata=None, **kwargs)
  __str__()

    Return str(self).

  marshal(selector)

    Marshal union instance into bytes.

    Parameters:

      selector (int) – The union selector.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(selector, buf)

    Unmarshal bytes into type instance.

    Parameters:

      - selector (int) – The union selector.

      - buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.

class tpm2_pytss.types.TPM_BASE_OBJECT(_cdata=None, **kwargs)

  Abstract Base class for all TPM Objects. Not suitable for direct instantiation.

  __str__()

    Return str(self).

class tpm2_pytss.types.TPM_OBJECT(_cdata=None, **kwargs)

  Base class struct types, not suitable for direct instantiation.

  __str__()

    Return str(self).

  marshal()

    Marshal instance into bytes.

    Returns:

      Returns the marshaled type as bytes.

  classmethod unmarshal(buf)

    Unmarshal bytes into type instance.

    Parameters:

      buf (bytes) – The bytes to be unmarshaled.

    Returns:

      Returns an instance of the current type and the number of bytes consumed.