Constants

This module contains all the constant values from the following TCG specifications:

Along with helpers to go from string values to constants and constant values to string values.

class tpm2_pytss.constants.ESYS_TR(value, ectx=None)[source]

ESYS_TR is an ESAPI identifier representing a TPM resource

To get the ESYS_TR identifier for a persistent handle, such as a NV area or a persistent key use tpm2_pytss.ESAPI.tr_from_tpmpublic()

Can be used as a context manager to flush transient and session handles.

ENDORSEMENT = 267
LOCKOUT = 266
NONE = 4095
NULL = 263
OWNER = 257
PASSWORD = 255
PCR0 = 0
PCR1 = 1
PCR10 = 10
PCR11 = 11
PCR12 = 12
PCR13 = 13
PCR14 = 14
PCR15 = 15
PCR16 = 16
PCR17 = 17
PCR18 = 18
PCR19 = 19
PCR2 = 2
PCR20 = 20
PCR21 = 21
PCR22 = 22
PCR23 = 23
PCR24 = 24
PCR25 = 25
PCR26 = 26
PCR27 = 27
PCR28 = 28
PCR29 = 29
PCR3 = 3
PCR30 = 30
PCR31 = 31
PCR4 = 4
PCR5 = 5
PCR6 = 6
PCR7 = 7
PCR8 = 8
PCR9 = 9
PLATFORM = 268
PLATFORM_NV = 269
RH_ACT_0 = 288
RH_ACT_1 = 289
RH_ACT_2 = 290
RH_ACT_3 = 291
RH_ACT_4 = 292
RH_ACT_5 = 293
RH_ACT_6 = 294
RH_ACT_7 = 295
RH_ACT_8 = 296
RH_ACT_9 = 297
RH_ACT_A = 298
RH_ACT_B = 299
RH_ACT_C = 300
RH_ACT_D = 301
RH_ACT_E = 302
RH_ACT_F = 303
RH_ENDORSEMENT = 267
RH_FW_ENDORSEMENT = 271
RH_FW_NULL = 273
RH_FW_OWNER = 270
RH_FW_PLATFORM = 272
RH_LOCKOUT = 266
RH_NULL = 263
RH_OWNER = 257
RH_PLATFORM = 268
RH_PLATFORM_NV = 269
RH_SVN_ENDORSEMENT_BASE = 16908288
RH_SVN_NULL_BASE = 17039360
RH_SVN_OWNER_BASE = 16842752
RH_SVN_PLATFORM_BASE = 16973824
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

close(ectx)[source]

Same as see tpm2_pytss.ESAPI.tr_close

Parameters:

ectx (ESAPI) – The esapi context to close the ESYS_TR on.

static deserialize(ectx, buffer)[source]

Same as see tpm2_pytss.ESAPI.tr_derialize

Parameters:

ectx (ESAPI) – The esapi context to load the ESYS_TR on.

Returns:

An ESYS_TR representing the TPM object.

get_name(ectx)[source]

Same as see tpm2_pytss.ESAPI.tr_get_name

Parameters:

ectx (ESAPI) – The esapi context to retrieve the object name from.

Returns:

A TPM2B_NAME object.

marshal()[source]

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
static parts_to_blob(handle, public)[source]

Converts a persistent handle and public to a serialized ESYS_TR.

Parameters:
  • handle (TPM2_HANDLE) – The PERSISTENT handle to convert.

  • public (TPM2B_PUBLIC) – The corresponding public for the handle.

Returns:

A SERIALIZED ESYS_TR that can be used with ESYS_TR.deserialize later.

serialize(ectx)[source]

Same as see tpm2_pytss.ESAPI.tr_serialize

Parameters:
  • ectx (ESAPI) – The esapi context the ESYS_TR was created

  • from.

Returns:

A byte array of the serialized ESYS_TR.

classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

