cryptosig

package module
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: GPL-3.0 Imports: 8 Imported by: 2

README

cryptosig

abstracted multi-algorithm cryptographic signature library

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListAlgo added in v1.5.0

func ListAlgo() []string

func RegisterSigAlgo

func RegisterSigAlgo(algo SigningAlgo[any, any, any])

func TestAlgo

func TestAlgo(algo SigningAlgo[any, any, any]) error

Types

type HashedPublicKey added in v1.2.0

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

func (*HashedPublicKey) Equal added in v1.2.0

func (p *HashedPublicKey) Equal(publicKey *PublicKey) bool

func (*HashedPublicKey) MarshalText added in v1.7.0

func (p *HashedPublicKey) MarshalText() (text []byte, err error)

func (*HashedPublicKey) UnmarshalText added in v1.7.0

func (p *HashedPublicKey) UnmarshalText(text []byte) error

type PublicKey

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

func (*PublicKey) Algo

func (pk *PublicKey) Algo() string

func (*PublicKey) Fork added in v1.2.0

func (pk *PublicKey) Fork() *HashedPublicKey

func (*PublicKey) MarshalText added in v1.7.0

func (pk *PublicKey) MarshalText() ([]byte, error)

func (*PublicKey) UnmarshalText added in v1.7.0

func (pk *PublicKey) UnmarshalText(text []byte) error

func (*PublicKey) Unwrap

func (pk *PublicKey) Unwrap() any

func (*PublicKey) Verify

func (pk *PublicKey) Verify(sig *Signature, msg []byte) error

type SecretKey

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

func GenerateSecretKey added in v1.3.0

func GenerateSecretKey(algo string) *SecretKey

func (*SecretKey) Algo

func (sk *SecretKey) Algo() string

func (*SecretKey) MarshalText added in v1.7.0

func (sk *SecretKey) MarshalText() ([]byte, error)

func (*SecretKey) PublicKey

func (sk *SecretKey) PublicKey() *PublicKey

func (*SecretKey) Sign

func (sk *SecretKey) Sign(msg []byte) *Signature

func (*SecretKey) UnmarshalText added in v1.7.0

func (sk *SecretKey) UnmarshalText(b []byte) error

func (*SecretKey) UnsafeUnmarshalText added in v1.7.0

func (sk *SecretKey) UnsafeUnmarshalText() ([]byte, error)

func (*SecretKey) Unwrap

func (sk *SecretKey) Unwrap() any

type Signature

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

func (*Signature) Algo

func (sig *Signature) Algo() string

func (*Signature) MarshalText added in v1.7.0

func (sig *Signature) MarshalText() ([]byte, error)

func (*Signature) UnmarshalText added in v1.7.0

func (sig *Signature) UnmarshalText(text []byte) error

func (*Signature) Unwrap

func (sig *Signature) Unwrap() any

func (*Signature) Verify

func (sig *Signature) Verify(pk *PublicKey, msg []byte) error

type SigningAlgo

type SigningAlgo[S, P, Sig any] interface {
	Algo() string
	UnmarshalBinarySecretKey([]byte) (S, error)
	UnmarshalBinaryPublicKey([]byte) (P, error)
	UnmarshalBinarySignature([]byte) (Sig, error)
	MarshalBinarySecretKey(S) []byte
	MarshalBinaryPublicKey(P) []byte
	MarshalBinarySignature(Sig) []byte
	Sign(S, []byte) Sig
	Derive(S) P
	New() S
	Verify(Sig, P, []byte) error
}

func GetAlgo added in v1.3.2

func GetAlgo(name string) SigningAlgo[any, any, any]

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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