func (l Locality) String() string {
	var retString strings.Builder
	for iterator, item := range locaMap {
		if l&iterator != 0 {
			retString.WriteString(item + " + ")
		}
	}
	if retString.String() == "" {
		return fmt.Sprintf("locality %d", int(l))
	}
	return strings.TrimSuffix(retString.String(), " + ")
}
// String returns a textual representation of the set of Localities
package tpm
import (
	"fmt"
	"strings"
	"github.com/google/go-tpm/tpmutil"
)
const (
	tagPCRInfoLong     uint16 = 0x06
	tagNVAttributes    uint16 = 0x0017
	tagNVDataPublic    uint16 = 0x0018
	tagRQUCommand      uint16 = 0x00C1
	tagRQUAuth1Command uint16 = 0x00C2
	tagRQUAuth2Command uint16 = 0x00C3
	tagRSPCommand      uint16 = 0x00C4
	tagRSPAuth1Command uint16 = 0x00C5
	tagRSPAuth2Command uint16 = 0x00C6
)
const (
	ordOIAP                     uint32 = 0x0000000A
	ordOSAP                     uint32 = 0x0000000B
	ordTakeOwnership            uint32 = 0x0000000D
	ordExtend                   uint32 = 0x00000014
	ordPCRRead                  uint32 = 0x00000015
	ordQuote                    uint32 = 0x00000016
	ordSeal                     uint32 = 0x00000017
	ordUnseal                   uint32 = 0x00000018
	ordCreateWrapKey            uint32 = 0x0000001F
	ordGetPubKey                uint32 = 0x00000021
	ordCreateMigrationBlob      uint32 = 0x00000028
	ordAuthorizeMigrationKey    uint32 = 0x0000002b
	ordSign                     uint32 = 0x0000003C
	ordQuote2                   uint32 = 0x0000003E
	ordResetLockValue           uint32 = 0x00000040
	ordLoadKey2                 uint32 = 0x00000041
	ordGetRandom                uint32 = 0x00000046
	ordOwnerClear               uint32 = 0x0000005B
	ordForceClear               uint32 = 0x0000005D
	ordGetCapability            uint32 = 0x00000065
	ordCreateEndorsementKeyPair uint32 = 0x00000078
	ordMakeIdentity             uint32 = 0x00000079
	ordActivateIdentity         uint32 = 0x0000007A
	ordReadPubEK                uint32 = 0x0000007C
	ordOwnerReadInternalPub     uint32 = 0x00000081
	ordStartup                  uint32 = 0x00000099
	ordFlushSpecific            uint32 = 0x000000BA
	ordNVDefineSpace            uint32 = 0x000000CC
	ordPcrReset                 uint32 = 0x000000C8
	ordNVWriteValue             uint32 = 0x000000CD
	ordNVWriteValueAuth         uint32 = 0x000000CE
	ordNVReadValue              uint32 = 0x000000CF
	ordNVReadValueAuth          uint32 = 0x000000D0
)
const (
	CapAlg      uint32 = 0x00000002
	CapProperty uint32 = 0x00000005
	CapFlag     uint32 = 0x00000004
	CapNVList   uint32 = 0x0000000D
	CapNVIndex  uint32 = 0x00000011
	CapHandle   uint32 = 0x00000014
	CapVersion  uint32 = 0x0000001A
)
const (
	SubCapPropManufacturer uint32 = 0x00000103
	SubCapFlagPermanent    uint32 = 0x00000108
)
type Permission uint32
const (
	NVPerPPWrite    Permission = 0x00000001
	NVPerOwnerWrite Permission = 0x00000002
	NVPerAuthWrite  Permission = 0x00000004
	NVPerWriteAll   Permission = 0x00000800
	NVPerWriteSTClear Permission = 0x00002000
	NVPerGlobalLock   Permission = 0x00004000
	NVPerPPRead       Permission = 0x00008000
	NVPerOwnerRead    Permission = 0x00100000
	NVPerAuthRead     Permission = 0x00200000
	NVPerReadSTClear  Permission = 0x80000000
)
var permMap = map[Permission]string{
	NVPerPPWrite:      "PPWrite",
	NVPerOwnerWrite:   "OwnerWrite",
	NVPerAuthWrite:    "AuthWrite",
	NVPerWriteAll:     "WriteAll",
	NVPerWriteSTClear: " WriteSTClear",
	NVPerGlobalLock:   "GlobalLock",
	NVPerPPRead:       "PPRead",
	NVPerOwnerRead:    "OwnerRead",
	NVPerAuthRead:     "AuthRead",
	NVPerReadSTClear:  "ReadSTClear",
}
func (p Permission) String() string {
	var retString strings.Builder
	for iterator, item := range permMap {
		if (p & iterator) != 0 {
			retString.WriteString(item + " + ")
		}
	}
	if retString.String() == "" {
		return "Permission/s not found"
	}
	return strings.TrimSuffix(retString.String(), " + ")
}
const (
	_ uint16 = iota
	etKeyHandle
	etOwner
	etData
	etSRK
	etKey
	etRevoke
)
const (
	_ uint32 = iota
	rtKey
	rtAuth
	rtHash
	rtTrans
)
type Locality byte
const (
	LocZero Locality = 1 << iota
	LocOne
	LocTwo
	LocThree
	LocFour
)
var locaMap = map[Locality]string{
	LocZero:  "Locality 0",
	LocOne:   "Locality 1",
	LocTwo:   "Locality 2",
	LocThree: "Locality 3",
	LocFour:  "Locality 4",
}