Help us shape the future of Go! Take the 2026 Go Developer Survey

tkeysign

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: GPL-2.0 Imports: 4 Imported by: 0

README

RSA TKey Sign package

Fork of: https://github.com/tillitis/tkeysign

A Go package for communicating with the rsa-signer device app on a Tillitis TKey to get (RSA) cryptographic signatures over a message.

Documentation

Overview

Package tkeysign provides a connection to the RSA signer app running on the TKey. You're expected to pass an existing connection to it, so use it like this:

tk := tkeyclient.New()
err := tk.Connect(port)
signer := tkeysign.New(tk)

Then use it like this to get the public key of the TKey:

pubkey, err := signer.GetPubkey()

And like this to sign a message:

signature, err := signer.Sign(message)

Index

Constants

View Source
const MaxSignSize = 4096

Variables

This section is empty.

Functions

This section is empty.

Types

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

func New

func New(tk *tkeyclient.TillitisKey) Signer

New allocates a struct for communicating with the RSA signer app running on the TKey. You're expected to pass an existing connection to it, so use it like this:

tk := tkeyclient.New()
err := tk.Connect(port)
signer := tk1sign.New(tk)

func (Signer) Close

func (s Signer) Close() error

Close closes the connection to the TKey

func (Signer) GetAppNameVersion

func (s Signer) GetAppNameVersion() (*tkeyclient.NameVersion, error)

GetAppNameVersion gets the name and version of the running app in the same style as the stick itself.

func (Signer) GetFWDigest

func (s Signer) GetFWDigest(len int) ([]byte, error)

GetFWDigest asks the signer app to hash len bytes of the firmware.

It returns the resulting SHA512 digest or an error.

func (Signer) GetIsKeyLoaded added in v0.0.4

func (s Signer) GetIsKeyLoaded() (bool, error)

func (Signer) GetPubkey

func (s Signer) GetPubkey() ([]byte, error)

GetPubkey fetches the public key of the signer.

func (Signer) LoadKey added in v0.0.4

func (s Signer) LoadKey(rsaKeyPath string) error

func (Signer) Sign

func (s Signer) Sign(data []byte) ([]byte, error)

Sign signs the message in data and returns an RSA signature.

Jump to

Keyboard shortcuts

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