classmethod unmarshal(buf)[source]

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.constants.FAPI_ESYSBLOB[source]
CONTEXTLOAD = 1
DESERIALIZE = 2
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_ALG[source]
AES = 6
CAMELLIA = 38
CBC = 66
CFB = 67
CTR = 64
ECB = 68
ECC = 35
ECDAA = 26
ECDH = 25
ECDSA = 24
ECMQV = 29
ECSCHNORR = 28
ERROR = 0
FIRST = 1
HMAC = 5
KDF1_SP800_108 = 34
KDF1_SP800_56A = 32
KDF2 = 33
KEYEDHASH = 8
LAST = 68
MGF1 = 7
NULL = 16
OAEP = 23
OFB = 65
RSA = 1
RSAES = 21
RSAPSS = 22
RSASSA = 20
SHA = 4
SHA1 = 4
SHA256 = 11
SHA384 = 12
SHA3_256 = 39
SHA3_384 = 40
SHA3_512 = 41
SHA512 = 13
SM2 = 27
SM3_256 = 18
SM4 = 19
SYMCIPHER = 37
TDES = 3
XOR = 10
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_ALG_ID[source]
AES = 6
CAMELLIA = 38
CBC = 66
CFB = 67
CTR = 64
ECB = 68
ECC = 35
ECDAA = 26
ECDH = 25
ECDSA = 24
ECMQV = 29
ECSCHNORR = 28
ERROR = 0
FIRST = 1
HMAC = 5
KDF1_SP800_108 = 34
KDF1_SP800_56A = 32
KDF2 = 33
KEYEDHASH = 8
LAST = 68
MGF1 = 7
NULL = 16
OAEP = 23
OFB = 65
RSA = 1
RSAES = 21
RSAPSS = 22
RSASSA = 20
SHA = 4
SHA1 = 4
SHA256 = 11
SHA384 = 12
SHA3_256 = 39
SHA3_384 = 40
SHA3_512 = 41
SHA512 = 13
SM2 = 27
SM3_256 = 18
SM4 = 19
SYMCIPHER = 37
TDES = 3
XOR = 10
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_CAP[source]
ACT = 10
ALGS = 0
AUDIT_COMMANDS = 4
AUTH_POLICIES = 9
COMMANDS = 2
ECC_CURVES = 8
FIRST = 0
HANDLES = 1
LAST = 10
PCRS = 5
PCR_PROPERTIES = 7
PP_COMMANDS = 3
TPM_PROPERTIES = 6
VENDOR_PROPERTY = 256
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_CC[source]
ACT_SetTimeout = 408
AC_GetCapability = 404
AC_Send = 405
ActivateCredential = 327
Certify = 328
CertifyCreation = 330
CertifyX509 = 407
ChangeEPS = 292
ChangePPS = 293
Clear = 294
ClearControl = 295
ClockRateAdjust = 304
ClockSet = 296
Commit = 395
ContextLoad = 353
ContextSave = 354
Create = 339
CreateLoaded = 401
CreatePrimary = 305
DictionaryAttackLockReset = 313
DictionaryAttackParameters = 314
Duplicate = 331
ECC_Decrypt = 410
ECC_Encrypt = 409
ECC_Parameters = 376
ECDH_KeyGen = 355
ECDH_ZGen = 340
EC_Ephemeral = 398
EncryptDecrypt = 356
EncryptDecrypt2 = 403
EventSequenceComplete = 389
EvictControl = 288
FIRST = 287
FieldUpgradeData = 321
FieldUpgradeStart = 303
FirmwareRead = 377
FlushContext = 357
GetCapability = 378
GetCommandAuditDigest = 307
GetRandom = 379
GetSessionAuditDigest = 333
GetTestResult = 380
GetTime = 332
HMAC = 341
HMAC_Start = 347
Hash = 381
HashSequenceStart = 390
HierarchyChangeAuth = 297
HierarchyControl = 289
Import = 342
IncrementalSelfTest = 322
LAST = 412
Load = 343
LoadExternal = 359
MAC = 341
MAC_Start = 347
MakeCredential = 360
NV_Certify = 388
NV_ChangeAuth = 315
NV_DefineSpace = 298
NV_Extend = 310
NV_GlobalWriteLock = 306
NV_Increment = 308
NV_Read = 334
NV_ReadLock = 335
NV_ReadPublic = 361
NV_SetBits = 309
NV_UndefineSpace = 290
NV_UndefineSpaceSpecial = 287
NV_Write = 311
NV_WriteLock = 312
ObjectChangeAuth = 336
PCR_Allocate = 299
PCR_Event = 316
PCR_Extend = 386
PCR_Read = 382
PCR_Reset = 317
PCR_SetAuthPolicy = 300
PCR_SetAuthValue = 387
PP_Commands = 301
PolicyAuthValue = 363
PolicyAuthorize = 362
PolicyAuthorizeNV = 402
PolicyCapability = 411
PolicyCommandCode = 364
PolicyCounterTimer = 365
PolicyCpHash = 366
PolicyDuplicationSelect = 392
PolicyGetDigest = 393
PolicyLocality = 367
PolicyNV = 329
PolicyNameHash = 368
PolicyNvWritten = 399
PolicyOR = 369
PolicyPCR = 383
PolicyParameters = 412
PolicyPassword = 396
PolicyPhysicalPresence = 391
PolicyRestart = 384
PolicySecret = 337
PolicySigned = 352
PolicyTemplate = 400
PolicyTicket = 370
Policy_AC_SendSelect = 406
Quote = 344
RSA_Decrypt = 345
RSA_Encrypt = 372
ReadClock = 385
ReadPublic = 371
Rewrap = 338
SelfTest = 323
SequenceComplete = 318
SequenceUpdate = 348
SetAlgorithmSet = 319
SetCommandCodeAuditStatus = 320
SetPrimaryPolicy = 302
Shutdown = 325
Sign = 349
StartAuthSession = 374
Startup = 324
StirRandom = 326
TestParms = 394
Unseal = 350
Vendor_TCG_Test = 536870912
VerifySignature = 375
ZGen_2Phase = 397
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_CLOCK[source]
COARSE_FASTER = 3
COARSE_SLOWER = -3
FINE_FASTER = 1
FINE_SLOWER = -1
MEDIUM_FASTER = 2
MEDIUM_SLOWER = -2
NO_CHANGE = 0
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_CLOCK_ADJUST[source]
COARSE_FASTER = 3
COARSE_SLOWER = -3
FINE_FASTER = 1
FINE_SLOWER = -1
MEDIUM_FASTER = 2
MEDIUM_SLOWER = -2
NO_CHANGE = 0
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_ECC[source]
BN_P256 = 16
BN_P638 = 17
NIST_P192 = 1
NIST_P224 = 2
NIST_P256 = 3
NIST_P384 = 4
NIST_P521 = 5
NONE = 0
SM2_P256 = 32
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_ECC_CURVE[source]
BN_P256 = 16
BN_P638 = 17
NIST_P192 = 1
NIST_P224 = 2
NIST_P256 = 3
NIST_P384 = 4
NIST_P521 = 5
NONE = 0
SM2_P256 = 32
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_EO[source]
BITCLEAR = 11
BITSET = 10
EQ = 0
NEQ = 1
SIGNED_GE = 6
SIGNED_GT = 2
SIGNED_LE = 8
SIGNED_LT = 4
UNSIGNED_GE = 7
UNSIGNED_GT = 3
UNSIGNED_LE = 9
UNSIGNED_LT = 5
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_GENERATED[source]
VALUE = 4283712327
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_HC[source]
ACTIVE_SESSION_FIRST = 50331648
ACTIVE_SESSION_LAST = 67108862
HMAC_SESSION_FIRST = 33554432
HMAC_SESSION_LAST = 50331646
HR_HANDLE_MASK = 16777215
HR_HMAC_SESSION = 33554432
HR_NV_AC = 30408704
HR_NV_INDEX = 16777216
HR_PCR = 0
HR_PERMANENT = 1073741824
HR_PERSISTENT = 2164260864
HR_POLICY_SESSION = 50331648
HR_RANGE_MASK = 4278190080
HR_SHIFT = 24
HR_TRANSIENT = 2147483648
LOADED_SESSION_FIRST = 33554432
LOADED_SESSION_LAST = 50331646
NV_AC_FIRST = 30408704
NV_AC_LAST = 30474239
NV_INDEX_FIRST = 16777216
NV_INDEX_LAST = 33554431
PCR_FIRST = 0
PCR_LAST = 32
PERMANENT_FIRST = 1073741824
PERMANENT_LAST = 1074069503
PERSISTENT_FIRST = 2164260864
PERSISTENT_LAST = 2181038079
PLATFORM_PERSISTENT = 2172649472
POLICY_SESSION_FIRST = 50331648
POLICY_SESSION_LAST = 67108862
TRANSIENT_FIRST = 2147483648
TRANSIENT_LAST = 2164260862
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_HR[source]
HANDLE_MASK = 16777215
HMAC_SESSION = 33554432
NV_INDEX = 16777216
PCR = 0
PERMANENT = 1073741824
PERSISTENT = 2164260864
POLICY_SESSION = 50331648
RANGE_MASK = 4278190080
SHIFT = 24
TRANSIENT = 2147483648
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_HT[source]
HMAC_SESSION = 2
LOADED_SESSION = 2
NV_INDEX = 1
PCR = 0
PERMANENT = 64
PERSISTENT = 129
POLICY_SESSION = 3
SAVED_SESSION = 3
TRANSIENT = 128
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_MAX[source]
ALG_LIST_SIZE = 128
CAP_BUFFER = 1024
CAP_CC = 256
CONTEXT_SIZE = 5120
DIGEST_BUFFER = 1024
NV_BUFFER_SIZE = 2048
PCRS = 32
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_NT[source]
BITS = 2
COUNTER = 1
EXTEND = 4
ORDINARY = 0
PIN_FAIL = 8
PIN_PASS = 9
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_PS[source]
AUTHENTICATION = 8
CELL_PHONE = 3
EMBEDDED = 9
HARDCOPY = 10
INFRASTRUCTURE = 11
MAIN = 0
MULTI_TENANT = 14
PC = 1
PDA = 2
PERIPHERAL = 5
SERVER = 4
STORAGE = 7
TC = 15
TNC = 13
TSS = 6
VIRTUALIZATION = 12
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_PT[source]
ACTIVE_SESSIONS_MAX = 273
ALGORITHM_SET = 524
CLOCK_UPDATE = 281
CONTEXT_GAP_MAX = 276
DAY_OF_YEAR = 259
FAMILY_INDICATOR = 256
FIXED = 256
GROUP = 256
INPUT_BUFFER = 269
LEVEL = 257
LIBRARY_COMMANDS = 298
LOADED_CURVES = 525
LOCKOUT_COUNTER = 526
LOCKOUT_INTERVAL = 528
LOCKOUT_RECOVERY = 529
MANUFACTURER = 261
MAX_AUTH_FAIL = 527
MAX_COMMAND_SIZE = 286
MAX_DIGEST = 288
MAX_OBJECT_CONTEXT = 289
MAX_RESPONSE_SIZE = 287
MAX_SESSION_CONTEXT = 290
MEMORY = 280
MODES = 301
NONE = 0
ORDERLY_COUNT = 285
PERMANENT = 512
REVISION = 258
SPLIT_MAX = 296
STARTUP_CLEAR = 513
TOTAL_COMMANDS = 297
VAR = 512
VENDOR_COMMANDS = 299
YEAR = 260
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_PT_AUDIT[source]
COUNTER_0 = 531
COUNTER_1 = 532
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_PT_CONTEXT[source]
HASH = 282
SYM = 283
SYM_SIZE = 284
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_PT_FIRMWARE[source]
VERSION_1 = 267
VERSION_2 = 268
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_PT_HR[source]
ACTIVE = 517
ACTIVE_AVAIL = 518
LOADED = 515
LOADED_AVAIL = 516
LOADED_MIN = 272
NV_INDEX = 514
PERSISTENT = 520
PERSISTENT_AVAIL = 521
PERSISTENT_MIN = 271
TRANSIENT_AVAIL = 519
TRANSIENT_MIN = 270
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_PT_NV[source]
BUFFER_MAX = 300
COUNTERS = 522
COUNTERS_AVAIL = 523
COUNTERS_MAX = 278
INDEX_MAX = 279
WRITE_RECOVERY = 530
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_PT_PCR[source]
AUTH = 20
COUNT = 274
DRTM_RESET = 18
EXTEND_L0 = 1
EXTEND_L1 = 3
EXTEND_L2 = 5
EXTEND_L3 = 7
EXTEND_L4 = 9
FIRST = 0
LAST = 20
NO_INCREMENT = 17
POLICY = 19
RESET_L0 = 2
RESET_L1 = 4
RESET_L2 = 6
RESET_L3 = 8
RESET_L4 = 10
SAVE = 0
SELECT_MIN = 275
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_PT_PS[source]
DAY_OF_YEAR = 294
FAMILY_INDICATOR = 291
LEVEL = 292
REVISION = 293
YEAR = 295
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_PT_VENDOR[source]
STRING_1 = 262
STRING_2 = 263
STRING_3 = 264
STRING_4 = 265
TPM_TYPE = 266
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_RC[source]
A = 2560
ASYMMETRIC = 129
ATTRIBUTES = 130
AUTHSIZE = 324
AUTH_CONTEXT = 325
AUTH_FAIL = 142
AUTH_MISSING = 293
AUTH_TYPE = 292
AUTH_UNAVAILABLE = 303
B = 2816
BAD_AUTH = 162
BAD_CONTEXT = 336
BAD_TAG = 30
BINDING = 165
C = 3072
CANCELED = 2313
COMMAND_CODE = 323
COMMAND_SIZE = 322
CONTEXT_GAP = 2305
CPHASH = 337
CURVE = 166
D = 3328
DISABLED = 288
E = 3584
ECC_POINT = 167
EXCLUSIVE = 289
EXPIRED = 163
F = 3840
FAILURE = 257
FMT1 = 128
FW_LIMITED = 168
H = 0
HANDLE = 139
HASH = 131
HIERARCHY = 133
HMAC = 281
INITIALIZE = 256
INSUFFICIENT = 154
INTEGRITY = 159
KDF = 140
KEY = 156
KEY_SIZE = 135
LOCALITY = 2311
LOCKOUT = 2337
MAX_FM0 = 383
MEMORY = 2308
MGF = 136
MODE = 137
NEEDS_TEST = 339
NONCE = 143
NOT_USED = 2431
NO_RESULT = 340
NV_AUTHORIZATION = 329
NV_DEFINED = 332
NV_LOCKED = 328
NV_RANGE = 326
NV_RATE = 2336
NV_SIZE = 327
NV_SPACE = 331
NV_UNAVAILABLE = 2339
NV_UNINITIALIZED = 330
N_MASK = 3840
OBJECT_HANDLES = 2310
OBJECT_MEMORY = 2306
P = 64
PARENT = 338
PCR = 295
PCR_CHANGED = 296
POLICY = 294
POLICY_CC = 164
POLICY_FAIL = 157
PP = 144
PRIVATE = 267
RANGE = 141
RC1 = 256
RC2 = 512
RC3 = 768
RC4 = 1024
RC5 = 1280
RC6 = 1536
RC7 = 1792
RC8 = 2048
RC9 = 2304
REBOOT = 304
REFERENCE_H0 = 2320
REFERENCE_H1 = 2321
REFERENCE_H2 = 2322
REFERENCE_H3 = 2323
REFERENCE_H4 = 2324
REFERENCE_H5 = 2325
REFERENCE_H6 = 2326
REFERENCE_S0 = 2328
REFERENCE_S1 = 2329
REFERENCE_S2 = 2330
REFERENCE_S3 = 2331
REFERENCE_S4 = 2332
REFERENCE_S5 = 2333
REFERENCE_S6 = 2334
RETRY = 2338
S = 2048
SCHEME = 146
SELECTOR = 152
SENSITIVE = 341
SEQUENCE = 259
SESSION_HANDLES = 2309
SESSION_MEMORY = 2307
SIGNATURE = 155
SIZE = 149
SUCCESS = 0
SVN_LIMITED = 169
SYMMETRIC = 150
TAG = 151
TESTING = 2314
TICKET = 160
TOO_MANY_CONTEXTS = 302
TYPE = 138
UNBALANCED = 305
UPGRADE = 301
VALUE = 132
VER1 = 256
WARN = 2304
YIELDED = 2312
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

