crypto

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2018 License: MIT Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeSignature

func DecodeSignature(sig string) (r, s *big.Int, err error)

func EncodeSignature

func EncodeSignature(r, s *big.Int) string

func FromECDSAPub

func FromECDSAPub(pub *ecdsa.PublicKey) []byte

func GenerateECDSAKey

func GenerateECDSAKey() (*ecdsa.PrivateKey, error)

func SHA256

func SHA256(hashBytes []byte) []byte

func Sign

func Sign(priv *ecdsa.PrivateKey, hash []byte) (r, s *big.Int, err error)

func SimpleHashFromHashes

func SimpleHashFromHashes(hashes [][]byte) []byte

func SimpleHashFromTwoHashes

func SimpleHashFromTwoHashes(left []byte, right []byte) []byte

func ToECDSAPub

func ToECDSAPub(pub []byte) *ecdsa.PublicKey

func Verify

func Verify(pub *ecdsa.PublicKey, hash []byte, r, s *big.Int) bool

Types

type PemDump

type PemDump struct {
	PublicKey  string
	PrivateKey string
}

func GeneratePemKey

func GeneratePemKey() (*PemDump, error)

func ToPemKey

func ToPemKey(priv *ecdsa.PrivateKey) (*PemDump, error)

type PemKey

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

func NewPemKey

func NewPemKey(base string) *PemKey

func (*PemKey) ReadKey

func (k *PemKey) ReadKey() (*ecdsa.PrivateKey, error)

func (*PemKey) ReadKeyFromBuf

func (k *PemKey) ReadKeyFromBuf(buf []byte) (*ecdsa.PrivateKey, error)

func (*PemKey) WriteKey

func (k *PemKey) WriteKey(key *ecdsa.PrivateKey) error

Jump to

Keyboard shortcuts

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