Ejemplo n.º 1
0
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
}
Ejemplo n.º 2
0
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
}
Ejemplo n.º 3
0
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
}
Ejemplo n.º 4
0
// 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
}
Ejemplo n.º 5
0
// 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
}
Ejemplo n.º 6
0
// 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
}
Ejemplo n.º 7
0
// 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
}