tpmlib

package module
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 21 Imported by: 1

README

GoDoc

tpmlib

Simple library to connect to local tpm, generate a local key and use it as a signer.

Usage

import "github.com/KarpelesLab/tpmlib"

func signSomething(v []byte) ([]byte, error) {
    k, err := tpmlib.GetKey()
    if err != nil {
        return nil, err
    }
    return k.Sign(rand.Reader, cryptutil.Hash(v, crypto.SHA256), crypto.SHA256)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenTPM

func OpenTPM() (io.ReadWriteCloser, error)

OpenTPM connects to the local TPM. Mutliple calls will always return the same connection.

Types

type Intf

type Intf interface {
	crypto.Signer
	ECDH(remote *ecdh.PublicKey) ([]byte, error) // perform ECDH operations
	ECDHPublic() (*ecdh.PublicKey, error)        // return the local public key for ECDH operations
	Keychain() *cryptutil.Keychain               // returns a keychain containing all the relevant keys
	IDCard() (*cryptutil.IDCard, error)          // return a non-signed ID Card with the keys listed in
}

Intf is the generic interface for TPM

func GetKey

func GetKey() (Intf, error)

GetKey returns an object that corresponds to the local machine's TPM. Multiple calls of GetKey will return the same object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL