crypto

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: BSD-2-Clause Imports: 6 Imported by: 1

Documentation

Overview

Package crypto implements verification interfaces.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyPrivateKey = errors.New("trying to sign without private key")
)

Functions

This section is empty.

Types

type RSAPSS

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

RSAPSS represents RSA PSS algo for signing/verification (with SHA256 as digest calculation function).

func (RSAPSS) Name

func (r RSAPSS) Name() string

Name implements SignerVerifier interface.

func (RSAPSS) Sign

func (r RSAPSS) Sign(data []byte) ([]byte, error)

Sign generates SHA-256 digest and signs it using RSASSA-PSS.

func (RSAPSS) Verify

func (r RSAPSS) Verify(data []byte, signature []byte) error

Verify compares data with signature.

type Signer

type Signer interface {
	// Name returns name of the crypto algorithm, used by signer.
	Name() string
	// Sign returns signature for passed data.
	Sign(data []byte) ([]byte, error)
}

Signer implements high-level API for package signing.

type SignerVerifier

type SignerVerifier interface {
	Signer
	Verifier
}

SignerVerifier common interface.

func NewRSAPSSSignerVerifier

func NewRSAPSSSignerVerifier(privKey rsa.PrivateKey) SignerVerifier

NewRSAPSSSignerVerifier creates new RSAPSS object that can both sign and verify. The public key is derived from the private key.

type Verifier

type Verifier interface {
	// Name returns name of the crypto algorithm, used by verifier.
	Name() string
	// Verify checks data and signature mapping.
	Verify(data []byte, signature []byte) error
}

Verifier is an interface implementing a generic signature verification algorithm.

func NewRSAPSSVerifier

func NewRSAPSSVerifier(pubKey rsa.PublicKey) Verifier

NewRSAPSSVerifier creates new RSAPSS object that can only verify signatures.

Jump to

Keyboard shortcuts

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