decode()
marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_RH[source]
ACT_0 = 1073742096
ACT_1 = 1073742097
ACT_2 = 1073742098
ACT_3 = 1073742099
ACT_4 = 1073742100
ACT_5 = 1073742101
ACT_6 = 1073742102
ACT_7 = 1073742103
ACT_8 = 1073742104
ACT_9 = 1073742105
ACT_A = 1073742106
ACT_B = 1073742107
ACT_C = 1073742108
ACT_D = 1073742109
ACT_E = 1073742110
ACT_F = 1073742111
ADMIN = 1073741829
EK = 1073741830
ENDORSEMENT = 1073741835
FIRST = 1073741824
FW_ENDORSEMENT = 1073742145
FW_NULL = 1073742147
FW_OWNER = 1073742144
FW_PLATFORM = 1073742146
LAST = 1074069503
LOCKOUT = 1073741834
NULL = 1073741831
OPERATOR = 1073741828
OWNER = 1073741825
PLATFORM = 1073741836
PLATFORM_NV = 1073741837
PW = 1073741833
REVOKE = 1073741826
SRK = 1073741824
SVN_ENDORSEMENT_BASE = 1073872896
SVN_NULL_BASE = 1074003968
SVN_OWNER_BASE = 1073807360
SVN_PLATFORM_BASE = 1073938432
TRANSPORT = 1073741827
UNASSIGNED = 1073741832
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_SE[source]
HMAC = 0
POLICY = 1
TRIAL = 3
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_SPEC[source]
DAY_OF_YEAR = 312
FAMILY = 841887744
LEVEL = 0
VERSION = 159
YEAR = 2019
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_ST[source]
ATTEST_CERTIFY = 32791
ATTEST_COMMAND_AUDIT = 32789
ATTEST_CREATION = 32794
ATTEST_NV = 32788
ATTEST_QUOTE = 32792
ATTEST_SESSION_AUDIT = 32790
ATTEST_TIME = 32793
AUTH_SECRET = 32803
AUTH_SIGNED = 32805
CREATION = 32801
FU_MANIFEST = 32809
HASHCHECK = 32804
NO_SESSIONS = 32769
NULL = 32768
RSP_COMMAND = 196
SESSIONS = 32770
VERIFIED = 32802
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM2_SU[source]
CLEAR = 0
STATE = 1
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMA_ACT[source]
PRESERVESIGNALED = 1
SIGNALED = 0
__str__()

Given a constant, return the string bitwise representation.

Each constant is seperated by the “|” (pipe) character.

Returns:

a bitwise string value of the fields for the constant normalized to lowercase.

Return type:

(str)

Raises:

ValueError – If their are unmatched bits in the constant value.

Example

str(TPMA_NV(TPMA_NV.PPWRITE|TPMA_NV.ORDERLY|TPMA_NV.NO_DA)) -> ‘ppwrite|noda|orderly’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)

Converts a string of | separated constant values into it’s integer value.

Given a pipe “|” separated list of string constant values that represent the bitwise values returns the value itself. The value “” (empty string) returns a 0.

Parameters:

value (str) – The string “bitwise” expression of the object or the empty string.

Returns:

The integer result.

Raises:
  • TypeError – If the value is not a str.

  • ValueError – If a field portion of the str does not match a constant.

Examples

TPMA_NV.parse(“ppwrite|orderly|NO_DA”) -> 0x6000001 TPMA_NV.parse(“NO_DA”) -> 0x2000000

classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMA_ALGORITHM[source]
ASYMMETRIC = 1
ENCRYPTING = 512
HASH = 4
METHOD = 1024
OBJECT = 8
RESERVED1_MASK = 240
SIGNING = 256
SYMMETRIC = 2
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMA_CC[source]
CHANDLES_MASK = 234881024
CHANDLES_SHIFT = 25
COMMANDINDEX_MASK = 65535
COMMANDINDEX_SHIFT = 0
EXTENSIVE = 8388608
FLUSHED = 16777216
NV = 4194304
RESERVED1_MASK = 4128768
RES_MASK = 3221225472
RES_SHIFT = 30
RHANDLE = 268435456
V = 536870912
__str__()

Given a constant, return the string bitwise representation.

Each constant is seperated by the “|” (pipe) character.

Returns:

a bitwise string value of the fields for the constant normalized to lowercase.

Return type:

(str)

Raises:

ValueError – If their are unmatched bits in the constant value.

Example

