示例#1
0
文件: tpm.go 项目: carriercomm/pond
func (c *Context) NewRSA() (*RSA, error) {
	rsa := new(RSA)
	if result := C.Tspi_Context_CreateObject(c.ctx, C.TSS_OBJECT_TYPE_RSAKEY, C.TSS_KEY_TSP_SRK|C.TSS_KEY_AUTHORIZATION, &rsa.handle); isError(result) {
		return nil, Error{result}
	}

	return rsa, nil
}
示例#2
0
文件: tpm.go 项目: carriercomm/pond
func (c *Context) NewNVRAM() (*NVRAM, error) {
	nv := new(NVRAM)
	if result := C.Tspi_Context_CreateObject(c.ctx, C.TSS_OBJECT_TYPE_NV, 0, &nv.handle); isError(result) {
		return nil, Error{result}
	}

	return nv, nil
}
示例#3
0
文件: tpm.go 项目: carriercomm/pond
func (c *Context) NewPolicy() (*Policy, error) {
	p := new(Policy)
	if result := C.Tspi_Context_CreateObject(c.ctx, C.TSS_OBJECT_TYPE_POLICY, C.TSS_POLICY_USAGE, (*C.TSS_HOBJECT)(&p.policy)); isError(result) {
		return nil, Error{result}
	}

	return p, nil
}
示例#4
0
文件: context.go 项目: krnowak/rkt
// CreatePCRs creates an object referring to a TSS PCR composite. It returns
// a reference to the object plus any error.
func (context *Context) CreatePCRs(flags int) (*PCRs, error) {
	var handle C.TSS_HPCRS
	err := tspiError(C.Tspi_Context_CreateObject(context.context, C.TSS_OBJECT_TYPE_PCRS, (C.TSS_FLAG)(flags), (*C.TSS_HOBJECT)(&handle)))
	return &PCRs{handle: handle, context: context.context}, err
}
示例#5
0
文件: context.go 项目: krnowak/rkt
// CreatePolicy creates an object referring to a TSS policy. It returns a
// reference to the object plus any error.
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
}
示例#6
0
文件: context.go 项目: krnowak/rkt
// CreateKey creates a TSS object referring to a TPM key. It returns a
// reference to the object and any error.
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
}
示例#7
0
文件: context.go 项目: krnowak/rkt
// CreateNV creates a TSS object referring to a TPM NVRAM area. It returns a
// reference to the object and any error.
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
}