crypto

package
v0.0.0-...-4955b9a Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ed25519PrivKeySize   = ed255192.PrivateKeySize
	Ed25519PubKeySize    = ed25519.PubKeyEd25519Size
	Ed25519SignatureSize = ed25519.SignatureSize
)
View Source
const (
	Secp256k1PrivateKeySize = 32
	Secp256k1PublicKeySize  = secp256k1.PubKeySecp256k1Size
)

Variables

This section is empty.

Functions

func CheckConsensusPubKey

func CheckConsensusPubKey(pubKey crypto.PubKey) (abci.PubKey, error)

should prevent unknown keys from being in consensus

func RegisterAmino

func RegisterAmino(cdc *amino.Codec)

RegisterAmino registers all go-crypto related types in the given (amino) codec.

Types

type Ed25519PrivateKey

type Ed25519PrivateKey ed25519.PrivKeyEd25519

func (Ed25519PrivateKey) Bytes

func (priv Ed25519PrivateKey) Bytes() []byte

func (Ed25519PrivateKey) Equals

func (priv Ed25519PrivateKey) Equals(other crypto.PrivKey) bool

func (Ed25519PrivateKey) GenPrivateKey

func (Ed25519PrivateKey) GenPrivateKey() PrivateKey

func (Ed25519PrivateKey) PrivKey

func (priv Ed25519PrivateKey) PrivKey() crypto.PrivKey

func (Ed25519PrivateKey) PrivKeyToPrivateKey

func (Ed25519PrivateKey) PrivKeyToPrivateKey(key crypto.PrivKey) PrivateKey

func (Ed25519PrivateKey) PrivateKeyFromBytes

func (Ed25519PrivateKey) PrivateKeyFromBytes(b []byte) (PrivateKey, error)

func (Ed25519PrivateKey) PubKey

func (priv Ed25519PrivateKey) PubKey() crypto.PubKey

func (Ed25519PrivateKey) PublicKey

func (priv Ed25519PrivateKey) PublicKey() PublicKey

func (Ed25519PrivateKey) RawBytes

func (priv Ed25519PrivateKey) RawBytes() []byte

func (Ed25519PrivateKey) RawString

func (priv Ed25519PrivateKey) RawString() string

func (Ed25519PrivateKey) Sign

func (priv Ed25519PrivateKey) Sign(msg []byte) ([]byte, error)

func (Ed25519PrivateKey) Size

func (priv Ed25519PrivateKey) Size() int

func (Ed25519PrivateKey) String

func (priv Ed25519PrivateKey) String() string

type Ed25519PublicKey

type Ed25519PublicKey ed25519.PubKeyEd25519

func (Ed25519PublicKey) Address

func (pub Ed25519PublicKey) Address() crypto.Address

func (Ed25519PublicKey) Bytes

func (pub Ed25519PublicKey) Bytes() []byte

func (Ed25519PublicKey) Equals

func (pub Ed25519PublicKey) Equals(other crypto.PubKey) bool

func (Ed25519PublicKey) MarshalJSON

func (pub Ed25519PublicKey) MarshalJSON() ([]byte, error)

func (Ed25519PublicKey) NewPublicKey

func (Ed25519PublicKey) NewPublicKey(b []byte) (PublicKey, error)

func (Ed25519PublicKey) PubKey

func (pub Ed25519PublicKey) PubKey() crypto.PubKey

func (Ed25519PublicKey) PubKeyToPublicKey

func (Ed25519PublicKey) PubKeyToPublicKey(key crypto.PubKey) PublicKey

func (Ed25519PublicKey) RawBytes

func (pub Ed25519PublicKey) RawBytes() []byte

func (Ed25519PublicKey) RawString

func (pub Ed25519PublicKey) RawString() string

func (Ed25519PublicKey) Size

func (pub Ed25519PublicKey) Size() int

func (Ed25519PublicKey) String

func (pub Ed25519PublicKey) String() string

func (*Ed25519PublicKey) UnmarshalJSON

func (pub *Ed25519PublicKey) UnmarshalJSON(data []byte) error

func (Ed25519PublicKey) VerifyBytes

func (pub Ed25519PublicKey) VerifyBytes(msg []byte, sig []byte) bool

type MultiSig

type MultiSig interface {
	AddSignature(sig []byte, key PublicKey, keys []PublicKey) (MultiSig, error)
	AddSignatureByIndex(sig []byte, index int) MultiSig
	Marshal() []byte
	Unmarshal([]byte) MultiSig
	NewMultiSignature() MultiSig
	String() string
	NumOfSigs() int
	Signatures() [][]byte
	GetSignatureByIndex(i int) (sig []byte, found bool)
}

