keys

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BankSize = 2048

Variables

This section is empty.

Functions

This section is empty.

Types

type CRC16 added in v0.3.0

type CRC16 struct {
	Poly uint16
	// contains filtered or unexported fields
}

CRC16 does the ieee crc16 polynomial check

func NewCCITTCRC16 added in v0.3.0

func NewCCITTCRC16() *CRC16

func NewIBMCRC16 added in v0.3.0

func NewIBMCRC16() *CRC16

func NewSCSICRC16 added in v0.3.0

func NewSCSICRC16() *CRC16

func (*CRC16) AddECC added in v0.3.0

func (c *CRC16) AddECC(input []byte) []byte

func (*CRC16) CheckECC added in v0.3.0

func (c *CRC16) CheckECC(input []byte) ([]byte, error)

type CRC32 added in v0.2.1

type CRC32 struct {
	Poly uint32
	// contains filtered or unexported fields
}

CRC32 does the ieee crc32 polynomial check

func NewCastagnoliCRC32 added in v0.2.1

func NewCastagnoliCRC32() *CRC32

func NewIEEECRC32 added in v0.2.1

func NewIEEECRC32() *CRC32

func NewKoopmanCRC32 added in v0.2.1

func NewKoopmanCRC32() *CRC32

func (*CRC32) AddECC added in v0.2.1

func (c *CRC32) AddECC(input []byte) []byte

func (*CRC32) CheckECC added in v0.2.1

func (c *CRC32) CheckECC(input []byte) ([]byte, error)

type CRC64 added in v0.2.1

type CRC64 struct {
	Poly uint64
	// contains filtered or unexported fields
}

CRC64 does the ieee crc64 polynomial check

func NewECMACRC64 added in v0.2.1

func NewECMACRC64() *CRC64

func NewISOCRC64 added in v0.2.1

func NewISOCRC64() *CRC64

func (*CRC64) AddECC added in v0.2.1

func (c *CRC64) AddECC(input []byte) []byte

func (*CRC64) CheckECC added in v0.2.1

func (c *CRC64) CheckECC(input []byte) ([]byte, error)

type Codec added in v0.2.1

type Codec interface {
	BytesToWords([]byte) ([]string, error)
	WordsToBytes([]string) ([]byte, error)
}

type ECC added in v0.2.1

type ECC interface {
	// AddECC calculates an error-correcting code for the input
	// returns an output with the code appended
	AddECC([]byte) []byte

	// CheckECC verifies if the ECC is proper on the input and returns
	// the data with the code removed, or an error
	CheckECC([]byte) ([]byte, error)
}

ECC is used for anything that calculates an error-correcting code

type Info

type Info struct {
	Name    string        `json:"name"`
	Address data.Bytes    `json:"address"`
	PubKey  crypto.PubKey `json:"pubkey"`
}

Info is the public information about a key

func (*Info) Format

func (i *Info) Format() Info

type Infos

type Infos []Info

Infos is a wrapper to allows alphabetical sorting of the keys

func (Infos) Len

func (k Infos) Len() int

func (Infos) Less

func (k Infos) Less(i, j int) bool

func (Infos) Sort

func (k Infos) Sort()

func (Infos) Swap

func (k Infos) Swap(i, j int)

type Manager

type Manager interface {
	Signer
	// Create also returns a seed phrase for cold-storage
	Create(name, passphrase, algo string) (Info, string, error)
	// Recover takes a seedphrase and loads in the private key
	Recover(name, passphrase, seedphrase string) (Info, error)
	List() (Infos, error)
	Get(name string) (Info, error)
	Update(name, oldpass, newpass string) error
	Delete(name, passphrase string) error
}

Manager allows simple CRUD on a keystore, as an aid to signing

type NoECC added in v0.2.1

type NoECC struct{}

NoECC is a no-op placeholder, kind of useless... except for tests

func (NoECC) AddECC added in v0.2.1

func (_ NoECC) AddECC(input []byte) []byte

func (NoECC) CheckECC added in v0.2.1

func (_ NoECC) CheckECC(input []byte) ([]byte, error)

type Signable

type Signable interface {
	// SignBytes is the immutable data, which needs to be signed
	SignBytes() []byte

	// Sign will add a signature and pubkey.
	//
	// Depending on the Signable, one may be able to call this multiple times for multisig
	// Returns error if called with invalid data or too many times
	Sign(pubkey crypto.PubKey, sig crypto.Signature) error

	// Signers will return the public key(s) that signed if the signature
	// is valid, or an error if there is any issue with the signature,
	// including if there are no signatures
	Signers() ([]crypto.PubKey, error)

	// TxBytes returns the transaction data as well as all signatures
	// It should return an error if Sign was never called
	TxBytes() ([]byte, error)
}

Signable represents any transaction we wish to send to tendermint core These methods allow us to sign arbitrary Tx with the KeyStore

type Signer

type Signer interface {
	Sign(name, passphrase string, tx Signable) error
}

Signer allows one to use a keystore to sign transactions

type Storage

type Storage interface {
	Put(name string, key []byte, info Info) error
	Get(name string) ([]byte, Info, error)
	List() (Infos, error)
	Delete(name string) error
}

Storage has many implementation, based on security and sharing requirements like disk-backed, mem-backed, vault, db, etc.

type WordCodec added in v0.2.1

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

func LoadCodec added in v0.2.1

func LoadCodec(bank string) (codec *WordCodec, err error)

LoadCodec loads a pre-compiled language file

func MustLoadCodec added in v0.2.1

func MustLoadCodec(bank string) *WordCodec

MustLoadCodec panics if word bank is missing, only for tests

func NewCodec added in v0.2.1

func NewCodec(words []string) (codec *WordCodec, err error)

func (*WordCodec) BytesToWords added in v0.2.1

func (c *WordCodec) BytesToWords(raw []byte) (words []string, err error)

TODO: add checksum

func (*WordCodec) GetIndex added in v0.2.1

func (c *WordCodec) GetIndex(word string) (int, error)

GetIndex finds the index of the words to create bytes Generates a map the first time it is loaded, to avoid needless computation when list is not used.

func (*WordCodec) WordsToBytes added in v0.2.1

func (c *WordCodec) WordsToBytes(words []string) ([]byte, error)

Directories

Path Synopsis
package cryptostore maintains everything needed for doing public-key signing and key management in software, based on the go-crypto library from tendermint.
package cryptostore maintains everything needed for doing public-key signing and key management in software, based on the go-crypto library from tendermint.
package server provides http handlers to construct a server server for key management, transaction signing, and query validation.
package server provides http handlers to construct a server server for key management, transaction signing, and query validation.
storage
filestorage
package filestorage provides a secure on-disk storage of private keys and metadata.
package filestorage provides a secure on-disk storage of private keys and metadata.
memstorage
package memstorage provides a simple in-memory key store designed for use in test cases, particularly to isolate them from the filesystem, concurrency, and cleanup issues.
package memstorage provides a simple in-memory key store designed for use in test cases, particularly to isolate them from the filesystem, concurrency, and cleanup issues.

Jump to

Keyboard shortcuts

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