hsm

package
v0.0.0-...-2da98db Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package hsm is used to interact with chains with a HSM it is currently not used

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey(
	label string,
	algorithm keystone.KeygenAlgorithm,
	config *crypto11.Config,
) (*keystone.CryptoKey, error)

GenerateKey This generates a new key using one of the supported algorithms and a label identifier through the HSM

func GetHSMAddress

func GetHSMAddress(config *crypto11.Config, label string) (types.Address, types.PubKey, error)

GetHSMAddress This address is generated by secp256k1 curve from cosmos sdk

func GetPKCS11Config

func GetPKCS11Config() (config *crypto11.Config, err error)

GetPKCS11Config returns the PKCS11 configuration from the environment variables

func Sign

func Sign(config *crypto11.Config, msg []byte, label string) (signature []byte, err error)

Sign Generates signature of msg using the key indexed by the label through the HSM defined in the config

func SignWithHSM

func SignWithHSM(
	txf clienttx.Factory,
	name string,
	txBuilder client.TxBuilder,
	overwriteSig bool,
	txConfig client.TxConfig,
) error

SignWithHSM signs a given tx with a named key. This is adapted from github.com/cosmos/cosmos-sdk/client/tx Sign() function; Modified to use an HSM. The resulting signature will be added to the transaction builder overwriting the previous ones if overwrite=true (otherwise, the signature will be appended). Signing a transaction with multiple signers in the DIRECT mode is not supported and will return an error. An error is returned upon failure.

Types

This section is empty.

Jump to

Keyboard shortcuts

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