type MultiSignature

type MultiSignature struct {
	Sigs [][]byte `json:"signatures"`
}

func (MultiSignature) AddSignature

func (ms MultiSignature) AddSignature(sig []byte, key PublicKey, keys []PublicKey) (MultiSig, error)

func (MultiSignature) AddSignatureByIndex

func (ms MultiSignature) AddSignatureByIndex(sig []byte, index int) MultiSig

func (MultiSignature) GetSignatureByIndex

func (ms MultiSignature) GetSignatureByIndex(i int) (sig []byte, found bool)

func (MultiSignature) GetSignatureByKey

func (ms MultiSignature) GetSignatureByKey(pubKey PublicKey, keys []PublicKey) (sig []byte, found bool)

func (MultiSignature) Marshal

func (ms MultiSignature) Marshal() []byte

func (MultiSignature) NewMultiSignature

func (ms MultiSignature) NewMultiSignature() MultiSig

func (MultiSignature) NumOfSigs

func (ms MultiSignature) NumOfSigs() int

func (MultiSignature) Signatures

func (ms MultiSignature) Signatures() [][]byte

func (MultiSignature) String

func (ms MultiSignature) String() string

func (MultiSignature) Unmarshal

func (ms MultiSignature) Unmarshal(sig []byte) MultiSig

type PrivateKey

type PrivateKey interface {
	Bytes() []byte
	RawBytes() []byte
	String() string
	RawString() string
	PrivKey() crypto.PrivKey
	PubKey() crypto.PubKey
	Equals(other crypto.PrivKey) bool
	PublicKey() PublicKey
	Sign(msg []byte) ([]byte, error)
	PrivKeyToPrivateKey(crypto.PrivKey) PrivateKey
	GenPrivateKey() PrivateKey
	Size() int
}

func GenerateEd25519PrivKey

func GenerateEd25519PrivKey() PrivateKey

func GenerateSecp256k1PrivKey

func GenerateSecp256k1PrivKey() PrivateKey

func NewPrivateKeyBz

func NewPrivateKeyBz(b []byte) (PrivateKey, error)

func PrivKeyFromBytes

func PrivKeyFromBytes(privKeyBytes []byte) (privKey PrivateKey, err error)

func PrivKeyToPrivateKey

func PrivKeyToPrivateKey(key crypto.PrivKey) (PrivateKey, error)

type PublicKey

type PublicKey interface {
	PubKey() crypto.PubKey
	Bytes() []byte
	RawBytes() []byte
	String() string
	RawString() string
	Address() crypto.Address
	Equals(other crypto.PubKey) bool
	VerifyBytes(msg []byte, sig []byte) bool
	PubKeyToPublicKey(crypto.PubKey) PublicKey
	Size() int
}

func NewPublicKey

func NewPublicKey(hexString string) (PublicKey, error)

func NewPublicKeyBz

func NewPublicKeyBz(b []byte) (PublicKey, error)

func PubKeyFromBytes

func PubKeyFromBytes(pubKeyBytes []byte) (pubKey PublicKey, err error)

func PubKeyToPublicKey

func PubKeyToPublicKey(key crypto.PubKey) (PublicKey, error)

type PublicKeyMultiSig

type PublicKeyMultiSig interface {
	Address() crypto.Address
	String() string
	Bytes() []byte
	Equals(other crypto.PubKey) bool
	VerifyBytes(msg []byte, multiSignature []byte) bool
	PubKey() crypto.PubKey
	RawBytes() []byte
	RawString() string
	PubKeyToPublicKey(crypto.PubKey) PublicKey
	Size() int
	// new methods
	NewMultiKey(keys ...PublicKey) (PublicKeyMultiSig, error)
	Keys() []PublicKey
}

type PublicKeyMultiSignature

type PublicKeyMultiSignature struct {
	PublicKeys []PublicKey `json:"keys"`
}

func (PublicKeyMultiSignature) Address

func (pms PublicKeyMultiSignature) Address() crypto.Address

func (PublicKeyMultiSignature) Bytes

func (pms PublicKeyMultiSignature) Bytes() []byte

func (PublicKeyMultiSignature) Equals

func (pms PublicKeyMultiSignature) Equals(other crypto.PubKey) bool

func (PublicKeyMultiSignature) Keys

func (pms PublicKeyMultiSignature) Keys() []PublicKey

func (PublicKeyMultiSignature) NewMultiKey

func (pms PublicKeyMultiSignature) NewMultiKey(keys ...PublicKey) (PublicKeyMultiSig, error)