str(TPMA_NV(TPMA_NV.PPWRITE|TPMA_NV.ORDERLY|TPMA_NV.NO_DA)) -> ‘ppwrite|noda|orderly’

property chandles

The number of handles in the handle area

Type:

int

property commandindex

The command index

Type:

int

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)

Converts a string of | separated constant values into it’s integer value.

Given a pipe “|” separated list of string constant values that represent the bitwise values returns the value itself. The value “” (empty string) returns a 0.

Parameters:

value (str) – The string “bitwise” expression of the object or the empty string.

Returns:

The integer result.

Raises:
  • TypeError – If the value is not a str.

  • ValueError – If a field portion of the str does not match a constant.

Examples

TPMA_NV.parse(“ppwrite|orderly|NO_DA”) -> 0x6000001 TPMA_NV.parse(“NO_DA”) -> 0x2000000

classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMA_FRIENDLY_INTLIST[source]
__str__()[source]

Given a constant, return the string bitwise representation.

Each constant is seperated by the “|” (pipe) character.

Returns:

a bitwise string value of the fields for the constant normalized to lowercase.

Return type:

(str)

Raises:

ValueError – If their are unmatched bits in the constant value.

Example

str(TPMA_NV(TPMA_NV.PPWRITE|TPMA_NV.ORDERLY|TPMA_NV.NO_DA)) -> ‘ppwrite|noda|orderly’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)[source]

Converts a string of | separated constant values into it’s integer value.

Given a pipe “|” separated list of string constant values that represent the bitwise values returns the value itself. The value “” (empty string) returns a 0.

Parameters:

value (str) – The string “bitwise” expression of the object or the empty string.

Returns:

The integer result.

Raises:
  • TypeError – If the value is not a str.

  • ValueError – If a field portion of the str does not match a constant.

Examples

TPMA_NV.parse(“ppwrite|orderly|NO_DA”) -> 0x6000001 TPMA_NV.parse(“NO_DA”) -> 0x2000000

classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMA_LOCALITY[source]
EXTENDED_MASK = 224
EXTENDED_SHIFT = 5
FOUR = 16
ONE = 2
THREE = 8
TWO = 4
ZERO = 1
__str__()[source]

Given a set of localities or an extended locality, return the string representation

Returns:

a bitwise string value of the localities or the exteded locality.

Return type:

(str)

Example

str(TPMA_LOCALITY.THREE|TPMA_LOCALITY.FOUR) -> ‘three|four’ str(TPMA_LOCALITY(0xf0)) -> ‘0xf0’

classmethod create_extended(value)[source]
marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)[source]

Converts a string of | separated localities or an extended locality into a TPMA_LOCALITY instance

Parameters:

value (str) – The string “bitwise” expression of the localities or the extended locality.

Returns:

The locality or set of localities as a TPMA_LOCALITY instance.

Raises:
  • TypeError – If the value is not a str.

  • ValueError – If a field portion of the str does not match a constant.

Examples

TPMA_LOCALITY.parse(“zero|one”) -> 0x03 TPMA_LOCALITY.parse(“0xf0”) -> 0xf0

classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMA_MEMORY[source]
OBJECTCOPIEDTORAM = 4
SHAREDNV = 2
SHAREDRAM = 1
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMA_MODES[source]
FIPS_140_2 = 1
RESERVED1_MASK = 4294967294
__str__()

Given a constant, return the string bitwise representation.

Each constant is seperated by the “|” (pipe) character.

Returns:

a bitwise string value of the fields for the constant normalized to lowercase.

Return type:

(str)

Raises:

ValueError – If their are unmatched bits in the constant value.

Example

str(TPMA_NV(TPMA_NV.PPWRITE|TPMA_NV.ORDERLY|TPMA_NV.NO_DA)) -> ‘ppwrite|noda|orderly’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)

Converts a string of | separated constant values into it’s integer value.

Given a pipe “|” separated list of string constant values that represent the bitwise values returns the value itself. The value “” (empty string) returns a 0.

Parameters:

value (str) – The string “bitwise” expression of the object or the empty string.

Returns:

The integer result.

Raises:
  • TypeError – If the value is not a str.

  • ValueError – If a field portion of the str does not match a constant.

Examples

TPMA_NV.parse(“ppwrite|orderly|NO_DA”) -> 0x6000001 TPMA_NV.parse(“NO_DA”) -> 0x2000000

classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMA_NV[source]
AUTHREAD = 262144
AUTHWRITE = 4
CLEAR_STCLEAR = 134217728
GLOBALLOCK = 32768
NO_DA = 33554432
ORDERLY = 67108864
OWNERREAD = 131072
OWNERWRITE = 2
PLATFORMCREATE = 1073741824
POLICYREAD = 524288
POLICYWRITE = 8
POLICY_DELETE = 1024
PPREAD = 65536
PPWRITE = 1
READLOCKED = 268435456
READ_STCLEAR = 2147483648
TPM2_NT_MASK = 240
TPM2_NT_SHIFT = 4
WRITEALL = 4096
WRITEDEFINE = 8192
WRITELOCKED = 2048
WRITE_STCLEAR = 16384
WRITTEN = 536870912
__str__()

Given a constant, return the string bitwise representation.

Each constant is seperated by the “|” (pipe) character.

Returns:

a bitwise string value of the fields for the constant normalized to lowercase.

Return type:

(str)

Raises:

ValueError – If their are unmatched bits in the constant value.

Example

str(TPMA_NV(TPMA_NV.PPWRITE|TPMA_NV.ORDERLY|TPMA_NV.NO_DA)) -> ‘ppwrite|noda|orderly’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

property nt

The type of the NV area

Type:

TPM2_NT

classmethod parse(value)

Converts a string of | separated constant values into it’s integer value.

Given a pipe “|” separated list of string constant values that represent the bitwise values returns the value itself. The value “” (empty string) returns a 0.

Parameters:

value (str) – The string “bitwise” expression of the object or the empty string.

Returns:

The integer result.

Raises:
  • TypeError – If the value is not a str.

  • ValueError – If a field portion of the str does not match a constant.

Examples

TPMA_NV.parse(“ppwrite|orderly|NO_DA”) -> 0x6000001 TPMA_NV.parse(“NO_DA”) -> 0x2000000

classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMA_OBJECT[source]
ADMINWITHPOLICY = 128
DECRYPT = 131072
DEFAULT_TPM2_TOOLS_CREATEPRIMARY_ATTRS = 196722
DEFAULT_TPM2_TOOLS_CREATE_ATTRS = 393330
ENCRYPTEDDUPLICATION = 2048
FIRMWARELIMITED = 256
FIXEDPARENT = 16
FIXEDTPM = 2
NODA = 1024
RESTRICTED = 65536
SENSITIVEDATAORIGIN = 32
SIGN_ENCRYPT = 262144
STCLEAR = 4
SVNLIMITED = 512
USERWITHAUTH = 64
X509SIGN = 524288
__str__()

Given a constant, return the string bitwise representation.

Each constant is seperated by the “|” (pipe) character.

Returns:

a bitwise string value of the fields for the constant normalized to lowercase.

Return type:

(str)

Raises:

ValueError – If their are unmatched bits in the constant value.

Example

str(TPMA_NV(TPMA_NV.PPWRITE|TPMA_NV.ORDERLY|TPMA_NV.NO_DA)) -> ‘ppwrite|noda|orderly’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)

Converts a string of | separated constant values into it’s integer value.

Given a pipe “|” separated list of string constant values that represent the bitwise values returns the value itself. The value “” (empty string) returns a 0.

Parameters:

value (str) – The string “bitwise” expression of the object or the empty string.

Returns:

The integer result.

Raises:
  • TypeError – If the value is not a str.

  • ValueError – If a field portion of the str does not match a constant.

Examples

TPMA_NV.parse(“ppwrite|orderly|NO_DA”) -> 0x6000001 TPMA_NV.parse(“NO_DA”) -> 0x2000000

classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMA_PERMANENT[source]
DISABLECLEAR = 256
ENDORSEMENTAUTHSET = 2
INLOCKOUT = 512
LOCKOUTAUTHSET = 4
OWNERAUTHSET = 1
RESERVED1_MASK = 248
RESERVED2_MASK = 4294965248
TPMGENERATEDEPS = 1024
__str__()

Given a constant, return the string bitwise representation.

Each constant is seperated by the “|” (pipe) character.

Returns:

a bitwise string value of the fields for the constant normalized to lowercase.

Return type:

(str)

Raises:

ValueError – If their are unmatched bits in the constant value.

Example

str(TPMA_NV(TPMA_NV.PPWRITE|TPMA_NV.ORDERLY|TPMA_NV.NO_DA)) -> ‘ppwrite|noda|orderly’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)

Converts a string of | separated constant values into it’s integer value.

Given a pipe “|” separated list of string constant values that represent the bitwise values returns the value itself. The value “” (empty string) returns a 0.

Parameters:

value (str) – The string “bitwise” expression of the object or the empty string.

Returns:

The integer result.

Raises:
  • TypeError – If the value is not a str.

  • ValueError – If a field portion of the str does not match a constant.

Examples

TPMA_NV.parse(“ppwrite|orderly|NO_DA”) -> 0x6000001 TPMA_NV.parse(“NO_DA”) -> 0x2000000

classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMA_SESSION[source]
AUDIT = 128
AUDITEXCLUSIVE = 2
AUDITRESET = 4
CONTINUESESSION = 1
DECRYPT = 32
ENCRYPT = 64
__str__()

Given a constant, return the string bitwise representation.

Each constant is seperated by the “|” (pipe) character.

Returns:

a bitwise string value of the fields for the constant normalized to lowercase.

Return type:

(str)

Raises:

ValueError – If their are unmatched bits in the constant value.

Example

str(TPMA_NV(TPMA_NV.PPWRITE|TPMA_NV.ORDERLY|TPMA_NV.NO_DA)) -> ‘ppwrite|noda|orderly’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)

Converts a string of | separated constant values into it’s integer value.

Given a pipe “|” separated list of string constant values that represent the bitwise values returns the value itself. The value “” (empty string) returns a 0.

Parameters:

value (str) – The string “bitwise” expression of the object or the empty string.

Returns:

The integer result.

Raises:
  • TypeError – If the value is not a str.

  • ValueError – If a field portion of the str does not match a constant.

Examples

TPMA_NV.parse(“ppwrite|orderly|NO_DA”) -> 0x6000001 TPMA_NV.parse(“NO_DA”) -> 0x2000000

classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMA_STARTUP[source]
CLEAR_EHENABLE = 4
CLEAR_ORDERLY = 2147483648
CLEAR_PHENABLE = 1
CLEAR_PHENABLENV = 8
CLEAR_RESERVED1_MASK = 2147483632
CLEAR_SHENABLE = 2
__str__()

Given a constant, return the string bitwise representation.

Each constant is seperated by the “|” (pipe) character.

Returns:

a bitwise string value of the fields for the constant normalized to lowercase.

Return type:

(str)

Raises:

ValueError – If their are unmatched bits in the constant value.

Example

str(TPMA_NV(TPMA_NV.PPWRITE|TPMA_NV.ORDERLY|TPMA_NV.NO_DA)) -> ‘ppwrite|noda|orderly’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)

Converts a string of | separated constant values into it’s integer value.

Given a pipe “|” separated list of string constant values that represent the bitwise values returns the value itself. The value “” (empty string) returns a 0.

Parameters:

value (str) – The string “bitwise” expression of the object or the empty string.

Returns:

The integer result.

Raises:
  • TypeError – If the value is not a str.

  • ValueError – If a field portion of the str does not match a constant.

Examples

TPMA_NV.parse(“ppwrite|orderly|NO_DA”) -> 0x6000001 TPMA_NV.parse(“NO_DA”) -> 0x2000000

classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMA_X509_KEY_USAGE[source]
CRLSIGN = 33554432
DATAENCIPHERMENT = 268435456
DECIPHER_ONLY = 8388608
DIGITALSIGNATURE = 2147483648
ENCIPHER_ONLY = 16777216
KEYAGREEMENT = 134217728
KEYCERTSIGN = 67108864
KEYENCIPHERMENT = 536870912
NONREPUDIATION = 1073741824
__str__()

Given a constant, return the string bitwise representation.

Each constant is seperated by the “|” (pipe) character.

Returns:

a bitwise string value of the fields for the constant normalized to lowercase.

