func (context *Context) CreatePolicy(flags int) (*Policy, error) {
	var handle C.TSS_HPOLICY
	err := tspiError(C.Tspi_Context_CreateObject(context.context, C.TSS_OBJECT_TYPE_POLICY, (C.TSS_FLAG)(flags), (*C.TSS_HOBJECT)(&handle)))
	return &Policy{handle: handle, context: context.context}, err
}
CreatePolicy creates an object referring to a TSS policy. It returns a
reference to the object plus any error.
package tspi
import "C"
import (
	"crypto"
	"unsafe"
)
type Context struct {
	context C.TSS_HCONTEXT
	tpm     TPM
}
func NewContext() (*Context, error) {
	context := new(Context)
	err := tspiError(C.Tspi_Context_Create(&context.context))
	return context, err
}
func (context *Context) Connect() error {
	var tpmhandle C.TSS_HTPM
	err := tspiError(C.Tspi_Context_Connect(context.context, nil))
	if err != nil {
		return err
	}
	C.Tspi_Context_GetTpmObject(context.context, &tpmhandle)
	context.tpm = TPM{handle: tpmhandle, context: context.context}
	return nil
}
func (context *Context) Close() error {
	err := tspiError(C.Tspi_Context_Close(context.context))
	return err
}
func (context *Context) CreateNV() (*NV, error) {
	var handle C.TSS_HNVSTORE
	err := tspiError(C.Tspi_Context_CreateObject(context.context, C.TSS_OBJECT_TYPE_NV, 0, (*C.TSS_HOBJECT)(&handle)))
	return &NV{handle: handle, context: context.context}, err
}
func (context *Context) CreateKey(flags int) (*Key, error) {
	var handle C.TSS_HKEY
	err := tspiError(C.Tspi_Context_CreateObject(context.context, C.TSS_OBJECT_TYPE_RSAKEY, (C.TSS_FLAG)(flags), (*C.TSS_HOBJECT)(&handle)))
	return &Key{handle: handle, context: context.context}, err
}
func (context *Context) LoadKeyByUUID(storetype int, uuid C.TSS_UUID) (*Key, error) {
	var handle C.TSS_HKEY
	err := tspiError(C.Tspi_Context_LoadKeyByUUID(context.context, (C.TSS_FLAG)(storetype), uuid, &handle))
	return &Key{handle: handle, context: context.context}, err
}
func (context *Context) LoadKeyByBlob(parent *Key, blob []byte) (*Key, error) {
	var handle C.TSS_HKEY
	err := tspiError(C.Tspi_Context_LoadKeyByBlob(context.context, parent.handle, (C.UINT32)(len(blob)), (*C.BYTE)(unsafe.Pointer(&blob[0])), &handle))
	return &Key{handle: handle, context: context.context}, err
}
func (context *Context) GetTPM() *TPM {
	return &context.tpm
}