https://github.com/tendermint/tendermint
Raw File
Tip revision: 90eda9bfb6e6daeed1c8015df41cb36772d91778 authored by Ethan Buchman on 18 October 2018, 02:09:48 UTC
changelog and version
Tip revision: 90eda9b
crypto.go
package crypto

import (
	cmn "github.com/tendermint/tendermint/libs/common"
)

type PrivKey interface {
	Bytes() []byte
	Sign(msg []byte) ([]byte, error)
	PubKey() PubKey
	Equals(PrivKey) bool
}

// An address is a []byte, but hex-encoded even in JSON.
// []byte leaves us the option to change the address length.
// Use an alias so Unmarshal methods (with ptr receivers) are available too.
type Address = cmn.HexBytes

type PubKey interface {
	Address() Address
	Bytes() []byte
	VerifyBytes(msg []byte, sig []byte) bool
	Equals(PubKey) bool
}

type Symmetric interface {
	Keygen() []byte
	Encrypt(plaintext []byte, secret []byte) (ciphertext []byte)
	Decrypt(ciphertext []byte, secret []byte) (plaintext []byte, err error)
}
back to top