cryptosig

package module
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2022 License: GPL-3.0 Imports: 10 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 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 PublicKey

func UnmarshalBinaryPublicKey

func UnmarshalBinaryPublicKey(b []byte) (PublicKey, error)

type SecretKey

type SecretKey interface {
	encoding.BinaryUnmarshaler
	encoding.TextUnmarshaler
	UnsafeMarshalBinary() ([]byte, error)
	UnsafeMarshalText() ([]byte, error)
	Algo() string
	Sign(msg []byte) Signature
	Unwrap() any
	PublicKey() PublicKey
}

func New

func New(algo string) SecretKey

func UnmarshalBinarySecretKey

func UnmarshalBinarySecretKey(b []byte) (SecretKey, error)

func UnmarshalTextSecretKey added in v1.2.0

func UnmarshalTextSecretKey(b []byte) (SecretKey, error)

type Signature

type Signature interface {
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
	json.Marshaler
	json.Unmarshaler
	Algo() string
	Verify(PublicKey, []byte) error
	Unwrap() any
}

func UnmarshalBinarySignature

func UnmarshalBinarySignature(b []byte) (Signature, 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
}

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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