Return type:

(str)

Raises:

ValueError – If their are unmatched bits in the constant value.

Example

str(TPMA_NV(TPMA_NV.PPWRITE|TPMA_NV.ORDERLY|TPMA_NV.NO_DA)) -> ‘ppwrite|noda|orderly’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)

Converts a string of | separated constant values into it’s integer value.

Given a pipe “|” separated list of string constant values that represent the bitwise values returns the value itself. The value “” (empty string) returns a 0.

Parameters:

value (str) – The string “bitwise” expression of the object or the empty string.

Returns:

The integer result.

Raises:
  • TypeError – If the value is not a str.

  • ValueError – If a field portion of the str does not match a constant.

Examples

TPMA_NV.parse(“ppwrite|orderly|NO_DA”) -> 0x6000001 TPMA_NV.parse(“NO_DA”) -> 0x2000000

classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPMI_YES_NO[source]
NO = 0
YES = 1
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM_AT[source]
ANY = 0
ERROR = 1
PV1 = 2
VEND = 2147483648
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM_BASE_RC[source]
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

decode()[source]
marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM_FRIENDLY_INT[source]
__str__()[source]

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)[source]
classmethod to_string(value)[source]

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TPM_FRIENDLY_ITER[source]

Metaclass to make constants classes iterable

__str__()

Return str(self).

mro()

Return a type’s method resolution order.

class tpm2_pytss.constants.TPM_INT_MU[source]

Mixin class for marshaling/unmarshaling int types.

__str__()

Return str(self).

