hsmclient

package
v0.0.0-...-1305305 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const NULL_HANDLE_ID = "NULL_HANDLE_ID"
View Source
const SESSION_HANDLE_INVALID = "0xB3"
View Source
const SIGNING_ERROR = "0x8000001A"
View Source
const UNIDENTIFIED_ERROR = "Unknown Error Message from HSM"

Variables

View Source
var LOGGER = logging.MustGetLogger("hsm-client")

Functions

func AddSignatureToTransaction

func AddSignatureToTransaction(tx build.TransactionEnvelopeBuilder, signature []byte, publicKey string) (build.TransactionEnvelopeBuilder, error)

func FindHSMObject

func FindHSMObject(c *hsm.Crypto, slot uint, label string) ([]byte, pkcs11.ObjectHandle, error)

func GenerateKeyPair

func GenerateKeyPair(c *hsm.Crypto, slot uint, label1, label2 string) (string, string, pkcs11.ObjectHandle, pkcs11.ObjectHandle, []uint8, error)

Generate key pair and get the label of public key and private key from HSM. Use the public key label to get the CKA_EC_POINT. Need to initiate the HSM first.

func GenerateStellarAccount

func GenerateStellarAccount(ecPoints []uint8) string

Using public key's CKA_EC_POINT from the HSM to generate the Stellar account.

func GetSignatureAndAddToTransaction

func GetSignatureAndAddToTransaction(c hsm.Crypto, privateKeyObject pkcs11.ObjectHandle, slot uint, txHash []byte, tx build.TransactionEnvelopeBuilder, publicKey string) (txe build.TransactionEnvelopeBuilder, err error)

Signing the transaction hash with the handle id of private key. Need to initiate the HSM and get the private jey object handle id first. Add both the signature and the hint parse from public key to the transaction.

func ParseErrorMsg

func ParseErrorMsg(err error) string

func SignDataWithPrivateKey

func SignDataWithPrivateKey(c hsm.Crypto, privateKeyObject pkcs11.ObjectHandle, slot uint, data []byte) ([]byte, error)

func VerifyDataWithPublicKey

func VerifyDataWithPublicKey(c hsm.Crypto, publicKeyObject pkcs11.ObjectHandle, slot uint, data []byte, sig []byte) error

func VerifyDataWithPublicNodeAddress

func VerifyDataWithPublicNodeAddress(publicKey string, data []byte, sig []byte) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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