ed25519

package
v0.0.0-...-5fbb372 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Copyright (C) 2018 go-gamc authors

This file is part of the go-gamc library.

the go-gamc library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

the go-gamc library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the go-gamc library. If not, see <http://www.gnu.org/licenses/>.

This file is part of the go-gamc library.

the go-gamc library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

the go-gamc library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the go-gamc library. If not, see <http://www.gnu.org/licenses/>.

This file is part of the go-gamc library.

the go-gamc library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

the go-gamc library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the go-gamc library. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGetPublicKeyFailed = errors.New("private key to public failed")
	ErrGetSeedFailed      = errors.New("private key to seed failed")
)
View Source
var (
	ErrInvalidPrivateKey = errors.New("invalid private key")
	ErrInvalidSeed       = errors.New("invalid seed")
)

Functions

func GetPublicKey

func GetPublicKey(prikey []byte) ([]byte, error)

GetPublicKey private key to public key

func GetSeed

func GetSeed(prikey []byte) ([]byte, error)

func Sign

func Sign(priKey []byte, message []byte) []byte

Sign sign hash with private key

func Verify

func Verify(pubKey []byte, message, sig []byte) bool

Verify verify with public key

Types

type Message

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

func (*Message) GetData

func (m *Message) GetData() []byte

func (*Message) GetSigner

func (m *Message) GetSigner() []byte

type PrivateKey

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

func NewPrivateKey

func NewPrivateKey() *PrivateKey

func NewPrivateKeyFromSeed

func NewPrivateKeyFromSeed(seed []byte) (*PrivateKey, error)

func (*PrivateKey) Algorithm

func (k *PrivateKey) Algorithm() keystore.Algorithm

func (*PrivateKey) Clear

func (k *PrivateKey) Clear()

Clear clear key content

func (*PrivateKey) Decode

func (k *PrivateKey) Decode(data []byte) error

Decode decode data to key

func (*PrivateKey) Encoded

func (k *PrivateKey) Encoded() ([]byte, error)

Encoded encoded to byte

func (*PrivateKey) PublicKey

func (k *PrivateKey) PublicKey() keystore.PublicKey

PublicKey returns publickey

func (*PrivateKey) Seed

func (k *PrivateKey) Seed() ([]byte, error)

Seed returns seed

func (*PrivateKey) Sign

func (key *PrivateKey) Sign(hash []byte) []byte

type PublicKey

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

func NewPublicKey

func NewPublicKey(pub []byte) *PublicKey

func (*PublicKey) Algorithm

func (k *PublicKey) Algorithm() keystore.Algorithm

Algorithm algorithm name

func (*PublicKey) Clear

func (k *PublicKey) Clear()

Clear clear key content

func (*PublicKey) Decode

func (k *PublicKey) Decode(data []byte) error

Decode decode data to key

func (*PublicKey) Encoded

func (k *PublicKey) Encoded() ([]byte, error)

Encoded encoded to byte

func (*PublicKey) Verify

func (k *PublicKey) Verify(hash []byte, signature []byte) bool

Verify verify ecdsa publickey

type Signature

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

Signature signature ecdsa

func (*Signature) Algorithm

func (s *Signature) Algorithm() keystore.Algorithm

Algorithm secp256k1 algorithm

func (*Signature) InitSign

func (s *Signature) InitSign(priv keystore.PrivateKey) error

InitSign ed25519 init sign

func (*Signature) InitVerify

func (s *Signature) InitVerify(pub keystore.PublicKey) error

InitVerify ed25519 verify init

func (*Signature) Sign

func (s *Signature) Sign(data []byte) (out keystore.SignResult, err error)

Sign ed25519 sign

func (*Signature) Verify

func (s *Signature) Verify(data []byte, signature keystore.SignResult) (bool, error)

Verify ed25519 verify

Jump to

Keyboard shortcuts

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