blindrsa

package
v0.0.0-...-746a847 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnexpectedSize is the error used if the size of a parameter does not match its expected value.
	ErrUnexpectedSize = errors.New("blindsign/blindrsa: unexpected input size")

	// ErrInvalidMessageLength is the error used if the size of a protocol message does not match its expected value.
	ErrInvalidMessageLength = errors.New("blindsign/blindrsa: invalid message length")

	// ErrInvalidBlind is the error used if the blind generated by the Verifier fails.
	ErrInvalidBlind = errors.New("blindsign/blindrsa: invalid blind")

	// ErrInvalidRandomness is the error used if caller did not provide randomness to the Blind() function.
	ErrInvalidRandomness = errors.New("blindsign/blindrsa: invalid random parameter")
)

Functions

This section is empty.

Types

type RSASigner

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

An RSASigner represents the Signer in the blind RSA protocol. It carries the raw RSA private key used for signing blinded messages.

func NewRSASigner

func NewRSASigner(sk *rsa.PrivateKey) RSASigner

NewRSASigner creates a new Signer for the blind RSA protocol using an RSA private key.

func (RSASigner) BlindSign

func (signer RSASigner) BlindSign(data []byte) ([]byte, error)

BlindSign blindly computes the RSA operation using the Signer's private key on the blinded message input, if it's of valid length, and returns an error should the function fail.

See the specification for more details: https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-rsa-blind-signatures-02#section-5.1.2

type RSAVerifier

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

An RSAVerifier represents a Verifier in the RSA blind signature protocol. It carries state needed to produce and validate an RSA blind signature.

func NewRSAVerifier

func NewRSAVerifier(pk *rsa.PublicKey, hash hash.Hash) RSAVerifier

NewRSAVerifier creates a new RSAVerifier using the corresponding Signer parameters.

func (RSAVerifier) Blind

func (v RSAVerifier) Blind(random io.Reader, message []byte) ([]byte, blindsign.VerifierState, error)

Blind initializes the blind RSA protocol using an input message and source of randomness. The signature includes a randomly generated PSS salt whose length equals the size of the underlying hash function. This function fails if randomness was not provided.

See the specification for more details: https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-rsa-blind-signatures-02#section-5.1.1

func (RSAVerifier) FixedBlind

func (v RSAVerifier) FixedBlind(message, blind, salt []byte) ([]byte, blindsign.VerifierState, error)

FixedBlind runs the Blind function with fixed blind and salt inputs.

type RSAVerifierState

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

An RSAVerifierState carries state needed to complete the blind signature protocol as a verifier.

func (RSAVerifierState) CopyBlind

func (state RSAVerifierState) CopyBlind() []byte

CopyBlind returns an encoding of the blind value used in the protocol.

func (RSAVerifierState) CopySalt

func (state RSAVerifierState) CopySalt() []byte

CopySalt returns an encoding of the per-message salt used in the protocol.

func (RSAVerifierState) Finalize

func (state RSAVerifierState) Finalize(data []byte) ([]byte, error)

Finalize computes and outputs the final signature, if it's valid. Otherwise, it returns an error.

See the specification for more details: https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-rsa-blind-signatures-02#section-5.1.3

Jump to

Keyboard shortcuts

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