crypto

package
v0.0.0-...-bc7c564 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NIDsecp256k1 uint16 = 714
	NIDsecp521r1        = 716
	NIDsect283k1        = 729
	NIDsecp384r1        = 715
)

Variables

This section is empty.

Functions

func CurveById

func CurveById(typeId uint16) (elliptic.Curve, error)

func Decrypt

func Decrypt(private *Key, payload []byte) ([]byte, error)

func Encrypt

func Encrypt(public *ecdsa.PublicKey, payload []byte) ([]byte, error)

func MarshalPrivate

func MarshalPrivate(w io.Writer, private *Key) error

func PasswordDecrypt

func PasswordDecrypt(encrypted io.Reader, key []byte) []byte

func PasswordEncrypt

func PasswordEncrypt(w io.Writer, data []byte, key []byte) error

func PublicFromSerialized

func PublicFromSerialized(public *Public, typeID uint16, x []byte, y []byte) error

func Sect283k1

func Sect283k1() elliptic.Curve

func UnmarshalPublic

func UnmarshalPublic(c elliptic.Curve, data []byte) *ecdsa.PublicKey

Types

type Key

type Key struct {
	Private []byte
	Public  *Public
}

func NewKey

func NewKey(private []byte, typeID uint16, curve elliptic.Curve, x *big.Int, y *big.Int) *Key

func NewKeyByType

func NewKeyByType(typeID uint16) (*Key, error)

func NewKeyFromPrivate

func NewKeyFromPrivate(typeID uint16, private []byte) (*Key, error)

func UnmarshalPrivate

func UnmarshalPrivate(r io.Reader) (*Key, error)

func (*Key) Convert

func (k *Key) Convert() *ecdsa.PrivateKey

type PrivateSerialized

type PrivateSerialized struct {
	TypeID  uint16
	Private []byte
}

type Public

type Public struct {
	TypeId uint16
	ecdsa.PublicKey
	utils.Serializable
}

func NewPublic

func NewPublic(data []byte) (*Public, error)

func PublicFromBase58

func PublicFromBase58(public string) (*Public, error)

func (*Public) Checksum

func (p *Public) Checksum() uint32

func (*Public) Convert

func (p *Public) Convert() *ecdsa.PublicKey

func (*Public) Copy

func (p *Public) Copy() Public

func (*Public) Deserialize

func (this *Public) Deserialize(r io.Reader) error

func (*Public) Equal

func (this *Public) Equal(other *Public) bool

func (*Public) Serialize

func (this *Public) Serialize(w io.Writer) error

func (*Public) Serialized

func (this *Public) Serialized() PublicSerialized

func (*Public) SerializedPlain

func (this *Public) SerializedPlain() PublicSerializedPlain

func (*Public) ToBase58

func (p *Public) ToBase58() string

type PublicPrefixChecksum

type PublicPrefixChecksum struct {
	Prefix   uint8
	Public   PublicSerialized
	Checksum uint32
}

type PublicSerialized

type PublicSerialized struct {
	TypeId uint16
	X      []byte
	Y      []byte
}

type PublicSerializedPlain

type PublicSerializedPlain struct {
	TypeId uint16
	X      utils.Serializable
	Y      utils.Serializable
}

type Signature

type Signature struct {
	R *big.Int
	S *big.Int
}

type SignatureSerialized

type SignatureSerialized struct {
	R []byte
	S []byte
}

func (*SignatureSerialized) Decompress

func (this *SignatureSerialized) Decompress() *Signature

Jump to

Keyboard shortcuts

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