crypto

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: BSD-2-Clause Imports: 7 Imported by: 4

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 NewEd25519Signer added in v0.1.5

func NewEd25519Signer(key *PrivateKey) *ed25519Signer

func Verify

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

Types

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 NewKeyPair added in v0.1.5

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

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
}

func SignerFromHex added in v0.1.5

func SignerFromHex(s string) (Signer, error)

Jump to

Keyboard shortcuts

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