ed25519

package
v0.22.5 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2018 License: Apache-2.0 Imports: 9 Imported by: 1,561

Documentation

Index

Constants

View Source
const (
	Ed25519PrivKeyAminoRoute   = "tendermint/PrivKeyEd25519"
	Ed25519PubKeyAminoRoute    = "tendermint/PubKeyEd25519"
	Ed25519SignatureAminoRoute = "tendermint/SignatureEd25519"
)
View Source
const PubKeyEd25519Size = 32

PubKeyEd25519Size is the number of bytes in an Ed25519 signature.

View Source
const SignatureEd25519Size = 64

Size of an Edwards25519 signature. Namely the size of a compressed Edwards25519 point, and a field element. Both of which are 32 bytes.

Variables

This section is empty.

Functions

func SignatureEd25519FromBytes added in v0.22.5

func SignatureEd25519FromBytes(data []byte) crypto.Signature

Types

type PrivKeyEd25519

type PrivKeyEd25519 [64]byte

PrivKeyEd25519 implements crypto.PrivKey.

func GenPrivKey

func GenPrivKey() PrivKeyEd25519

GenPrivKey generates a new ed25519 private key. It uses OS randomness in conjunction with the current global random seed in tendermint/libs/common to generate the private key.

func GenPrivKeyFromSecret

func GenPrivKeyFromSecret(secret []byte) PrivKeyEd25519

GenPrivKeyFromSecret hashes the secret with SHA2, and uses that 32 byte output to create the private key. NOTE: secret should be the output of a KDF like bcrypt, if it's derived from user input.

func (PrivKeyEd25519) Bytes

func (privKey PrivKeyEd25519) Bytes() []byte

Bytes marshals the privkey using amino encoding.

func (PrivKeyEd25519) Equals

func (privKey PrivKeyEd25519) Equals(other crypto.PrivKey) bool

Equals - you probably don't need to use this. Runs in constant time based on length of the keys.

func (PrivKeyEd25519) PubKey

func (privKey PrivKeyEd25519) PubKey() crypto.PubKey

PubKey gets the corresponding public key from the private key.

func (PrivKeyEd25519) Sign

func (privKey PrivKeyEd25519) Sign(msg []byte) (crypto.Signature, error)

Sign produces a signature on the provided message.

func (PrivKeyEd25519) ToCurve25519 added in v0.22.5

func (privKey PrivKeyEd25519) ToCurve25519() *[PubKeyEd25519Size]byte

ToCurve25519 takes a private key and returns its representation on Curve25519. Curve25519 is birationally equivalent to Edwards25519, which Ed25519 uses internally. This method is intended for use in an X25519 Diffie Hellman key exchange.

type PubKeyEd25519

type PubKeyEd25519 [PubKeyEd25519Size]byte

PubKeyEd25519 implements crypto.PubKey for the Ed25519 signature scheme.

func (PubKeyEd25519) Address

func (pubKey PubKeyEd25519) Address() crypto.Address

Address is the SHA256-20 of the raw pubkey bytes.

func (PubKeyEd25519) Bytes

func (pubKey PubKeyEd25519) Bytes() []byte

Bytes marshals the PubKey using amino encoding.

func (PubKeyEd25519) Equals

func (pubKey PubKeyEd25519) Equals(other crypto.PubKey) bool

nolint: golint

func (PubKeyEd25519) String

func (pubKey PubKeyEd25519) String() string

func (PubKeyEd25519) ToCurve25519 added in v0.22.5

func (pubKey PubKeyEd25519) ToCurve25519() *[PubKeyEd25519Size]byte

ToCurve25519 takes a public key and returns its representation on Curve25519. Curve25519 is birationally equivalent to Edwards25519, which Ed25519 uses internally. This method is intended for use in an X25519 Diffie Hellman key exchange.

If there is an error, then this function returns nil.

func (PubKeyEd25519) VerifyBytes

func (pubKey PubKeyEd25519) VerifyBytes(msg []byte, sig_ crypto.Signature) bool

type SignatureEd25519 added in v0.22.5

type SignatureEd25519 [SignatureEd25519Size]byte

SignatureEd25519 implements crypto.Signature

func (SignatureEd25519) Bytes added in v0.22.5

func (sig SignatureEd25519) Bytes() []byte

func (SignatureEd25519) Equals added in v0.22.5

func (sig SignatureEd25519) Equals(other crypto.Signature) bool

func (SignatureEd25519) IsZero added in v0.22.5

func (sig SignatureEd25519) IsZero() bool

func (SignatureEd25519) String added in v0.22.5

func (sig SignatureEd25519) String() string

Jump to

Keyboard shortcuts

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