ecdsa

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package ecdsa provides utilities for signing and verifying messages using ECDSA.

Index

Constants

This section is empty.

Variables

View Source
var ErrHashUnavailable = errors.New("ecdsa: requested hash function is unavailable")

ErrHashUnavailable is returned when the hash function is not linked into the binary.

Functions

This section is empty.

Types

type Signer

type Signer struct {
	Verifier
	Rand io.Reader // Defaults to crypto/rand.Reader if not set.
	// contains filtered or unexported fields
}

Signer signs messages using ECDSA. It is safe for concurrent use by multiple goroutines.

func NewSigner

func NewSigner(priv *ecdsa.PrivateKey, hash crypto.Hash) (*Signer, error)

NewSigner returns a new Signer for the provided private key and hash algorithm.

func (*Signer) Sign

func (s *Signer) Sign(message []byte) ([]byte, error)

Sign signs a message using the private key.

type Verifier

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

Verifier verifies ECDSA message signatures. It is safe for concurrent use by multiple goroutines.

func NewVerifier

func NewVerifier(pub *ecdsa.PublicKey, hash crypto.Hash) (*Verifier, error)

NewVerifier returns a new Verifier for the provided public key and hash algorithm.

func (*Verifier) Verify

func (v *Verifier) Verify(message []byte, signature []byte) (bool, error)

Verify verifies the signature of a message using the public key.

Jump to

Keyboard shortcuts

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