marshal()[source]

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod unmarshal(buf)[source]

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.constants.TSS2_POLICY_PCR_SELECTOR[source]
PCR_SELECT = 0
PCR_SELECTION = 1
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.constants.TSS2_RC[source]
BASE_RC_ABI_MISMATCH = 4
BASE_RC_ALREADY_PROVISIONED = 53
BASE_RC_AUTHORIZATION_FAILED = 41
BASE_RC_AUTHORIZATION_UNKNOWN = 42
BASE_RC_BAD_CONTEXT = 3
BASE_RC_BAD_KEY = 50
BASE_RC_BAD_PATH = 29
BASE_RC_BAD_REFERENCE = 5
BASE_RC_BAD_SEQUENCE = 7
BASE_RC_BAD_SIZE = 16
BASE_RC_BAD_TCTI_STRUCTURE = 22
BASE_RC_BAD_TEMPLATE = 40
BASE_RC_BAD_TR = 24
BASE_RC_BAD_VALUE = 11
BASE_RC_CALLBACK_NULL = 54
BASE_RC_GENERAL_FAILURE = 1
BASE_RC_HASH_MISMATCH = 34
BASE_RC_INCOMPATIBLE_TCTI = 20
BASE_RC_INSUFFICIENT_BUFFER = 6
BASE_RC_INSUFFICIENT_CONTEXT = 18
BASE_RC_INSUFFICIENT_RESPONSE = 19
BASE_RC_INVALID_SESSIONS = 13
BASE_RC_IO_ERROR = 10
BASE_RC_KEY_NOT_DUPLICABLE = 35
BASE_RC_KEY_NOT_FOUND = 32
BASE_RC_MALFORMED_RESPONSE = 17
BASE_RC_MEMORY = 23
BASE_RC_MULTIPLE_DECRYPT_SESSIONS = 25
BASE_RC_MULTIPLE_ENCRYPT_SESSIONS = 26
BASE_RC_NAME_ALREADY_EXISTS = 48
BASE_RC_NOT_DELETABLE = 30
BASE_RC_NOT_IMPLEMENTED = 2
BASE_RC_NOT_PERMITTED = 12
BASE_RC_NOT_PROVISIONED = 52
BASE_RC_NOT_SUPPORTED = 21
BASE_RC_NO_CERT = 37
BASE_RC_NO_CONFIG = 28
BASE_RC_NO_CONNECTION = 8
BASE_RC_NO_DECRYPT_PARAM = 14
BASE_RC_NO_ENCRYPT_PARAM = 15
BASE_RC_NO_HANDLE = 51
BASE_RC_NO_PCR = 38
BASE_RC_NO_TPM = 49
BASE_RC_NV_NOT_READABLE = 43
BASE_RC_NV_NOT_WRITEABLE = 45
BASE_RC_NV_TOO_SMALL = 44
BASE_RC_NV_WRONG_TYPE = 47
BASE_RC_PATH_ALREADY_EXISTS = 31
BASE_RC_PATH_NOT_FOUND = 36
BASE_RC_PCR_NOT_RESETTABLE = 39
BASE_RC_POLICY_UNKNOWN = 46
BASE_RC_RSP_AUTH_FAILED = 27
BASE_RC_SIGNATURE_VERIFICATION_FAILED = 33
BASE_RC_TRY_AGAIN = 9
ESAPI_RC_LAYER = 458752
ESYS_RC_ABI_MISMATCH = 458756
ESYS_RC_BAD_REFERENCE = 458757
ESYS_RC_BAD_SEQUENCE = 458759
ESYS_RC_BAD_SIZE = 458768
ESYS_RC_BAD_TCTI_STRUCTURE = 458774
ESYS_RC_BAD_TR = 458776
ESYS_RC_BAD_VALUE = 458763
ESYS_RC_GENERAL_FAILURE = 458753
ESYS_RC_INCOMPATIBLE_TCTI = 458772
ESYS_RC_INSUFFICIENT_BUFFER = 458758
ESYS_RC_INSUFFICIENT_CONTEXT = 458770
ESYS_RC_INSUFFICIENT_RESPONSE = 458771
ESYS_RC_INVALID_SESSIONS = 458765
ESYS_RC_IO_ERROR = 458762
ESYS_RC_MALFORMED_RESPONSE = 458769
ESYS_RC_MEMORY = 458775
ESYS_RC_MULTIPLE_DECRYPT_SESSIONS = 458777
ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS = 458778
ESYS_RC_NOT_IMPLEMENTED = 458754
ESYS_RC_NO_DECRYPT_PARAM = 458766
ESYS_RC_NO_ENCRYPT_PARAM = 458767
ESYS_RC_RSP_AUTH_FAILED = 458779
ESYS_RC_TRY_AGAIN = 458761
FAPI_RC_ALREADY_PROVISIONED = 393269
FAPI_RC_AUTHORIZATION_FAILED = 393257
FAPI_RC_AUTHORIZATION_UNKNOWN = 393258
FAPI_RC_BAD_CONTEXT = 393219
FAPI_RC_BAD_KEY = 393266
FAPI_RC_BAD_PATH = 393245
FAPI_RC_BAD_REFERENCE = 393221
FAPI_RC_BAD_SEQUENCE = 393223
FAPI_RC_BAD_TEMPLATE = 393256
FAPI_RC_BAD_VALUE = 393227
FAPI_RC_GENERAL_FAILURE = 393217
FAPI_RC_HASH_MISMATCH = 393250
FAPI_RC_IO_ERROR = 393226
FAPI_RC_KEY_NOT_DUPLICABLE = 393251
FAPI_RC_KEY_NOT_FOUND = 393248
FAPI_RC_MEMORY = 393239
FAPI_RC_NAME_ALREADY_EXISTS = 393264
FAPI_RC_NOT_DELETABLE = 393246
FAPI_RC_NOT_IMPLEMENTED = 393218
FAPI_RC_NOT_PROVISIONED = 393268
FAPI_RC_NO_CERT = 393253
FAPI_RC_NO_CONFIG = 393244
FAPI_RC_NO_DECRYPT_PARAM = 393230
FAPI_RC_NO_ENCRYPT_PARAM = 393231
FAPI_RC_NO_HANDLE = 393267
FAPI_RC_NO_PCR = 393254
FAPI_RC_NO_TPM = 393265
FAPI_RC_NV_NOT_READABLE = 393259
FAPI_RC_NV_NOT_WRITEABLE = 393261
FAPI_RC_NV_TOO_SMALL = 393260
FAPI_RC_NV_WRONG_TYPE = 393263
FAPI_RC_PATH_ALREADY_EXISTS = 393247
FAPI_RC_PATH_NOT_FOUND = 393252
FAPI_RC_PCR_NOT_RESETTABLE = 393255
FAPI_RC_POLICY_UNKNOWN = 393262
FAPI_RC_SIGNATURE_VERIFICATION_FAILED = 393249
FAPI_RC_TRY_AGAIN = 393225
FEATURE_RC_LAYER = 393216
LAYER_IMPLEMENTATION_SPECIFIC_OFFSET = 63488
LEVEL_IMPLEMENTATION_SPECIFIC_SHIFT = 11
MU_RC_BAD_REFERENCE = 589829
MU_RC_BAD_SIZE = 589840
MU_RC_BAD_VALUE = 589835
MU_RC_GENERAL_FAILURE = 589825
MU_RC_INSUFFICIENT_BUFFER = 589830
MU_RC_LAYER = 589824
POLICY_RC_AUTHORIZATION_UNKNOWN = 852010
POLICY_RC_BAD_REFERENCE = 851973
POLICY_RC_BAD_TEMPLATE = 852008
POLICY_RC_BAD_VALUE = 851979
POLICY_RC_BUFFER_TOO_SMALL = 851984
POLICY_RC_GENERAL_FAILURE = 851969
POLICY_RC_IO_ERROR = 851978
POLICY_RC_LAYER = 851968
POLICY_RC_MEMORY = 851991
POLICY_RC_NULL_CALLBACK = 852022
POLICY_RC_POLICY_NOT_CALCULATED = 852020
RC_LAYER_MASK = 16711680
RC_LAYER_SHIFT = 16
RC_SUCCESS = 0
RESMGR_RC_LAYER = 720896
RESMGR_TPM_RC_LAYER = 786432
SYS_RC_ABI_MISMATCH = 524292
SYS_RC_BAD_REFERENCE = 524293
SYS_RC_BAD_SEQUENCE = 524295
SYS_RC_BAD_SIZE = 524304
SYS_RC_BAD_TCTI_STRUCTURE = 524310
SYS_RC_BAD_VALUE = 524299
SYS_RC_GENERAL_FAILURE = 524289
SYS_RC_INCOMPATIBLE_TCTI = 524308
SYS_RC_INSUFFICIENT_BUFFER = 524294
SYS_RC_INSUFFICIENT_CONTEXT = 524306
SYS_RC_INSUFFICIENT_RESPONSE = 524307
SYS_RC_INVALID_SESSIONS = 524301
SYS_RC_LAYER = 524288
SYS_RC_MALFORMED_RESPONSE = 524305
SYS_RC_NO_DECRYPT_PARAM = 524302
SYS_RC_NO_ENCRYPT_PARAM = 524303
TCTI_RC_ABI_MISMATCH = 655364
TCTI_RC_BAD_CONTEXT = 655363
TCTI_RC_BAD_REFERENCE = 655365
TCTI_RC_BAD_SEQUENCE = 655367
TCTI_RC_BAD_VALUE = 655371
TCTI_RC_GENERAL_FAILURE = 655361
TCTI_RC_INSUFFICIENT_BUFFER = 655366
TCTI_RC_IO_ERROR = 655370
TCTI_RC_LAYER = 655360
TCTI_RC_MALFORMED_RESPONSE = 655377
TCTI_RC_MEMORY = 655383
TCTI_RC_NOT_IMPLEMENTED = 655362
TCTI_RC_NOT_PERMITTED = 655372
TCTI_RC_NOT_SUPPORTED = 655381
TCTI_RC_NO_CONNECTION = 655368
TCTI_RC_TRY_AGAIN = 655369
TPM_RC_LAYER = 0
__str__()

Returns a string value of the constant normalized to lowercase.

Returns:

a string value of the constant normalized to lowercase.

Return type:

(str)

Example

str(ESYS_TR.PCR2) -> ‘pcr2’

decode()
marshal()

Marshal instance into bytes.

Returns:

Returns the marshaled type as bytes.

classmethod parse(value)
classmethod to_string(value)

Converts an integer value into it’s friendly string name for that class.

Parameters:

value (int) – The raw numerical number to try and convert to a name.

Returns:

The string of the constant defining the raw numeric.

Return type:

(str)

Raises:

ValueError – If the numeric does not match a constant.

Example

ESYS_TR.to_string(5) -> ‘ESYS_TR.PCR5’

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.