crypto

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: BSD-2-Clause Imports: 8 Imported by: 3

Documentation

Overview

package crypto provides lowest-level crypto types and primitives used by sigsum

Index

Constants

View Source
const (
	HashSize       = sha256.Size
	SignatureSize  = ed25519.SignatureSize
	PublicKeySize  = ed25519.PublicKeySize
	PrivateKeySize = ed25519.SeedSize
)

Variables

This section is empty.

Functions

func AttachNamespace added in v0.3.0

func AttachNamespace(namespace string, msg []byte) []byte

func NewKeyPair added in v0.1.5

func NewKeyPair() (PublicKey, *Ed25519Signer, error)

func Verify

func Verify(pub *PublicKey, msg []byte, sig *Signature) bool

Types

type Ed25519Signer added in v0.1.16

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

func NewEd25519Signer added in v0.1.5

func NewEd25519Signer(key *PrivateKey) *Ed25519Signer

func SignerFromHex added in v0.1.5

func SignerFromHex(s string) (*Ed25519Signer, error)

func (*Ed25519Signer) Private added in v0.1.16

func (s *Ed25519Signer) Private() (ret PrivateKey)

func (*Ed25519Signer) Public added in v0.1.16

func (s *Ed25519Signer) Public() (ret PublicKey)

func (*Ed25519Signer) Sign added in v0.1.16

func (s *Ed25519Signer) Sign(msg []byte) (Signature, error)

type Hash

type Hash [HashSize]byte

func HashBytes

func HashBytes(b []byte) Hash

func HashFile added in v0.1.6

func HashFile(f io.Reader) (digest Hash, err error)

func HashFromHex

func HashFromHex(s string) (h Hash, err error)

type PrivateKey added in v0.1.5

type PrivateKey [PrivateKeySize]byte

type PublicKey

type PublicKey [PublicKeySize]byte

func PublicKeyFromHex

func PublicKeyFromHex(s string) (pub PublicKey, err error)

type Signature

type Signature [SignatureSize]byte

func SignatureFromHex

func SignatureFromHex(s string) (sig Signature, err error)

type Signer added in v0.1.5

type Signer interface {
	Sign([]byte) (Signature, error)
	Public() PublicKey
}

Jump to

Keyboard shortcuts

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