func (PublicKeyMultiSignature) NewPublicKey

func (pms PublicKeyMultiSignature) NewPublicKey(res []byte) (PublicKey, error)

func (PublicKeyMultiSignature) PubKey

func (pms PublicKeyMultiSignature) PubKey() crypto.PubKey

func (PublicKeyMultiSignature) PubKeyToPublicKey

func (pms PublicKeyMultiSignature) PubKeyToPublicKey(crypto.PubKey) PublicKey

func (PublicKeyMultiSignature) RawBytes

func (pms PublicKeyMultiSignature) RawBytes() []byte

func (PublicKeyMultiSignature) RawString

func (pms PublicKeyMultiSignature) RawString() string

func (PublicKeyMultiSignature) Size

func (pms PublicKeyMultiSignature) Size() int

func (PublicKeyMultiSignature) String

func (pms PublicKeyMultiSignature) String() string

func (PublicKeyMultiSignature) VerifyBytes

func (pms PublicKeyMultiSignature) VerifyBytes(msg []byte, multiSignature []byte) bool

type Secp256k1PrivateKey

type Secp256k1PrivateKey secp256k1.PrivKeySecp256k1

func (Secp256k1PrivateKey) Bytes

func (priv Secp256k1PrivateKey) Bytes() []byte

func (Secp256k1PrivateKey) Equals

func (priv Secp256k1PrivateKey) Equals(other crypto.PrivKey) bool

func (Secp256k1PrivateKey) GenPrivateKey

func (Secp256k1PrivateKey) GenPrivateKey() PrivateKey

func (Secp256k1PrivateKey) PrivKey

func (priv Secp256k1PrivateKey) PrivKey() crypto.PrivKey

func (Secp256k1PrivateKey) PrivKeyToPrivateKey

func (Secp256k1PrivateKey) PrivKeyToPrivateKey(key crypto.PrivKey) PrivateKey

func (Secp256k1PrivateKey) PrivateKeyFromBytes

func (Secp256k1PrivateKey) PrivateKeyFromBytes(b []byte) (PrivateKey, error)

func (Secp256k1PrivateKey) PubKey

func (priv Secp256k1PrivateKey) PubKey() crypto.PubKey

func (Secp256k1PrivateKey) PublicKey

func (priv Secp256k1PrivateKey) PublicKey() PublicKey

func (Secp256k1PrivateKey) RawBytes

func (priv Secp256k1PrivateKey) RawBytes() []byte

func (Secp256k1PrivateKey) RawString

func (priv Secp256k1PrivateKey) RawString() string

func (Secp256k1PrivateKey) Sign

func (priv Secp256k1PrivateKey) Sign(msg []byte) ([]byte, error)

func (Secp256k1PrivateKey) Size

func (priv Secp256k1PrivateKey) Size() int

func (Secp256k1PrivateKey) String

func (priv Secp256k1PrivateKey) String() string

type Secp256k1PublicKey

type Secp256k1PublicKey secp256k1.PubKeySecp256k1

func (Secp256k1PublicKey) Address

func (pub Secp256k1PublicKey) Address() crypto.Address

func (Secp256k1PublicKey) Bytes

func (pub Secp256k1PublicKey) Bytes() []byte

func (Secp256k1PublicKey) Equals

func (pub Secp256k1PublicKey) Equals(other crypto.PubKey) bool

func (Secp256k1PublicKey) MarshalJSON

func (pub Secp256k1PublicKey) MarshalJSON() ([]byte, error)

func (Secp256k1PublicKey) NewPublicKey

func (Secp256k1PublicKey) NewPublicKey(b []byte) (PublicKey, error)

func (Secp256k1PublicKey) PubKey

func (pub Secp256k1PublicKey) PubKey() crypto.PubKey

func (Secp256k1PublicKey) PubKeyToPublicKey

func (Secp256k1PublicKey) PubKeyToPublicKey(key crypto.PubKey) PublicKey

func (Secp256k1PublicKey) RawBytes

func (pub Secp256k1PublicKey) RawBytes() []byte

func (Secp256k1PublicKey) RawString

func (pub Secp256k1PublicKey) RawString() string

func (Secp256k1PublicKey) Size

func (pub Secp256k1PublicKey) Size() int

func (Secp256k1PublicKey) String

func (pub Secp256k1PublicKey) String() string

func (*Secp256k1PublicKey) UnmarshalJSON

func (pub *Secp256k1PublicKey) UnmarshalJSON(data []byte) error

func (Secp256k1PublicKey) VerifyBytes

func (pub Secp256k1PublicKey) VerifyBytes(msg []byte, sig []byte) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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