crypto

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ed25519 string = "vega/ed25519"
)

Variables

View Source
var (
	// ErrBadED25519PrivateKeyLength is returned if a private key with incorrect length is supplied.
	ErrBadED25519PrivateKeyLength = errors.New("bad ed25519 private key length")

	// ErrBadED25519PublicKeyLength is returned if a public key with incorrect length is supplied.
	ErrBadED25519PublicKeyLength = errors.New("bad ed25519 public key length")
)
View Source
var (
	ErrUnsupportedSignatureAlgorithm = errors.New("unsupported signature algorithm")
)

Functions

func Decrypt

func Decrypt(data []byte, passphrase string) ([]byte, error)

func Encrypt

func Encrypt(data []byte, passphrase string) ([]byte, error)

Types

type SignatureAlgorithm

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

func NewEd25519

func NewEd25519() SignatureAlgorithm

func NewSignatureAlgorithm

func NewSignatureAlgorithm(algo string) (SignatureAlgorithm, error)

func (*SignatureAlgorithm) GenKey

func (*SignatureAlgorithm) MarshalJSON

func (s *SignatureAlgorithm) MarshalJSON() ([]byte, error)

func (*SignatureAlgorithm) Name

func (s *SignatureAlgorithm) Name() string

func (*SignatureAlgorithm) Sign

func (s *SignatureAlgorithm) Sign(priv crypto.PrivateKey, buf []byte) ([]byte, error)

func (*SignatureAlgorithm) UnmarshalJSON

func (s *SignatureAlgorithm) UnmarshalJSON(data []byte) error

func (*SignatureAlgorithm) Verify

func (s *SignatureAlgorithm) Verify(pub crypto.PublicKey, message, sig []byte) (bool, error)

func (*SignatureAlgorithm) Version

func (s *SignatureAlgorithm) Version() uint32

Jump to

Keyboard shortcuts

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